From 67580e7fe7c3ad943cd77d52a5767c241734a489 Mon Sep 17 00:00:00 2001 From: Peter Braun Date: Tue, 23 Jul 2019 12:51:37 +0200 Subject: [PATCH 1/5] add operatorhub bundle files --- .../grafana-operator/1.2.0/Grafana.yaml | 61 +++++ .../1.2.0/GrafanaDashboard.yaml | 34 +++ .../1.2.0/GrafanaDataSource.yaml | 35 +++ .../1.2.0/grafana-operator.package.yaml | 4 + ...operator.v1.2.0.clusterserviceversion.yaml | 248 ++++++++++++++++++ deploy/operator.yaml | 2 +- deploy/role.yaml | 1 + 7 files changed, 384 insertions(+), 1 deletion(-) create mode 100644 deploy/olm-catalog/grafana-operator/1.2.0/Grafana.yaml create mode 100644 deploy/olm-catalog/grafana-operator/1.2.0/GrafanaDashboard.yaml create mode 100644 deploy/olm-catalog/grafana-operator/1.2.0/GrafanaDataSource.yaml create mode 100644 deploy/olm-catalog/grafana-operator/1.2.0/grafana-operator.package.yaml create mode 100644 deploy/olm-catalog/grafana-operator/1.2.0/grafana-operator.v1.2.0.clusterserviceversion.yaml create mode 120000 deploy/role.yaml diff --git a/deploy/olm-catalog/grafana-operator/1.2.0/Grafana.yaml b/deploy/olm-catalog/grafana-operator/1.2.0/Grafana.yaml new file mode 100644 index 000000000..1841b2356 --- /dev/null +++ b/deploy/olm-catalog/grafana-operator/1.2.0/Grafana.yaml @@ -0,0 +1,61 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: grafanas.integreatly.org +spec: + group: integreatly.org + names: + kind: Grafana + listKind: GrafanaList + plural: grafanas + singular: grafana + scope: Namespaced + version: v1alpha1 + validation: + openAPIV3Schema: + required: ["spec"] + properties: + spec: + properties: + hostname: + type: string + description: Hostname for the ingress. Optional when --openshift is set + containers: + type: array + items: + type: object + description: Additional container to add to the grafana pod + secrets: + type: array + items: + type: string + description: Secret to be mounted as volume into the grafana deployment + logLevel: + type: string + description: Log level of the grafana instance, defaults to info + adminUser: + type: string + description: Default admin user name + adminPassword: + type: string + description: Default admin password + basicAuth: + type: boolean + description: Basic auth enabled + disableLoginForm: + type: boolean + description: Disable login form + disableSignoutMenu: + type: boolean + description: Disable signout menu + anonymous: + type: boolean + description: Anonymous auth enabled + config: + type: object + description: Grafana config + dashboardLabelSelectors: + type: array + items: + type: object + description: Label selector or match expressions diff --git a/deploy/olm-catalog/grafana-operator/1.2.0/GrafanaDashboard.yaml b/deploy/olm-catalog/grafana-operator/1.2.0/GrafanaDashboard.yaml new file mode 100644 index 000000000..81a19aa8b --- /dev/null +++ b/deploy/olm-catalog/grafana-operator/1.2.0/GrafanaDashboard.yaml @@ -0,0 +1,34 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: grafanadashboards.integreatly.org +spec: + group: integreatly.org + names: + kind: GrafanaDashboard + listKind: GrafanaDashboardList + plural: grafanadashboards + singular: grafanadashboard + scope: Namespaced + version: v1alpha1 + validation: + openAPIV3Schema: + properties: + status: + properties: + messages: + type: array + items: + description: Dashboard Status Message + type: object + spec: + properties: + name: + type: string + json: + type: string + plugins: + type: array + items: + description: Grafana Plugin Object + type: object \ No newline at end of file diff --git a/deploy/olm-catalog/grafana-operator/1.2.0/GrafanaDataSource.yaml b/deploy/olm-catalog/grafana-operator/1.2.0/GrafanaDataSource.yaml new file mode 100644 index 000000000..a182dfc87 --- /dev/null +++ b/deploy/olm-catalog/grafana-operator/1.2.0/GrafanaDataSource.yaml @@ -0,0 +1,35 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: grafanadatasources.integreatly.org +spec: + group: integreatly.org + names: + kind: GrafanaDataSource + listKind: GrafanaDataSourceList + plural: grafanadatasources + singular: grafanadatasource + scope: Namespaced + version: v1alpha1 + validation: + openAPIV3Schema: + properties: + apiVersion: + type: string + kind: + type: string + metadata: + type: object + spec: + required: ["datasources", "name"] + properties: + name: + type: string + minimum: 1 + datasources: + type: array + items: + description: Grafana Datasource Object + type: object + status: + type: object diff --git a/deploy/olm-catalog/grafana-operator/1.2.0/grafana-operator.package.yaml b/deploy/olm-catalog/grafana-operator/1.2.0/grafana-operator.package.yaml new file mode 100644 index 000000000..cdb94075c --- /dev/null +++ b/deploy/olm-catalog/grafana-operator/1.2.0/grafana-operator.package.yaml @@ -0,0 +1,4 @@ +packageName: grafana-operator +channels: + - name: alpha + currentCSV: grafana-operator.v1.2.0 \ No newline at end of file diff --git a/deploy/olm-catalog/grafana-operator/1.2.0/grafana-operator.v1.2.0.clusterserviceversion.yaml b/deploy/olm-catalog/grafana-operator/1.2.0/grafana-operator.v1.2.0.clusterserviceversion.yaml new file mode 100644 index 000000000..e449b2a6b --- /dev/null +++ b/deploy/olm-catalog/grafana-operator/1.2.0/grafana-operator.v1.2.0.clusterserviceversion.yaml @@ -0,0 +1,248 @@ +apiVersion: operators.coreos.com/v1alpha1 +kind: ClusterServiceVersion +metadata: + annotations: + capabilities: Basic Install + description: An Operator for creating and managing Grafana instances, dashboards, plugins and data sources + categories: "Monitoring" + containerImage: quay.io/integreatly/grafana-operator:v1.2.0 + createdAt: 2019-07-23T00:00:00Z + support: Integreatly + certified: "False" + repository: https://github.com/integr8ly/grafana-operator + alm-examples: |- + [ + { + "apiVersion": "integreatly.org/v1alpha1", + "kind": "Grafana", + "metadata": { + "name": "example-grafana" + }, + "spec": { + "config": { + "auth": { + "disable_signout_menu": true + }, + "auth.anonymous": { + "enabled": true + }, + "log": { + "level": "warn", + "mode": "console" + }, + "security": { + "admin_password": "secret", + "admin_user": "root" + } + }, + "dashboardLabelSelector": [ + { + "matchExpressions": [ + { + "key": "app", + "operator": "In", + "values": [ + "grafana" + ] + } + ] + } + ], + "hostname": "grafana.apps.127.0.0.1.nip.io" + } + }, + { + "apiVersion": "integreatly.org/v1alpha1", + "kind": "GrafanaDashboard", + "metadata": { + "labels": { + "app": "grafana" + }, + "name": "simple-dashboard" + }, + "spec": { + "json": "{\n \"id\": null,\n \"title\": \"Simple Dashboard\",\n \"tags\": [],\n \"style\": \"dark\",\n \"timezone\": \"browser\",\n \"editable\": true,\n \"hideControls\": false,\n \"graphTooltip\": 1,\n \"panels\": [],\n \"time\": {\n \"from\": \"now-6h\",\n \"to\": \"now\"\n },\n \"timepicker\": {\n \"time_options\": [],\n \"refresh_intervals\": []\n },\n \"templating\": {\n \"list\": []\n },\n \"annotations\": {\n \"list\": []\n },\n \"refresh\": \"5s\",\n \"schemaVersion\": 17,\n \"version\": 0,\n \"links\": []\n}\n", + "name": "simple-dashboard.json" + } + }, + { + "apiVersion": "integreatly.org/v1alpha1", + "kind": "GrafanaDataSource", + "metadata": { + "name": "example-grafanadatasource" + }, + "spec": { + "datasources": [ + { + "access": "proxy", + "editable": true, + "isDefault": true, + "jsonData": { + "timeInterval": "5s" + }, + "name": "Prometheus", + "type": "prometheus", + "url": "http://prometheus-service:9090", + "version": 1 + } + ], + "name": "example-datasources.yaml" + } + } + ] + name: grafana-operator.v1.2.0 + namespace: placeholder +spec: + apiservicedefinitions: {} + customresourcedefinitions: + owned: + - kind: Grafana + name: grafanas.integreatly.org + version: v1alpha1 + description: Represents a Grafana Instance + displayName: Grafana + - kind: GrafanaDashboard + name: grafanadashboards.integreatly.org + version: v1alpha1 + description: Represents a Grafana Dashboard + displayName: Grafana Dashboard + - kind: GrafanaDataSource + name: grafanadatasources.integreatly.org + version: v1alpha1 + description: Represents a Grafana Data Source + displayName: Grafana Data Source + description: An Operator for creating and managing Grafana instances, dashboards, plugins and data sources + displayName: Grafana Operator + links: + - name: Documentation + url: https://github.com/integr8ly/grafana-operator/tree/v1.2.0/documentation + - name: Github + url: https://github.com/integr8ly/grafana-operator + icon: + - base64data: PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDIwLjEuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPg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AuMSwwLDAsMGwwLDBoMC4xCgljMC4xLDAsMC4yLDAsMC40LDBjMC41LDAsMC45LDAsMS40LDBjMC45LDAsMS44LDAuMSwyLjcsMC4zYzEuOCwwLjMsMy40LDAuOSw0LjksMS42YzEuNSwwLjcsMi45LDEuNiw0LDIuNgoJYzAuMSwwLjEsMC4xLDAuMSwwLjIsMC4yYzAuMSwwLjEsMC4xLDAuMSwwLjIsMC4yYzAuMSwwLjEsMC4zLDAuMywwLjQsMC40YzAuMSwwLjEsMC4zLDAuMywwLjQsMC40YzAuMSwwLjEsMC4zLDAuMywwLjQsMC40CgljMC41LDAuNSwxLDEuMSwxLjQsMS42YzAuOCwxLjEsMS41LDIuMSwyLDMuMmMwLDAuMSwwLjEsMC4xLDAuMSwwLjJzMC4xLDAuMSwwLjEsMC4yYzAuMSwwLjEsMC4xLDAuMywwLjIsMC40CgljMC4xLDAuMSwwLjEsMC4yLDAuMiwwLjRjMC4xLDAuMSwwLjEsMC4yLDAuMiwwLjRjMC4yLDAuNSwwLjQsMC45LDAuNSwxLjRjMC4yLDAuNywwLjQsMS4zLDAuNiwxLjljMC4xLDAuMiwwLjMsMC40LDAuNSwwLjMKCWMwLjIsMCwwLjQtMC4yLDAuNC0wLjRDNTMuMiwyNyw1My4yLDI2LjMsNTMuMSwyNS41eiIvPgo8L3N2Zz4K + mediatype: image/svg+xml + install: + spec: + deployments: + - name: grafana-operator + spec: + replicas: 1 + selector: + matchLabels: + name: grafana-operator + strategy: {} + template: + metadata: + labels: + name: grafana-operator + spec: + containers: + - args: + - --grafana-image=quay.io/openshift/origin-grafana + - --grafana-image-tag=4.2 + command: + - grafana-operator + env: + - name: TEMPLATE_PATH + value: /usr/local/bin/templates + - name: WATCH_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: OPERATOR_NAME + value: grafana-operator + image: quay.io/integreatly/grafana-operator:v1.2.0 + imagePullPolicy: Always + name: grafana-operator + ports: + - containerPort: 60000 + name: metrics + readinessProbe: + exec: + command: + - stat + - /tmp/operator-sdk-ready + failureThreshold: 1 + initialDelaySeconds: 4 + periodSeconds: 10 + resources: {} + serviceAccountName: grafana-operator + permissions: + - rules: + - apiGroups: + - "" + resources: + - pods + - services + - endpoints + - persistentvolumeclaims + - events + - configmaps + - secrets + - serviceaccounts + verbs: + - '*' + - apiGroups: + - apps + resources: + - deployments + - daemonsets + - replicasets + - statefulsets + verbs: + - '*' + - apiGroups: + - route.openshift.io + resources: + - routes + verbs: + - '*' + - apiGroups: + - monitoring.coreos.com + resources: + - servicemonitors + verbs: + - get + - create + - apiGroups: + - extensions + resources: + - ingresses + verbs: + - '*' + - apiGroups: + - integreatly.org + resources: + - grafanas + - grafanadashboards + - grafanadatasources + - grafanas/finalizers + - grafanadashboards/finalizers + - grafanadatasources/finalizers + verbs: + - '*' + serviceAccountName: grafana-operator + strategy: deployment + installModes: + - supported: true + type: OwnNamespace + - supported: true + type: SingleNamespace + - supported: false + type: MultiNamespace + - supported: true + type: AllNamespaces + keywords: + - Grafana + - Metrics + maintainers: + - email: integreatly@redhat.com + name: Integreatly + maturity: alpha + provider: + name: Integreatly + version: 1.2.0 diff --git a/deploy/operator.yaml b/deploy/operator.yaml index 9d8073955..a96fed8b8 100644 --- a/deploy/operator.yaml +++ b/deploy/operator.yaml @@ -15,7 +15,7 @@ spec: serviceAccountName: grafana-operator containers: - name: grafana-operator - image: quay.io/integreatly/grafana-operator:latest + image: quay.io/integreatly/grafana-operator:v1.2.0 args: - '--grafana-image=quay.io/openshift/origin-grafana' - '--grafana-image-tag=4.2' diff --git a/deploy/role.yaml b/deploy/role.yaml new file mode 120000 index 000000000..07d62b146 --- /dev/null +++ b/deploy/role.yaml @@ -0,0 +1 @@ +roles/role.yaml \ No newline at end of file From d8876ea4c2e55d95ef246a3b6bdc81087233defe Mon Sep 17 00:00:00 2001 From: Peter Braun Date: Tue, 23 Jul 2019 13:01:45 +0200 Subject: [PATCH 2/5] update description --- README.md | 2 +- ...ana-operator.v1.2.0.clusterserviceversion.yaml | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 744314bfb..b4fc4c6dd 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ A Kubernetes Operator based on the Operator SDK for creating and managing Grafan # Current status -The Operator is functional and can deploy and manage a Grafana instance on Kubernetes and OpenShift. The following features are supported: +The Operator can deploy and manage a Grafana instance on Kubernetes and OpenShift. The following features are supported: * Install Grafana to a namespace * Import Grafana dashboards from the same or other namespaces diff --git a/deploy/olm-catalog/grafana-operator/1.2.0/grafana-operator.v1.2.0.clusterserviceversion.yaml b/deploy/olm-catalog/grafana-operator/1.2.0/grafana-operator.v1.2.0.clusterserviceversion.yaml index e449b2a6b..12e9feee0 100644 --- a/deploy/olm-catalog/grafana-operator/1.2.0/grafana-operator.v1.2.0.clusterserviceversion.yaml +++ b/deploy/olm-catalog/grafana-operator/1.2.0/grafana-operator.v1.2.0.clusterserviceversion.yaml @@ -111,7 +111,19 @@ spec: version: v1alpha1 description: Represents a Grafana Data Source displayName: Grafana Data Source - description: An Operator for creating and managing Grafana instances, dashboards, plugins and data sources + description: > + # Grafana Operator + + A Kubernetes Operator based on the Operator SDK for creating and managing Grafana instances. + + # Current status + + The Operator can deploy and manage a Grafana instance on Kubernetes and OpenShift. The following features are supported: + + * Install Grafana to a namespace + * Import Grafana dashboards from the same or other namespaces + * Import Grafana data sources from the same namespace + * Install Plugins (panels) defined as dependencies of dashboards displayName: Grafana Operator links: - name: Documentation @@ -239,6 +251,7 @@ spec: keywords: - Grafana - Metrics + - Monitoring maintainers: - email: integreatly@redhat.com name: Integreatly From fd255c7598551d8f26647bc832e6604f4a706e05 Mon Sep 17 00:00:00 2001 From: Peter Braun Date: Tue, 23 Jul 2019 13:14:46 +0200 Subject: [PATCH 3/5] preserve newlines in yaml multiline strings --- .../1.2.0/grafana-operator.v1.2.0.clusterserviceversion.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/olm-catalog/grafana-operator/1.2.0/grafana-operator.v1.2.0.clusterserviceversion.yaml b/deploy/olm-catalog/grafana-operator/1.2.0/grafana-operator.v1.2.0.clusterserviceversion.yaml index 12e9feee0..adbcbce63 100644 --- a/deploy/olm-catalog/grafana-operator/1.2.0/grafana-operator.v1.2.0.clusterserviceversion.yaml +++ b/deploy/olm-catalog/grafana-operator/1.2.0/grafana-operator.v1.2.0.clusterserviceversion.yaml @@ -111,7 +111,7 @@ spec: version: v1alpha1 description: Represents a Grafana Data Source displayName: Grafana Data Source - description: > + description: | # Grafana Operator A Kubernetes Operator based on the Operator SDK for creating and managing Grafana instances. From 484450598d3bae984d44520bfd3a1c8b34d0c128 Mon Sep 17 00:00:00 2001 From: Peter Braun Date: Tue, 23 Jul 2019 16:04:03 +0200 Subject: [PATCH 4/5] prepare 1.3.0 release --- deploy/crds/Grafana.yaml | 3 ++ deploy/examples/Grafana.yaml | 3 -- deploy/examples/GrafanaWithIngressHost.yaml | 23 +++++++++ deploy/examples/GrafanaWithRoute.yaml | 23 +++++++++ .../{1.2.0 => 1.3.0}/Grafana.yaml | 3 ++ .../{1.2.0 => 1.3.0}/GrafanaDashboard.yaml | 0 .../{1.2.0 => 1.3.0}/GrafanaDataSource.yaml | 0 .../grafana-operator.package.yaml | 2 +- ...perator.v1.3.0.clusterserviceversion.yaml} | 17 +++---- deploy/operator.yaml | 2 +- documentation/README.md | 24 +++++++++ documentation/dashboards.md | 10 ++++ documentation/deploy_grafana.md | 1 + .../integreatly/v1alpha1/grafana_types.go | 1 + pkg/controller/grafana/grafana_controller.go | 51 +++++++++++-------- version/version.go | 2 +- 16 files changed, 128 insertions(+), 37 deletions(-) create mode 100644 deploy/examples/GrafanaWithIngressHost.yaml create mode 100644 deploy/examples/GrafanaWithRoute.yaml rename deploy/olm-catalog/grafana-operator/{1.2.0 => 1.3.0}/Grafana.yaml (93%) rename deploy/olm-catalog/grafana-operator/{1.2.0 => 1.3.0}/GrafanaDashboard.yaml (100%) rename deploy/olm-catalog/grafana-operator/{1.2.0 => 1.3.0}/GrafanaDataSource.yaml (100%) rename deploy/olm-catalog/grafana-operator/{1.2.0 => 1.3.0}/grafana-operator.package.yaml (58%) rename deploy/olm-catalog/grafana-operator/{1.2.0/grafana-operator.v1.2.0.clusterserviceversion.yaml => 1.3.0/grafana-operator.v1.3.0.clusterserviceversion.yaml} (98%) create mode 100644 documentation/README.md diff --git a/deploy/crds/Grafana.yaml b/deploy/crds/Grafana.yaml index 1841b2356..41429c6c7 100644 --- a/deploy/crds/Grafana.yaml +++ b/deploy/crds/Grafana.yaml @@ -54,6 +54,9 @@ spec: config: type: object description: Grafana config + createRoute: + type: boolean + description: Create an OpenShift Route instead of Ingress dashboardLabelSelectors: type: array items: diff --git a/deploy/examples/Grafana.yaml b/deploy/examples/Grafana.yaml index 2fcebcf7b..c39e88342 100644 --- a/deploy/examples/Grafana.yaml +++ b/deploy/examples/Grafana.yaml @@ -3,13 +3,10 @@ kind: Grafana metadata: name: example-grafana spec: - hostname: "grafana.apps.127.0.0.1.nip.io" config: log: mode: "console" level: "warn" - dashboards: - versions_to_keep: 2 security: admin_user: "root" admin_password: "secret" diff --git a/deploy/examples/GrafanaWithIngressHost.yaml b/deploy/examples/GrafanaWithIngressHost.yaml new file mode 100644 index 000000000..75716b953 --- /dev/null +++ b/deploy/examples/GrafanaWithIngressHost.yaml @@ -0,0 +1,23 @@ +apiVersion: integreatly.org/v1alpha1 +kind: Grafana +metadata: + name: example-grafana +spec: + hostname: "grafana.apps.127.0.0.1.nip.io" + config: + log: + mode: "console" + level: "warn" + security: + admin_user: "root" + admin_password: "secret" + auth: + disable_login_form: False + disable_signout_menu: True + auth.basic: + enabled: False + auth.anonymous: + enabled: True + dashboardLabelSelector: + - matchExpressions: + - {key: app, operator: In, values: [grafana]} diff --git a/deploy/examples/GrafanaWithRoute.yaml b/deploy/examples/GrafanaWithRoute.yaml new file mode 100644 index 000000000..43391fb5e --- /dev/null +++ b/deploy/examples/GrafanaWithRoute.yaml @@ -0,0 +1,23 @@ +apiVersion: integreatly.org/v1alpha1 +kind: Grafana +metadata: + name: example-grafana +spec: + createRoute: True + config: + log: + mode: "console" + level: "warn" + security: + admin_user: "root" + admin_password: "secret" + auth: + disable_login_form: False + disable_signout_menu: True + auth.basic: + enabled: False + auth.anonymous: + enabled: True + dashboardLabelSelector: + - matchExpressions: + - {key: app, operator: In, values: [grafana]} diff --git a/deploy/olm-catalog/grafana-operator/1.2.0/Grafana.yaml b/deploy/olm-catalog/grafana-operator/1.3.0/Grafana.yaml similarity index 93% rename from deploy/olm-catalog/grafana-operator/1.2.0/Grafana.yaml rename to deploy/olm-catalog/grafana-operator/1.3.0/Grafana.yaml index 1841b2356..41429c6c7 100644 --- a/deploy/olm-catalog/grafana-operator/1.2.0/Grafana.yaml +++ b/deploy/olm-catalog/grafana-operator/1.3.0/Grafana.yaml @@ -54,6 +54,9 @@ spec: config: type: object description: Grafana config + createRoute: + type: boolean + description: Create an OpenShift Route instead of Ingress dashboardLabelSelectors: type: array items: diff --git a/deploy/olm-catalog/grafana-operator/1.2.0/GrafanaDashboard.yaml b/deploy/olm-catalog/grafana-operator/1.3.0/GrafanaDashboard.yaml similarity index 100% rename from deploy/olm-catalog/grafana-operator/1.2.0/GrafanaDashboard.yaml rename to deploy/olm-catalog/grafana-operator/1.3.0/GrafanaDashboard.yaml diff --git a/deploy/olm-catalog/grafana-operator/1.2.0/GrafanaDataSource.yaml b/deploy/olm-catalog/grafana-operator/1.3.0/GrafanaDataSource.yaml similarity index 100% rename from deploy/olm-catalog/grafana-operator/1.2.0/GrafanaDataSource.yaml rename to deploy/olm-catalog/grafana-operator/1.3.0/GrafanaDataSource.yaml diff --git a/deploy/olm-catalog/grafana-operator/1.2.0/grafana-operator.package.yaml b/deploy/olm-catalog/grafana-operator/1.3.0/grafana-operator.package.yaml similarity index 58% rename from deploy/olm-catalog/grafana-operator/1.2.0/grafana-operator.package.yaml rename to deploy/olm-catalog/grafana-operator/1.3.0/grafana-operator.package.yaml index cdb94075c..3eb30db80 100644 --- a/deploy/olm-catalog/grafana-operator/1.2.0/grafana-operator.package.yaml +++ b/deploy/olm-catalog/grafana-operator/1.3.0/grafana-operator.package.yaml @@ -1,4 +1,4 @@ packageName: grafana-operator channels: - name: alpha - currentCSV: grafana-operator.v1.2.0 \ No newline at end of file + currentCSV: grafana-operator.v1.3.0 \ No newline at end of file diff --git a/deploy/olm-catalog/grafana-operator/1.2.0/grafana-operator.v1.2.0.clusterserviceversion.yaml b/deploy/olm-catalog/grafana-operator/1.3.0/grafana-operator.v1.3.0.clusterserviceversion.yaml similarity index 98% rename from deploy/olm-catalog/grafana-operator/1.2.0/grafana-operator.v1.2.0.clusterserviceversion.yaml rename to deploy/olm-catalog/grafana-operator/1.3.0/grafana-operator.v1.3.0.clusterserviceversion.yaml index adbcbce63..8def91a9c 100644 --- a/deploy/olm-catalog/grafana-operator/1.2.0/grafana-operator.v1.2.0.clusterserviceversion.yaml +++ b/deploy/olm-catalog/grafana-operator/1.3.0/grafana-operator.v1.3.0.clusterserviceversion.yaml @@ -5,7 +5,7 @@ metadata: capabilities: Basic Install description: An Operator for creating and managing Grafana instances, dashboards, plugins and data sources categories: "Monitoring" - containerImage: quay.io/integreatly/grafana-operator:v1.2.0 + containerImage: quay.io/integreatly/grafana-operator:v1.3.0 createdAt: 2019-07-23T00:00:00Z support: Integreatly certified: "False" @@ -47,8 +47,7 @@ metadata: } ] } - ], - "hostname": "grafana.apps.127.0.0.1.nip.io" + ] } }, { @@ -90,7 +89,7 @@ metadata: } } ] - name: grafana-operator.v1.2.0 + name: grafana-operator.v1.3.0 namespace: placeholder spec: apiservicedefinitions: {} @@ -112,8 +111,6 @@ spec: description: Represents a Grafana Data Source displayName: Grafana Data Source description: | - # Grafana Operator - A Kubernetes Operator based on the Operator SDK for creating and managing Grafana instances. # Current status @@ -127,7 +124,7 @@ spec: displayName: Grafana Operator links: - name: Documentation - url: https://github.com/integr8ly/grafana-operator/tree/v1.2.0/documentation + url: https://github.com/integr8ly/grafana-operator/tree/v1.3.0/documentation - name: Github url: https://github.com/integr8ly/grafana-operator icon: @@ -167,7 +164,7 @@ spec: fieldPath: metadata.name - name: OPERATOR_NAME value: grafana-operator - image: quay.io/integreatly/grafana-operator:v1.2.0 + image: quay.io/integreatly/grafana-operator:latest imagePullPolicy: Always name: grafana-operator ports: @@ -246,7 +243,7 @@ spec: type: SingleNamespace - supported: false type: MultiNamespace - - supported: true + - supported: false type: AllNamespaces keywords: - Grafana @@ -258,4 +255,4 @@ spec: maturity: alpha provider: name: Integreatly - version: 1.2.0 + version: 1.3.0 diff --git a/deploy/operator.yaml b/deploy/operator.yaml index a96fed8b8..9d8073955 100644 --- a/deploy/operator.yaml +++ b/deploy/operator.yaml @@ -15,7 +15,7 @@ spec: serviceAccountName: grafana-operator containers: - name: grafana-operator - image: quay.io/integreatly/grafana-operator:v1.2.0 + image: quay.io/integreatly/grafana-operator:latest args: - '--grafana-image=quay.io/openshift/origin-grafana' - '--grafana-image-tag=4.2' diff --git a/documentation/README.md b/documentation/README.md new file mode 100644 index 000000000..8db720874 --- /dev/null +++ b/documentation/README.md @@ -0,0 +1,24 @@ +## Grafana Operator Documentation + +* [Installing Grafana](./deploy_grafana.md) +* [Dashboards](./dashboards.md) +* [Data Sources](./datasources.md) + +## Examples + +The following example CRs are provided: + +### Grafana deployments + +* [Grafana.yaml](../deploy/examples/Grafana.yaml): Installs Grafana using the default configuration and an Ingress if the `--openshift` flag is not provided. Suitable for Kubernetes and OpenShift. +* [GrafanaWithRoute.yaml](../deploy/examples/GrafanaWithRoute.yaml): Installs Grafana using the default configuration and a Route. Only suitable for OpenShift. +* [GrafanaWithIngressHost.yaml](../deploy/examples/GrafanaWithIngressHost.yaml): Installs Grafana using the default configuration and an Ingress where the host is set for outside access. Only suitable for Kubernetes, setting the host on Ingresses is not permitted on OpenShift. + +### Dashboards + +* [SimpleDashboard.yaml](../deploy/examples/dashboards/SimpleDashboard.yaml): Minimal empty dashboard. +* [DashboardWithPlugins.yaml](../deploy/examples/dashboards/DashboardWithPlugins.yaml): Minimal empty dashboard with plugin dependencies. + +### Data sources + +* [Prometheus.yaml](../deploy/examples/datasources/Prometheus.yaml): Prometheus data source, expects a service named `prometheus-service` listening on port 9090 in the same namespace. diff --git a/documentation/dashboards.md b/documentation/dashboards.md index 4e721d719..f9bf332ea 100644 --- a/documentation/dashboards.md +++ b/documentation/dashboards.md @@ -75,3 +75,13 @@ dashboardLabelSelector: - matchExpressions: - {key: group, operator: In, values: [grafana]} ``` + +## Discovering dashboards in other namespaces + +The operator can discover dashboards in other namespaces if the `--scan-all` flag is set. However this requires cluster wide permissions to the `GrafanaDashboard` custom resource. Create the permissions with: + +```sh +$ oc create -f deploy/cluster_roles +``` + +*NOTE*: when installing the operator from [operatorhub](https://operatorhub.io/) it will only have permissions to the namespace it's installed in. To discover dashboards in other namespaces you need to apply the cluster roles after installing the operator and add the `--scan-all` flag to the operator container. \ No newline at end of file diff --git a/documentation/deploy_grafana.md b/documentation/deploy_grafana.md index 784048418..f5e497bdd 100644 --- a/documentation/deploy_grafana.md +++ b/documentation/deploy_grafana.md @@ -62,6 +62,7 @@ The resource accepts the following properties in it's `spec`: * *containers*: Extra containers to be added to the Grafana deployment. Can be used for example to add auth proxy side cars. * *secrets*: A list of secrets that are added as volumes to the deployment. Mostly useful in combination with extra `containers`. * *config*: The properties used to generate `grafana.ini`. All properties defined in the [official documentation](https://grafana.com/docs/installation/configuration/) are supported although some of them are not allowed to be overridden (path configuration). See `deploy/examples/Grafana.yaml` for an example. +* *createRoute*: Force the operator to create a Route instead of an Ingress even if the `--openshift` flag is not set. The other accepted properties are `logLevel`, `adminUser`, `adminPassword`, `basicAuth`, `disableLoginForm`, `disableSignoutMenu` and `anonymous`. They are supported for legacy reasons, but new instances should use the `config` field. If a value is set in `config` then it will override the legacy field. diff --git a/pkg/apis/integreatly/v1alpha1/grafana_types.go b/pkg/apis/integreatly/v1alpha1/grafana_types.go index 1851cc5f6..a60cff3bc 100644 --- a/pkg/apis/integreatly/v1alpha1/grafana_types.go +++ b/pkg/apis/integreatly/v1alpha1/grafana_types.go @@ -25,6 +25,7 @@ type GrafanaSpec struct { DisableSignoutMenu bool `json:"disableSignoutMenu"` Anonymous bool `json:"anonymous"` Config GrafanaConfig `json:"config"` + CreateRoute bool `json:"createRoute"` } type GrafanaConfig struct { diff --git a/pkg/controller/grafana/grafana_controller.go b/pkg/controller/grafana/grafana_controller.go index 8e3d36bff..dfd82c7ca 100644 --- a/pkg/controller/grafana/grafana_controller.go +++ b/pkg/controller/grafana/grafana_controller.go @@ -99,12 +99,12 @@ func (r *ReconcileGrafana) Reconcile(request reconcile.Request) (reconcile.Resul switch cr.Status.Phase { case PhaseConfigFiles: - return r.CreateConfigFiles(cr) + return r.createConfigFiles(cr) case PhaseInstallGrafana: - return r.InstallGrafana(cr) + return r.installGrafana(cr) case PhaseDone: log.Info("Grafana installation complete") - return r.UpdatePhase(cr, PhaseReconcile) + return r.updatePhase(cr, PhaseReconcile) case PhaseReconcile: return r.ReconcileGrafana(cr) } @@ -247,18 +247,27 @@ func (r *ReconcileGrafana) createGrafanaConfig(cr *i8ly.Grafana) error { } cr.Status.LastConfig = grafanaIni.Hash - return r.client.Create(context.TODO(), &configMap) + err = r.client.Create(context.TODO(), &configMap) + if err != nil { + // This might be called multiple times if creating one of the other config + // resources fails + if errors.IsAlreadyExists(err) { + return nil + } + } + return err } -func (r *ReconcileGrafana) CreateConfigFiles(cr *i8ly.Grafana) (reconcile.Result, error) { +func (r *ReconcileGrafana) createConfigFiles(cr *i8ly.Grafana) (reconcile.Result, error) { log.Info("Phase: Create Config Files") ingressType := common.GrafanaIngressName - if common.GetControllerConfig().GetConfigBool(common.ConfigOpenshift, false) == true { + if cr.Spec.CreateRoute || + common.GetControllerConfig().GetConfigBool(common.ConfigOpenshift, false) == true { ingressType = common.GrafanaRouteName } - err := r.CreateServiceAccount(cr, common.GrafanaServiceAccountName) + err := r.createServiceAccount(cr, common.GrafanaServiceAccountName) if err != nil { return reconcile.Result{}, err } @@ -269,7 +278,7 @@ func (r *ReconcileGrafana) CreateConfigFiles(cr *i8ly.Grafana) (reconcile.Result } for _, resourceName := range []string{common.GrafanaDashboardsConfigMapName, common.GrafanaProvidersConfigMapName, common.GrafanaDatasourcesConfigMapName, common.GrafanaServiceName, ingressType} { - if err := r.CreateResource(cr, resourceName); err != nil { + if err := r.createResource(cr, resourceName); err != nil { log.Info(fmt.Sprintf("Error in CreateConfigFiles, resourceName=%s : err=%s", resourceName, err)) // Requeue so it can be attempted again return reconcile.Result{}, err @@ -277,23 +286,23 @@ func (r *ReconcileGrafana) CreateConfigFiles(cr *i8ly.Grafana) (reconcile.Result } log.Info("Config files created") - return r.UpdatePhase(cr, PhaseInstallGrafana) + return r.updatePhase(cr, PhaseInstallGrafana) } -func (r *ReconcileGrafana) InstallGrafana(cr *i8ly.Grafana) (reconcile.Result, error) { +func (r *ReconcileGrafana) installGrafana(cr *i8ly.Grafana) (reconcile.Result, error) { log.Info("Phase: Install Grafana") - err := r.CreateDeployment(cr, common.GrafanaDeploymentName) + err := r.createDeployment(cr, common.GrafanaDeploymentName) if err != nil { return reconcile.Result{}, err } - return r.UpdatePhase(cr, PhaseDone) + return r.updatePhase(cr, PhaseDone) } // Creates the deployment from the template and injects any specified extra containers before // submitting it -func (r *ReconcileGrafana) CreateDeployment(cr *i8ly.Grafana, resourceName string) error { +func (r *ReconcileGrafana) createDeployment(cr *i8ly.Grafana, resourceName string) error { resourceHelper := newResourceHelper(cr) resource, err := resourceHelper.createResource(resourceName) if err != nil { @@ -335,11 +344,11 @@ func (r *ReconcileGrafana) CreateDeployment(cr *i8ly.Grafana, resourceName strin rawResource.access("spec").access("template").access("spec").set("containers", containers) } - return r.DeployResource(cr, resource, resourceName) + return r.deployResource(cr, resource, resourceName) } -func (r *ReconcileGrafana) CreateServiceAccount(cr *i8ly.Grafana, resourceName string) error { +func (r *ReconcileGrafana) createServiceAccount(cr *i8ly.Grafana, resourceName string) error { resourceHelper := newResourceHelper(cr) resource, err := resourceHelper.createResource(resourceName) @@ -349,7 +358,7 @@ func (r *ReconcileGrafana) CreateServiceAccount(cr *i8ly.Grafana, resourceName s // Deploy the unmodified resource if not on OpenShift if common.GetControllerConfig().GetConfigBool(common.ConfigOpenshift, false) == false { - return r.DeployResource(cr, resource, resourceName) + return r.deployResource(cr, resource, resourceName) } // Otherwise add an annotation that allows using the OAuthProxy (and will have no @@ -360,11 +369,11 @@ func (r *ReconcileGrafana) CreateServiceAccount(cr *i8ly.Grafana, resourceName s rawResource := newUnstructuredResourceMap(resource.(*unstructured.Unstructured)) rawResource.access("metadata").set("annotations", annotations) - return r.DeployResource(cr, resource, resourceName) + return r.deployResource(cr, resource, resourceName) } // Creates a generic kubernetes resource from a template -func (r *ReconcileGrafana) CreateResource(cr *i8ly.Grafana, resourceName string) error { +func (r *ReconcileGrafana) createResource(cr *i8ly.Grafana, resourceName string) error { resourceHelper := newResourceHelper(cr) resource, err := resourceHelper.createResource(resourceName) @@ -372,11 +381,11 @@ func (r *ReconcileGrafana) CreateResource(cr *i8ly.Grafana, resourceName string) return err } - return r.DeployResource(cr, resource, resourceName) + return r.deployResource(cr, resource, resourceName) } // Deploys a resource given by a runtime object -func (r *ReconcileGrafana) DeployResource(cr *i8ly.Grafana, resource runtime.Object, resourceName string) error { +func (r *ReconcileGrafana) deployResource(cr *i8ly.Grafana, resource runtime.Object, resourceName string) error { // Try to find the resource, it may already exist selector := types.NamespacedName{ Namespace: cr.Namespace, @@ -410,7 +419,7 @@ func (r *ReconcileGrafana) DeployResource(cr *i8ly.Grafana, resource runtime.Obj return nil } -func (r *ReconcileGrafana) UpdatePhase(cr *i8ly.Grafana, phase int) (reconcile.Result, error) { +func (r *ReconcileGrafana) updatePhase(cr *i8ly.Grafana, phase int) (reconcile.Result, error) { cr.Status.Phase = phase err := r.client.Update(context.TODO(), cr) return reconcile.Result{}, err diff --git a/version/version.go b/version/version.go index 56bc20cdb..5ab462930 100644 --- a/version/version.go +++ b/version/version.go @@ -1,5 +1,5 @@ package version var ( - Version = "1.2.0" + Version = "1.3.0" ) From a322ed76276f8caf35a0ed242f4f714dc05d5833 Mon Sep 17 00:00:00 2001 From: Peter Braun Date: Wed, 24 Jul 2019 17:55:06 +0200 Subject: [PATCH 5/5] change from Integreatly to Red Hat --- .../1.3.0/grafana-operator.v1.3.0.clusterserviceversion.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deploy/olm-catalog/grafana-operator/1.3.0/grafana-operator.v1.3.0.clusterserviceversion.yaml b/deploy/olm-catalog/grafana-operator/1.3.0/grafana-operator.v1.3.0.clusterserviceversion.yaml index 8def91a9c..dde1d8430 100644 --- a/deploy/olm-catalog/grafana-operator/1.3.0/grafana-operator.v1.3.0.clusterserviceversion.yaml +++ b/deploy/olm-catalog/grafana-operator/1.3.0/grafana-operator.v1.3.0.clusterserviceversion.yaml @@ -7,7 +7,7 @@ metadata: categories: "Monitoring" containerImage: quay.io/integreatly/grafana-operator:v1.3.0 createdAt: 2019-07-23T00:00:00Z - support: Integreatly + support: Red Hat certified: "False" repository: https://github.com/integr8ly/grafana-operator alm-examples: |- @@ -251,7 +251,7 @@ spec: - Monitoring maintainers: - email: integreatly@redhat.com - name: Integreatly + name: Red Hat maturity: alpha provider: name: Integreatly