Skip to content

Commit

Permalink
Enable single operator to monitor all namespaces (#188)
Browse files Browse the repository at this point in the history
* Enable single operator to monitor all namespaces

Signed-off-by: Gary Brown <gary@brownuk.com>

* Update to use observability namespace by default

Signed-off-by: Gary Brown <gary@brownuk.com>

* Namespace not required in crd

Signed-off-by: Gary Brown <gary@brownuk.com>

* Ran the operator-sdk olm-catalog gen-csv --csv-version 1.9.0 command

Signed-off-by: Gary Brown <gary@brownuk.com>
  • Loading branch information
objectiser authored Feb 11, 2019
1 parent 1a77e49 commit fab8f32
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 31 deletions.
10 changes: 10 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,17 @@ To install the operator, run:

[source,bash]
----
kubectl create namespace observability # <1>
kubectl create -f https://github.com/raw/jaegertracing/jaeger-operator/master/deploy/crds/io_v1alpha1_jaeger_crd.yaml
kubectl create -f https://github.com/raw/jaegertracing/jaeger-operator/master/deploy/service_account.yaml
kubectl create -f https://github.com/raw/jaegertracing/jaeger-operator/master/deploy/role.yaml
kubectl create -f https://github.com/raw/jaegertracing/jaeger-operator/master/deploy/role_binding.yaml
kubectl create -f https://github.com/raw/jaegertracing/jaeger-operator/master/deploy/operator.yaml
----
<1> This creates the namespace used by default in the deployment files.

If you want to install the Jaeger operator in a different namespace, you will need to edit the deployment
files to change `observability` to the required value.

At this point, there should be a `jaeger-operator` deployment available:

Expand All @@ -45,12 +50,17 @@ The instructions from the previous section also work on OpenShift given that the
----
oc login -u system:admin
oc new-project observability # <1>
oc create -f https://github.com/raw/jaegertracing/jaeger-operator/master/deploy/crds/io_v1alpha1_jaeger_crd.yaml
oc create -f https://github.com/raw/jaegertracing/jaeger-operator/master/deploy/service_account.yaml
oc create -f https://github.com/raw/jaegertracing/jaeger-operator/master/deploy/role.yaml
oc create -f https://github.com/raw/jaegertracing/jaeger-operator/master/deploy/role_binding.yaml
oc create -f https://github.com/raw/jaegertracing/jaeger-operator/master/deploy/operator-openshift.yaml
----
<1> This creates the namespace used by default in the deployment files.

If you want to install the Jaeger operator in a different namespace, you will need to edit the deployment
files to change `observability` to the required value.

Once the operator is installed, grant the role `jaeger-operator` to users who should be able to install individual Jaeger instances. The following example creates a role binding allowing the user `developer` to create Jaeger instances:

Expand Down
92 changes: 70 additions & 22 deletions deploy/olm-catalog/jaeger-operator.csv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,23 +64,73 @@ spec:
apiservicedefinitions: {}
customresourcedefinitions:
owned:
- kind: Jaeger
- description: A configuration file for a Jaeger custom resource.
displayName: Jaeger
kind: Jaeger
name: jaegers.io.jaegertracing
version: v1alpha1
description: Provides monitoring and troubleshooting microservices-based distributed
systems
displayName: jaeger-operator
installModes:
- type: OwnNamespace
supported: false
- type: SingleNamespace
supported: false
- type: MultiNamespace
supported: false
- type: AllNamespaces
supported: true
install:
spec:
clusterPermissions:
- rules:
- apiGroups:
- ""
resources:
- pods
- services
- endpoints
- persistentvolumeclaims
- events
- configmaps
- secrets
- serviceaccounts
verbs:
- '*'
- apiGroups:
- apps
resources:
- deployments
- daemonsets
- replicasets
- statefulsets
verbs:
- '*'
- apiGroups:
- monitoring.coreos.com
resources:
- servicemonitors
verbs:
- get
- create
- apiGroups:
- io.jaegertracing
resources:
- '*'
verbs:
- '*'
- apiGroups:
- extensions
resources:
- ingresses
verbs:
- '*'
- apiGroups:
- batch
resources:
- jobs
- cronjobs
verbs:
- '*'
- apiGroups:
- route.openshift.io
resources:
- routes
verbs:
- '*'
serviceAccountName: jaeger-operator
deployments:
- name: jaeger-operator
spec:
Expand All @@ -98,19 +148,15 @@ spec:
containers:
- args:
- start
- --platform=openshift
env:
- name: WATCH_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.annotations['olm.targetNamespaces']
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: OPERATOR_NAME
value: jaeger-operator
image: jaegertracing/jaeger-operator:1.9.0
image: jaegertracing/jaeger-operator:1.9.1
imagePullPolicy: Always
name: jaeger-operator
ports:
Expand Down Expand Up @@ -170,6 +216,15 @@ spec:
- '*'
serviceAccountName: jaeger-operator
strategy: deployment
installModes:
- supported: false
type: OwnNamespace
- supported: false
type: SingleNamespace
- supported: false
type: MultiNamespace
- supported: true
type: AllNamespaces
keywords:
- tracing
- monitoring
Expand All @@ -188,10 +243,3 @@ spec:
matchLabels:
name: jaeger-operator
version: 1.9.0
customresourcedefinitions:
owned:
- name: jaegers.io.jaegertracing
version: v1alpha1
kind: Jaeger
displayName: Jaeger
description: A configuration file for a Jaeger custom resource.
5 changes: 2 additions & 3 deletions deploy/operator-openshift.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: jaeger-operator
namespace: observability
spec:
replicas: 1
selector:
Expand All @@ -23,9 +24,7 @@ spec:
imagePullPolicy: Always
env:
- name: WATCH_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
value: ""
- name: POD_NAME
valueFrom:
fieldRef:
Expand Down
5 changes: 2 additions & 3 deletions deploy/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: jaeger-operator
namespace: observability
spec:
replicas: 1
selector:
Expand All @@ -23,9 +24,7 @@ spec:
imagePullPolicy: Always
env:
- name: WATCH_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
value: ""
- name: POD_NAME
valueFrom:
fieldRef:
Expand Down
3 changes: 2 additions & 1 deletion deploy/role.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
kind: ClusterRole
metadata:
creationTimestamp: null
name: jaeger-operator
namespace: observability
rules:
- apiGroups:
- ""
Expand Down
6 changes: 4 additions & 2 deletions deploy/role_binding.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
kind: RoleBinding
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: jaeger-operator
namespace: observability
subjects:
- kind: ServiceAccount
name: jaeger-operator
namespace: observability
roleRef:
kind: Role
kind: ClusterRole
name: jaeger-operator
apiGroup: rbac.authorization.k8s.io
1 change: 1 addition & 0 deletions deploy/service_account.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: jaeger-operator
namespace: observability

0 comments on commit fab8f32

Please sign in to comment.