From 7db892b16cf05da67875d93397c8c369ae3f1f2c Mon Sep 17 00:00:00 2001 From: Eric Sauer Date: Wed, 12 Aug 2020 08:53:36 -0400 Subject: [PATCH 1/6] Refactored exporter chart as a subchart of pelorus --- .../exporter/templates/deploymentconfig.yaml | 52 ------------------ charts/exporter/templates/imagestream.yaml | 7 --- charts/exporter/templates/route.yaml | 12 ---- charts/exporter/templates/service.yaml | 17 ------ charts/exporter/values.yaml | 10 ---- .../{ => pelorus/charts}/exporter/Chart.yaml | 0 .../exporter/templates/_buildconfig.yaml} | 19 ++++--- .../exporter/templates/_deploymentconfig.yaml | 55 +++++++++++++++++++ .../exporter/templates/_imagestream.yaml | 10 ++++ .../charts/exporter/templates/_route.yaml | 15 +++++ .../charts/exporter/templates/_service.yaml | 20 +++++++ .../charts/exporter/templates/exporters.yaml | 7 +++ .../charts}/exporter/templates/rbac.yaml | 8 +-- .../exporter/templates/servicemonitor.yaml | 0 charts/pelorus/charts/exporter/values.yaml | 10 ++++ charts/pelorus/values.yaml | 10 ++++ 16 files changed, 142 insertions(+), 110 deletions(-) delete mode 100644 charts/exporter/templates/deploymentconfig.yaml delete mode 100644 charts/exporter/templates/imagestream.yaml delete mode 100644 charts/exporter/templates/route.yaml delete mode 100644 charts/exporter/templates/service.yaml delete mode 100644 charts/exporter/values.yaml rename charts/{ => pelorus/charts}/exporter/Chart.yaml (100%) rename charts/{exporter/templates/buildconfig.yaml => pelorus/charts/exporter/templates/_buildconfig.yaml} (61%) create mode 100644 charts/pelorus/charts/exporter/templates/_deploymentconfig.yaml create mode 100644 charts/pelorus/charts/exporter/templates/_imagestream.yaml create mode 100644 charts/pelorus/charts/exporter/templates/_route.yaml create mode 100644 charts/pelorus/charts/exporter/templates/_service.yaml create mode 100644 charts/pelorus/charts/exporter/templates/exporters.yaml rename charts/{ => pelorus/charts}/exporter/templates/rbac.yaml (80%) rename charts/{ => pelorus/charts}/exporter/templates/servicemonitor.yaml (100%) create mode 100644 charts/pelorus/charts/exporter/values.yaml diff --git a/charts/exporter/templates/deploymentconfig.yaml b/charts/exporter/templates/deploymentconfig.yaml deleted file mode 100644 index d6a3123f0..000000000 --- a/charts/exporter/templates/deploymentconfig.yaml +++ /dev/null @@ -1,52 +0,0 @@ -apiVersion: apps.openshift.io/v1 -kind: DeploymentConfig -metadata: - labels: - app.kubernetes.io/name: {{ .Values.app_name }} - application: {{ .Values.app_name }} - name: {{ .Values.app_name }} -spec: - replicas: 1 - revisionHistoryLimit: 10 - selector: - app.kubernetes.io/name: {{ .Values.app_name }} - app: {{ .Values.app_name }} - deploymentconfig: {{ .Values.app_name }} - strategy: - type: Rolling - template: - metadata: - labels: - app.kubernetes.io/name: {{ .Values.app_name }} - app: {{ .Values.app_name }} - deploymentconfig: {{ .Values.app_name }} - application: {{ .Values.app_name}} - spec: - containers: - - name: {{ .Values.app_name }} - imagePullPolicy: Always - {{- if .Values.env_from_secrets }} - envFrom: - {{- range .Values.env_from_secrets }} - - secretRef: - name: {{ . }} - {{- end}} - {{- end}} - env: -{{- if .Values.extraEnv }} -{{ toYaml .Values.extraEnv | indent 8 }} -{{- end }} - ports: - - containerPort: 8080 - protocol: TCP - serviceAccount: pelorus-exporter - triggers: - - type: ConfigChange - - imageChangeParams: - automatic: true - containerNames: - - {{ .Values.app_name }} - from: - kind: ImageStreamTag - name: {{ .Values.app_name }}:latest - type: ImageChange diff --git a/charts/exporter/templates/imagestream.yaml b/charts/exporter/templates/imagestream.yaml deleted file mode 100644 index a59d2f8e8..000000000 --- a/charts/exporter/templates/imagestream.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: image.openshift.io/v1 -kind: ImageStream -metadata: - labels: - app.kubernetes.io/name: {{ .Values.app_name }} - app: {{ .Values.app_name }} - name: {{ .Values.app_name }} diff --git a/charts/exporter/templates/route.yaml b/charts/exporter/templates/route.yaml deleted file mode 100644 index 523e79ae7..000000000 --- a/charts/exporter/templates/route.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: route.openshift.io/v1 -kind: Route -metadata: - labels: - app.kubernetes.io/name: {{ .Values.app_name }} - name: {{ .Values.app_name }} -spec: - port: - targetPort: http - to: - kind: Service - name: {{ .Values.app_name }} diff --git a/charts/exporter/templates/service.yaml b/charts/exporter/templates/service.yaml deleted file mode 100644 index e3874b6b6..000000000 --- a/charts/exporter/templates/service.yaml +++ /dev/null @@ -1,17 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - labels: - app.kubernetes.io/name: {{ .Values.app_name }} - k8s-app: {{ .Values.app_name }} - name: {{ .Values.app_name }} -spec: - ports: - - name: http - port: 8080 - protocol: TCP - targetPort: 8080 - selector: - app.kubernetes.io/name: {{ .Values.app_name }} - deploymentconfig: {{ .Values.app_name }} - type: ClusterIP diff --git a/charts/exporter/values.yaml b/charts/exporter/values.yaml deleted file mode 100644 index b38f05cab..000000000 --- a/charts/exporter/values.yaml +++ /dev/null @@ -1,10 +0,0 @@ -app_name: deploytime-exporter -# env_from_secrets: -# - github-secret -# extraEnv: -# - name: APP_LABEL -# value: foo -source_context_dir: exporters/committime -source_ref: master -source_url: https://github.com/redhat-cop/pelorus.git -scrapeInterval: 5m \ No newline at end of file diff --git a/charts/exporter/Chart.yaml b/charts/pelorus/charts/exporter/Chart.yaml similarity index 100% rename from charts/exporter/Chart.yaml rename to charts/pelorus/charts/exporter/Chart.yaml diff --git a/charts/exporter/templates/buildconfig.yaml b/charts/pelorus/charts/exporter/templates/_buildconfig.yaml similarity index 61% rename from charts/exporter/templates/buildconfig.yaml rename to charts/pelorus/charts/exporter/templates/_buildconfig.yaml index da2b0adb1..b404fdb49 100644 --- a/charts/exporter/templates/buildconfig.yaml +++ b/charts/pelorus/charts/exporter/templates/_buildconfig.yaml @@ -1,22 +1,24 @@ +{{- define "exporters.buildconfig" }} +--- apiVersion: build.openshift.io/v1 kind: BuildConfig metadata: labels: - app: {{ .Values.app_name }} - app.kubernetes.io/name: {{ .Values.app_name }} - application: {{ .Values.app_name}} - name: {{ .Values.app_name }} + app: {{ .app_name }} + app.kubernetes.io/name: {{ .app_name }} + application: {{ .app_name}} + name: {{ .app_name }} spec: failedBuildsHistoryLimit: 5 output: to: kind: ImageStreamTag - name: {{ .Values.app_name }}:latest + name: {{ .app_name }}:latest source: - contextDir: {{ .Values.source_context_dir }} + contextDir: {{ .source_context_dir }} git: - ref: {{ .Values.source_ref }} - uri: {{ .Values.source_url }} + ref: {{ .source_ref }} + uri: {{ .source_url }} type: Git strategy: sourceStrategy: @@ -33,3 +35,4 @@ spec: type: GitHub - type: ConfigChange - type: ImageChange +{{- end }} \ No newline at end of file diff --git a/charts/pelorus/charts/exporter/templates/_deploymentconfig.yaml b/charts/pelorus/charts/exporter/templates/_deploymentconfig.yaml new file mode 100644 index 000000000..35acf51ff --- /dev/null +++ b/charts/pelorus/charts/exporter/templates/_deploymentconfig.yaml @@ -0,0 +1,55 @@ +{{- define "exporters.deploymentconfig" }} +--- +apiVersion: apps.openshift.io/v1 +kind: DeploymentConfig +metadata: + labels: + app.kubernetes.io/name: {{ .app_name }} + application: {{ .app_name }} + name: {{ .app_name }} +spec: + replicas: 1 + revisionHistoryLimit: 10 + selector: + app.kubernetes.io/name: {{ .app_name }} + app: {{ .app_name }} + deploymentconfig: {{ .app_name }} + strategy: + type: Rolling + template: + metadata: + labels: + app.kubernetes.io/name: {{ .app_name }} + app: {{ .app_name }} + deploymentconfig: {{ .app_name }} + application: {{ .app_name}} + spec: + containers: + - name: {{ .app_name }} + imagePullPolicy: Always + {{- if .env_from_secrets }} + envFrom: + {{- range .env_from_secrets }} + - secretRef: + name: {{ . }} + {{- end}} + {{- end}} + env: +{{- if .extraEnv }} +{{ toYaml .extraEnv | indent 8 }} +{{- end }} + ports: + - containerPort: 8080 + protocol: TCP + serviceAccount: pelorus-exporter + triggers: + - type: ConfigChange + - imageChangeParams: + automatic: true + containerNames: + - {{ .app_name }} + from: + kind: ImageStreamTag + name: {{ .app_name }}:latest + type: ImageChange +{{- end }} diff --git a/charts/pelorus/charts/exporter/templates/_imagestream.yaml b/charts/pelorus/charts/exporter/templates/_imagestream.yaml new file mode 100644 index 000000000..aafabfb3c --- /dev/null +++ b/charts/pelorus/charts/exporter/templates/_imagestream.yaml @@ -0,0 +1,10 @@ +{{- define "exporters.imagestream" }} +--- +apiVersion: image.openshift.io/v1 +kind: ImageStream +metadata: + labels: + app.kubernetes.io/name: {{ .app_name }} + app: {{ .app_name }} + name: {{ .app_name }} +{{- end }} diff --git a/charts/pelorus/charts/exporter/templates/_route.yaml b/charts/pelorus/charts/exporter/templates/_route.yaml new file mode 100644 index 000000000..6932bff28 --- /dev/null +++ b/charts/pelorus/charts/exporter/templates/_route.yaml @@ -0,0 +1,15 @@ +{{- define "exporters.route" }} +--- +apiVersion: route.openshift.io/v1 +kind: Route +metadata: + labels: + app.kubernetes.io/name: {{ .app_name }} + name: {{ .app_name }} +spec: + port: + targetPort: http + to: + kind: Service + name: {{ .app_name }} +{{- end }} diff --git a/charts/pelorus/charts/exporter/templates/_service.yaml b/charts/pelorus/charts/exporter/templates/_service.yaml new file mode 100644 index 000000000..3eb8973be --- /dev/null +++ b/charts/pelorus/charts/exporter/templates/_service.yaml @@ -0,0 +1,20 @@ +{{- define "exporters.service" }} +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app.kubernetes.io/name: {{ .app_name }} + k8s-app: {{ .app_name }} + name: {{ .app_name }} +spec: + ports: + - name: http + port: 8080 + protocol: TCP + targetPort: 8080 + selector: + app.kubernetes.io/name: {{ .app_name }} + deploymentconfig: {{ .app_name }} + type: ClusterIP +{{- end }} diff --git a/charts/pelorus/charts/exporter/templates/exporters.yaml b/charts/pelorus/charts/exporter/templates/exporters.yaml new file mode 100644 index 000000000..fb518e1ee --- /dev/null +++ b/charts/pelorus/charts/exporter/templates/exporters.yaml @@ -0,0 +1,7 @@ +{{- range $index, $exporter := .Values.instances }} + {{ include "exporters.buildconfig" $exporter }} + {{ include "exporters.deploymentconfig" $exporter }} + {{ include "exporters.imagestream" $exporter }} + {{ include "exporters.route" $exporter }} + {{ include "exporters.service" $exporter }} +{{- end }} \ No newline at end of file diff --git a/charts/exporter/templates/rbac.yaml b/charts/pelorus/charts/exporter/templates/rbac.yaml similarity index 80% rename from charts/exporter/templates/rbac.yaml rename to charts/pelorus/charts/exporter/templates/rbac.yaml index 368955998..8b7e9d2bd 100644 --- a/charts/exporter/templates/rbac.yaml +++ b/charts/pelorus/charts/exporter/templates/rbac.yaml @@ -9,9 +9,9 @@ kind: ClusterRole metadata: labels: app.kubernetes.io/component: pelorus-exporters - app.kubernetes.io/name: {{ .Values.app_name }} + app.kubernetes.io/name: {{ .Release.Name }} app.kubernetes.io/version: v1.1 - name: pelorus-exporter + name: pelorus-exporter-{{ .Release.Namespace }} rules: - apiGroups: - "" @@ -32,9 +32,9 @@ kind: ClusterRoleBinding metadata: labels: app.kubernetes.io/component: pelorus-exporters - app.kubernetes.io/name: exporters + app.kubernetes.io/name: {{ .Release.Name }} app.kubernetes.io/version: v1.2 - name: {{ .Release.Namespace }}-pelorus-exporter + name: pelorus-exporter-{{ .Release.Namespace }} roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole diff --git a/charts/exporter/templates/servicemonitor.yaml b/charts/pelorus/charts/exporter/templates/servicemonitor.yaml similarity index 100% rename from charts/exporter/templates/servicemonitor.yaml rename to charts/pelorus/charts/exporter/templates/servicemonitor.yaml diff --git a/charts/pelorus/charts/exporter/values.yaml b/charts/pelorus/charts/exporter/values.yaml new file mode 100644 index 000000000..66dc70145 --- /dev/null +++ b/charts/pelorus/charts/exporter/values.yaml @@ -0,0 +1,10 @@ +instances: +- app_name: deploytime-exporter + extraEnv: + - name: LOG_LEVEL + value: INFO + source_context_dir: exporters/committime + source_ref: master + source_url: https://github.com/redhat-cop/pelorus.git + +scrapeInterval: 5m \ No newline at end of file diff --git a/charts/pelorus/values.yaml b/charts/pelorus/values.yaml index 50a428ca4..5bda02398 100644 --- a/charts/pelorus/values.yaml +++ b/charts/pelorus/values.yaml @@ -15,3 +15,13 @@ deployment: app.kubernetes.io/component: prometheus app.kubernetes.io/name: pelorus app.kubernetes.io/version: v0.33.0 + +exporters: + instances: + - app_name: deploytime-exporter + extraEnv: + - name: LOG_LEVEL + value: INFO + source_context_dir: exporters/committime + source_ref: master + source_url: https://github.com/redhat-cop/pelorus.git From 31bf5aaaa6d357b8146672aeb0ad33366961c440 Mon Sep 17 00:00:00 2001 From: Eric Sauer Date: Wed, 12 Aug 2020 11:57:52 -0400 Subject: [PATCH 2/6] Add documentation for new exporter configuration --- docs/Configuration.md | 92 ++++++++++++++++++++++++++++++++----------- docs/Install.md | 34 ++++++++-------- 2 files changed, 87 insertions(+), 39 deletions(-) diff --git a/docs/Configuration.md b/docs/Configuration.md index 7b824b06b..6d3d4fe63 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -5,25 +5,71 @@ The Pelorus stack (Prometheus, Grafana, Thanos, etc.) can be configured by changing the `values.yaml` file that is passed to helm. The recommended practice is to make a copy of the one [provided in this repo](/charts/)deploy/values.yaml), and store in in your own configuration repo for safe keeping, and updating. Once established, you can make configuration changes by updating your `values.yaml` and applying the changes like so: ``` -helm upgrade pelorus charts/deploy --namespace pelorus -v myclusterconfigs/pelorus/values.yaml +helm upgrade pelorus charts/deploy --namespace pelorus --values myclusterconfigs/pelorus/values.yaml ``` The following configurations may be made through the `values.yaml` file: | Variable | Required | Explanation | Default Value | |---|---|---|---| +| `openshift_prometheus_htpasswd_auth` | yes | The contents for the htpasswd file that Prometheus will use for basic authentication user. | User: `internal`, Password: `changeme` | +| `openshift_prometheus_basic_auth_pass` | yes | The password that grafana will use for its Prometheus datasource. Must match the above. | `changme` | | `custom_ca` | no | Whether or not the cluster serves custom signed certificates for ingress (e.g. router certs). If `true` we will load the custom via the [certificate injection method](https://docs.openshift.com/container-platform/4.4/networking/configuring-a-custom-pki.html#certificate-injection-using-operators_configuring-a-custom-pki) | `false` | | `extra_prometheus_hosts` | no | Configures additional prometheus instances for a multi-cluster setup. See [Deploying across multple clusters](/docs/Install.md#deploying-across-multiple-clusters) for details. | Nil | +| `exporters` | no | Specified which exporters to install. See [Configuring Exporters](#configuring-exporters). | Installs deploytime exporter only. | ## Configuring Exporters - + +An _exporter_ is a data collection application that pulls data from various tools and platforms and exposes it such that it can be consumed by Pelorus dashboards. Each exporter gets deployed individually alongside the core Pelorus stack. + +Exporters can be deployed and configured via the `exporters.instances` list of a `values.yaml` file. Some exporters also require secrets to be created when integrating with external tools and platforms. A sample exporter configuration may look like this: + +``` +exporters: + instances: + - app_name: deploytime-exporter + extraEnv: + - name: LOG_LEVEL + value: INFO + source_context_dir: exporters/committime + source_ref: master + source_url: https://github.com/redhat-cop/pelorus.git +``` + +Deploying additional exporters can be done by adding to the `exporters.instances` list. In some cases, you may want to deploy a single exporter multiple times to gather data from different sources. For example, if you wanted to pull commit data from both GitHub and a private GitHub Enterprise instance, you would deploy two instances of the Commit Time Exporter like so: + +``` +exporters: + instances: + - app_name: committime-github + env_from_secrets: + - github-credentials + source_context_dir: exporters/ + extraEnv: + - name: APP_FILE + value: committime/app.py + source_ref: master + source_url: https://github.com/redhat-cop/pelorus.git + - app_name: committime-gh-enterprise + env_from_secrets: + - github-enterprise-credentials + source_context_dir: exporters/ + extraEnv: + - name: APP_FILE + value: committime/app.py + source_ref: master + source_url: https://github.com/redhat-cop/pelorus.git +``` + +Each exporter additionally takes a unique set of environment variables to further configure its integrations and behavior. Each of those environment variables can be set either by placing the literal keys and values under `extraEnv` or by creating a kubernetes secre with literal values and listing the secret name under `env_from_secrets`. Those configurations are detailed below. + ### Commit Time Exporter The job of the commit time exporter is to find relevant builds in OpenShift and associate a commit from the build's source code repository with a container image built from that commit. We capture a timestamp for the commit, and the resulting image hash, so that the Deploy Time Exporter can later associate that image with a production deployment. In order for proper collection, we require that all builds associated with a particular application be labelled with the same `app.kubernetes.io/name=` label. -#### Deploying to OpenShift +#### Suggested Secrets Create a secret containing your GitHub token. @@ -33,16 +79,29 @@ Create a secret containing your GitHub token and GitHub Enterprise API. An API oc create secret generic github-secret --from-literal=GITHUB_USER= --from-literal=GITHUB_TOKEN= --from-literal=GITHUB_API= -n pelorus -Then deploy the chart. +#### Sample Values - helm template charts/exporter/ -f exporters/committime/values.yaml --namespace pelorus | oc apply -f- -n pelorus +``` +exporters: + instances: + - app_name: committime-exporter + env_from_secrets: + - github-secret + source_context_dir: exporters/ + extraEnv: + - name: APP_FILE + value: committime/app.py + source_ref: master + source_url: https://github.com/redhat-cop/pelorus.git +``` -#### Configuration +#### Environment Variables This exporter supports several configuration options, passed via environment variables | Variable | Required | Explanation | Default Value | |---|---|---|---| +| `LOG_LEVEL` | no | Set the log level. One of `DEBUG`, `INFO`, `WARNING`, `ERROR` | `INFO` | | `APP_LABEL` | no | Changes the label key used to identify applications | `app.kubernetes.io/name` | | `NAMESPACES` | no | Restricts the set of namespaces from which metrics will be collected. ex: `myapp-ns-dev,otherapp-ci` | unset; scans all namespaces | | `GITHUB_USER` | yes | User's github username | unset | @@ -56,18 +115,13 @@ The job of the deploy time exporter is to capture the timestamp at which a deplo In order for proper collection, we require that all deployments associated with a particular application be labelled with the same `app.kubernetes.io/name=` label. -#### Deploying to OpenShift - -Deploying to OpenShift is done via the exporter chart. - - helm template charts/exporter/ -f exporters/deploytime/values.yaml --namespace pelorus | oc apply -f- -n pelorus - -#### Configuration +#### Environment Variables This exporter supports several configuration options, passed via environment variables | Variable | Required | Explanation | Default Value | |---|---|---|---| +| `LOG_LEVEL` | no | Set the log level. One of `DEBUG`, `INFO`, `WARNING`, `ERROR` | `INFO` | | `APP_LABEL` | no | Changes the label key used to identify applications | `app.kubernetes.io/name` | | `PROD_LABEL` | no | Changes the label key used to identify namespaces that are considered production environments. | unset; matches all namespaces | | `NAMESPACES` | no | Restricts the set of namespaces from which metrics will be collected. ex: `myapp-ns-dev,otherapp-ci` | unset; scans all namespaces | @@ -76,7 +130,7 @@ This exporter supports several configuration options, passed via environment var The job of the deploy time exporter is to capture the timestamp at which a failure occurs in a production environment and when it is resolved. -#### Deploying to OpenShift +#### Suggeste Secrets Create a secret containing your Jira information. @@ -87,19 +141,13 @@ Create a secret containing your Jira information. --from-literal=PROJECT= \ -n pelorus - -Deploying to OpenShift is done via the failure exporter Helm chart. - -**_NOTE:_** Be sure to update the appropiate values if `values.yaml` if necessary. - - helm template charts/exporter/ -f exporters/failure/values.yaml --namespace pelorus | oc apply -f- -n pelorus - -#### Configuration +#### Environment Variables This exporter supports several configuration options, passed via environment variables | Variable | Required | Explanation | Default Value | |---|---|---|---| +| `LOG_LEVEL` | no | Set the log level. One of `DEBUG`, `INFO`, `WARNING`, `ERROR` | `INFO` | | `SERVER` | yes | URL to the Jira Server | unset | | `PROJECT` | yes | Jira project to scan | unset | | `USER` | yes | Jira Username | unset | diff --git a/docs/Install.md b/docs/Install.md index 26f2bd13a..a8c9cbd59 100644 --- a/docs/Install.md +++ b/docs/Install.md @@ -22,33 +22,33 @@ Additionally, if you are planning to use the out of the box exporters to collect Pelorus gets installed via helm charts. The first deploys the operators on which Pelorus depends, the second deploys the core Pelorus stack and the third deploys the exporters that gather the data. By default, the below instructions install into a namespace called `pelorus`, but you can choose any name you wish. -1. Deploy the Pelorus stack + oc create namespace pelorus + helm install operators charts/operators --namespace pelorus + helm install pelorus charts/pelorus --namespace pelorus - oc create namespace pelorus - helm install operators charts/operators --namespace pelorus - helm install pelorus charts/pelorus --namespace pelorus +In a few seconds, you will see a number of resourced get created. The above commands will result in the following being deployed: - In a few seconds, you will see a number of resourced get created. -2. Create the exporter secrets - 1. For Github +* Prometheus and Grafana operators +* The core Pelorus stack, which includes: + * A `Prometheus` instance + * A `Grafana` instance + * A `ServiceMonitor` instance for scraping the Pelorus exporters. + * A `GrafanaDatasource` pointing to Prometheus. + * A set of `GrafanaDashboards`. See the [dashboards documentation](/docs/Dashboards.md) for more details. +* The following exporters: + * Deploy Time - oc create secret generic github-secret --from-literal=GITHUB_USER= --from-literal=GITHUB_TOKEN= -n pelorus - 2. For Jira - - oc create secret generic jira-secret --from-literal=SERVER= --from-literal=USER= --from-literal=TOKEN= --from-literal=PROJECT= -n pelorus -3. Deploy Exporters - - helm template charts/exporter/ -f exporters/committime/values.yaml --namespace pelorus | oc apply -f- -n pelorus - helm template charts/exporter/ -f exporters/deploytime/values.yaml --namespace pelorus | oc apply -f- -n pelorus - helm template charts/exporter/ -f exporters/failure/values.yaml --namespace pelorus | oc apply -f- -n pelorus +From here, some additional configuration is required in order to deploy other exporters, and make the Pelorus See the [Configuration Guide](/docs/Configuration.md) for more information on exporters. +You may additionally want to enabled other features for the core stack. Read on to understand those options. + ## Customizing Pelorus See [Configuring the Pelorus Stack](/docs/Configuration.md) for a full readout of all possible configuration items. The following sections describe the most common supported customizations that can be made to a Pelorus deployment. -### Configure Long Term Storage +### Configure Long Term Storage (Recommended) The Pelorus chart supports deploying a thanos instance for long term storage. It can use any S3 bucket provider. The following is an example of configuring a values.yaml file for noobaa with the local s3 service name: From 4c285d12ee7ef5efe514a7ba88900da51316c54f Mon Sep 17 00:00:00 2001 From: Eric Sauer Date: Wed, 12 Aug 2020 12:05:39 -0400 Subject: [PATCH 3/6] Bump chart version --- charts/pelorus/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/pelorus/Chart.yaml b/charts/pelorus/Chart.yaml index 530afa1a2..688ed5930 100644 --- a/charts/pelorus/Chart.yaml +++ b/charts/pelorus/Chart.yaml @@ -14,7 +14,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. -version: v1.2.1 +version: v1.2.1-rc-2-g31bf5aa # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. From 88186388c55d537ddbffdbbb86c965951629f8f0 Mon Sep 17 00:00:00 2001 From: Eric Sauer Date: Wed, 12 Aug 2020 15:42:10 -0400 Subject: [PATCH 4/6] Remove exporter chart from tests --- _test/conftest.sh | 11 ----------- charts/pelorus/Chart.yaml | 2 +- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/_test/conftest.sh b/_test/conftest.sh index bd4737f2c..aee84e034 100755 --- a/_test/conftest.sh +++ b/_test/conftest.sh @@ -31,17 +31,6 @@ setup_file() { [ "$status" -eq 0 ] } -@test "charts/exporter" { - tmp=$(helm_template "charts/exporter") - - namespaces=$(get_rego_namespaces "ocp\.deprecated\.*") - cmd="conftest test ${tmp} --output tap ${namespaces}" - run ${cmd} - - print_info "${status}" "${output}" "${cmd}" "${tmp}" - [ "$status" -eq 0 ] -} - @test "storage/minio-scc.yaml" { tmp=$(split_files "storage/minio-scc.yaml") diff --git a/charts/pelorus/Chart.yaml b/charts/pelorus/Chart.yaml index 688ed5930..12c789a73 100644 --- a/charts/pelorus/Chart.yaml +++ b/charts/pelorus/Chart.yaml @@ -14,7 +14,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. -version: v1.2.1-rc-2-g31bf5aa +version: v1.2.1-rc-3-g4c285d1 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. From 740e64e6b44af0394ad675d08e8bae41e6c994aa Mon Sep 17 00:00:00 2001 From: Eric Sauer Date: Wed, 12 Aug 2020 16:45:59 -0400 Subject: [PATCH 5/6] Fix chart name and values file --- charts/pelorus/charts/{exporter => exporters}/Chart.yaml | 2 +- .../{exporter => exporters}/templates/_buildconfig.yaml | 0 .../templates/_deploymentconfig.yaml | 0 .../{exporter => exporters}/templates/_imagestream.yaml | 0 .../charts/{exporter => exporters}/templates/_route.yaml | 0 .../charts/{exporter => exporters}/templates/_service.yaml | 0 .../{exporter => exporters}/templates/exporters.yaml | 0 .../charts/{exporter => exporters}/templates/rbac.yaml | 0 .../{exporter => exporters}/templates/servicemonitor.yaml | 0 charts/pelorus/charts/{exporter => exporters}/values.yaml | 5 +---- charts/pelorus/values.yaml | 7 ++++--- docs/Configuration.md | 7 ++++--- 12 files changed, 10 insertions(+), 11 deletions(-) rename charts/pelorus/charts/{exporter => exporters}/Chart.yaml (65%) rename charts/pelorus/charts/{exporter => exporters}/templates/_buildconfig.yaml (100%) rename charts/pelorus/charts/{exporter => exporters}/templates/_deploymentconfig.yaml (100%) rename charts/pelorus/charts/{exporter => exporters}/templates/_imagestream.yaml (100%) rename charts/pelorus/charts/{exporter => exporters}/templates/_route.yaml (100%) rename charts/pelorus/charts/{exporter => exporters}/templates/_service.yaml (100%) rename charts/pelorus/charts/{exporter => exporters}/templates/exporters.yaml (100%) rename charts/pelorus/charts/{exporter => exporters}/templates/rbac.yaml (100%) rename charts/pelorus/charts/{exporter => exporters}/templates/servicemonitor.yaml (100%) rename charts/pelorus/charts/{exporter => exporters}/values.yaml (60%) diff --git a/charts/pelorus/charts/exporter/Chart.yaml b/charts/pelorus/charts/exporters/Chart.yaml similarity index 65% rename from charts/pelorus/charts/exporter/Chart.yaml rename to charts/pelorus/charts/exporters/Chart.yaml index dcdff55cf..d123fa7c2 100644 --- a/charts/pelorus/charts/exporter/Chart.yaml +++ b/charts/pelorus/charts/exporters/Chart.yaml @@ -1,3 +1,3 @@ -name: exporter +name: exporters version: v1.1.0 apiVersion: v2 \ No newline at end of file diff --git a/charts/pelorus/charts/exporter/templates/_buildconfig.yaml b/charts/pelorus/charts/exporters/templates/_buildconfig.yaml similarity index 100% rename from charts/pelorus/charts/exporter/templates/_buildconfig.yaml rename to charts/pelorus/charts/exporters/templates/_buildconfig.yaml diff --git a/charts/pelorus/charts/exporter/templates/_deploymentconfig.yaml b/charts/pelorus/charts/exporters/templates/_deploymentconfig.yaml similarity index 100% rename from charts/pelorus/charts/exporter/templates/_deploymentconfig.yaml rename to charts/pelorus/charts/exporters/templates/_deploymentconfig.yaml diff --git a/charts/pelorus/charts/exporter/templates/_imagestream.yaml b/charts/pelorus/charts/exporters/templates/_imagestream.yaml similarity index 100% rename from charts/pelorus/charts/exporter/templates/_imagestream.yaml rename to charts/pelorus/charts/exporters/templates/_imagestream.yaml diff --git a/charts/pelorus/charts/exporter/templates/_route.yaml b/charts/pelorus/charts/exporters/templates/_route.yaml similarity index 100% rename from charts/pelorus/charts/exporter/templates/_route.yaml rename to charts/pelorus/charts/exporters/templates/_route.yaml diff --git a/charts/pelorus/charts/exporter/templates/_service.yaml b/charts/pelorus/charts/exporters/templates/_service.yaml similarity index 100% rename from charts/pelorus/charts/exporter/templates/_service.yaml rename to charts/pelorus/charts/exporters/templates/_service.yaml diff --git a/charts/pelorus/charts/exporter/templates/exporters.yaml b/charts/pelorus/charts/exporters/templates/exporters.yaml similarity index 100% rename from charts/pelorus/charts/exporter/templates/exporters.yaml rename to charts/pelorus/charts/exporters/templates/exporters.yaml diff --git a/charts/pelorus/charts/exporter/templates/rbac.yaml b/charts/pelorus/charts/exporters/templates/rbac.yaml similarity index 100% rename from charts/pelorus/charts/exporter/templates/rbac.yaml rename to charts/pelorus/charts/exporters/templates/rbac.yaml diff --git a/charts/pelorus/charts/exporter/templates/servicemonitor.yaml b/charts/pelorus/charts/exporters/templates/servicemonitor.yaml similarity index 100% rename from charts/pelorus/charts/exporter/templates/servicemonitor.yaml rename to charts/pelorus/charts/exporters/templates/servicemonitor.yaml diff --git a/charts/pelorus/charts/exporter/values.yaml b/charts/pelorus/charts/exporters/values.yaml similarity index 60% rename from charts/pelorus/charts/exporter/values.yaml rename to charts/pelorus/charts/exporters/values.yaml index 66dc70145..4cf44074b 100644 --- a/charts/pelorus/charts/exporter/values.yaml +++ b/charts/pelorus/charts/exporters/values.yaml @@ -1,9 +1,6 @@ instances: - app_name: deploytime-exporter - extraEnv: - - name: LOG_LEVEL - value: INFO - source_context_dir: exporters/committime + source_context_dir: exporters/ source_ref: master source_url: https://github.com/redhat-cop/pelorus.git diff --git a/charts/pelorus/values.yaml b/charts/pelorus/values.yaml index 5bda02398..92e645e00 100644 --- a/charts/pelorus/values.yaml +++ b/charts/pelorus/values.yaml @@ -18,10 +18,11 @@ deployment: exporters: instances: + # Values file for exporter helm chart - app_name: deploytime-exporter + source_context_dir: exporters/ extraEnv: - - name: LOG_LEVEL - value: INFO - source_context_dir: exporters/committime + - name: APP_FILE + value: deploytime/app.py source_ref: master source_url: https://github.com/redhat-cop/pelorus.git diff --git a/docs/Configuration.md b/docs/Configuration.md index 6d3d4fe63..fe590cb73 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -27,11 +27,12 @@ Exporters can be deployed and configured via the `exporters.instances` list of a ``` exporters: instances: + # Values file for exporter helm chart - app_name: deploytime-exporter + source_context_dir: exporters/ extraEnv: - - name: LOG_LEVEL - value: INFO - source_context_dir: exporters/committime + - name: APP_FILE + value: deploytime/app.py source_ref: master source_url: https://github.com/redhat-cop/pelorus.git ``` From a570c3a312ad17feb2bcb42a70551be537730fd1 Mon Sep 17 00:00:00 2001 From: Eric Sauer Date: Thu, 13 Aug 2020 10:29:19 -0400 Subject: [PATCH 6/6] update developer docs for the new charts --- docs/Development.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/Development.md b/docs/Development.md index d0feec588..be79d663d 100644 --- a/docs/Development.md +++ b/docs/Development.md @@ -22,13 +22,17 @@ See the [Install guide](/docs/Install.md) for more details on that. Currently we have two charts: -1. The [deploy](/charts/deploy/) chart managed the core stack, which includes: - * Prometheus Operator +1. The [operators](/charts/operators/) chart installs the community operators on which Pelorus depends. + * [Prometheus Operator](https://operatorhub.io/operator/prometheus) + * [Grafana Operator](https://operatorhub.io/operator/grafana-operator) +2. The [pelorus](charts/pelorus/) chart manages the Pelorus stack, which includes: * Prometheus * Thanos - * Grafana Operator * Grafana -2. The [exporter](/charts/exporter) chart handles all exporter deployments. Which exporter gets deployed is determined by the `values.yaml` file passed in. + * A set of Grafana Dashboards and Datasources + * The Pelorus exporters, managed in an [exporter](/charts/exporter) subchart. + +We use Helm's [chart-testing](https://github.com/helm/chart-testing) to ensure quality and consistency in the chart. When making updates to one of the charts, ensure that the chart still passes lint testing using `helm lint`. The most common linting failure is forgetting to bump the `version` field in the `Chart.yaml`. When updating the version, use the output of `git describe` to keep the versioning in line with the repo. ## Dashboard Development