Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable single operator to monitor all namespaces #188

Merged
merged 4 commits into from
Feb 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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://raw.githubusercontent.com/jaegertracing/jaeger-operator/master/deploy/crds/io_v1alpha1_jaeger_crd.yaml
kubectl create -f https://raw.githubusercontent.com/jaegertracing/jaeger-operator/master/deploy/service_account.yaml
kubectl create -f https://raw.githubusercontent.com/jaegertracing/jaeger-operator/master/deploy/role.yaml
kubectl create -f https://raw.githubusercontent.com/jaegertracing/jaeger-operator/master/deploy/role_binding.yaml
kubectl create -f https://raw.githubusercontent.com/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://raw.githubusercontent.com/jaegertracing/jaeger-operator/master/deploy/crds/io_v1alpha1_jaeger_crd.yaml
oc create -f https://raw.githubusercontent.com/jaegertracing/jaeger-operator/master/deploy/service_account.yaml
oc create -f https://raw.githubusercontent.com/jaegertracing/jaeger-operator/master/deploy/role.yaml
oc create -f https://raw.githubusercontent.com/jaegertracing/jaeger-operator/master/deploy/role_binding.yaml
oc create -f https://raw.githubusercontent.com/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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jpkrohling I ran the command as described here - just wondering if the removal of the --platform=openshift is right?

cc @awgreene

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't look correct. OLM is, AFAIK, OpenShift-specific, so, it requires the --platform=openshift.

Copy link
Contributor Author

@objectiser objectiser Feb 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think OLM is supposed to be OpenShift specific - question is why it automatically removes this arg, but leaves the start argument? Maybe it is just using the operator.yaml.

Might be worth addressing this by checking for Route or other OpenShift specific resource to determine platform, to avoid separate deploy file?

Copy link
Contributor

@awgreene awgreene Feb 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @jpkrohling and @objectiser

OLM and Marketplace will be able to run on vanilla Kubernetes. The Operator-sdk gen will use the operator.yaml by default. Ideally, there would be a single deployment file called operator.yaml and checks for the platform would be done within the running operator.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@awgreene Ok thanks.

@jpkrohling So should we just merge this PR and work on detecting the platform automatically in a separate PR?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, LGTM

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