[stable/prometheus-operator] Introduce crds directory for compatibility with Helm v3 (#18721)

* Introduce crds directory for compatibility with Helm v3

- This adds `crds` directory which has all 5 CRDs
- As files from crds directory needs to be plain YAMLs, keeps
  app: prometheus-operator label and removes all the templating
- With this change `.Values.prometheusOperator.createCustomResource`
  will be ignored by Helm v3 as it handles the CRDs differently. Which
  means, if the CRDs already present in the cluster then it won't
  touch them at all
- Helm v3 ignores the objects from `templates` directory which have a
  `crd-install` hook
- Update the README.md
- Update the chart version

Signed-off-by: Bhavin Gandhi <bhavin7392@gmail.com>

* Use files from crds directory to generate CRDs for Helm v2

- Deletes the templates/prometheus-operator/crd-*.yaml
- Adds templates/prometheus-operator/crds.yaml which generates YAMLs
  for CRDs. The hooks from these CRDs are detected by Helm v2 as well
  as v3. Helm v2 executes the hook and Helm v3 ignores the hook (YAML
  files are not applied)

Signed-off-by: Bhavin Gandhi <bhavin7392@gmail.com>
This commit is contained in:
Bhavin Gandhi
2019-11-13 09:57:31 -08:00
committed by Kubernetes Prow Robot
parent 60bf40eb84
commit 89b233eef6
8 changed files with 14 additions and 23 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ sources:
- https://github.com/coreos/kube-prometheus
- https://github.com/coreos/prometheus-operator
- https://coreos.com/operators/prometheus
version: 8.1.8
version: 8.2.0
appVersion: 0.34.0
tillerVersion: ">=2.12.0"
home: https://github.com/coreos/prometheus-operator
+2 -2
View File
@@ -183,7 +183,7 @@ The following tables list the configurable parameters of the prometheus-operator
| `prometheusOperator.configReloaderMemory` | Set the prometheus config reloader side-car memory limit. If unset, uses the prometheus-operator project default | `nil` |
| `prometheusOperator.configmapReloadImage.repository` | Repository for configmapReload image | `quay.io/coreos/configmap-reload` |
| `prometheusOperator.configmapReloadImage.tag` | Tag for configmapReload image | `v0.0.1` |
| `prometheusOperator.createCustomResource` | Create CRDs. Required if deploying anything besides the operator itself as part of the release. The operator will create / update these on startup. If your Helm version < 2.10 you will have to either create the CRDs first or deploy the operator first, then the rest of the resources | `true` |
| `prometheusOperator.createCustomResource` | Create CRDs. Required if deploying anything besides the operator itself as part of the release. The operator will create / update these on startup. If your Helm version < 2.10 you will have to either create the CRDs first or deploy the operator first, then the rest of the resources. Regardless of value of this, Helm v3+ will install the CRDs if those are not present already. Use `--skip-crds` with `helm install` if you want to skip CRD creation | `true` |
| `prometheusOperator.namespaces` | Namespaces to scope the interaction of the Prometheus Operator and the apiserver (allow list). This is mutually exclusive with `denyNamespaces`. Setting this to an empty object will disable the configuration | `{}` |
| `prometheusOperator.namespaces.releaseNamespace` | Include the release namespace | `false` |
| `prometheusOperator.namespaces.additional` | Include additional namespaces besides the release namespace | `[]` |
@@ -586,7 +586,7 @@ These components are loaded as dependencies into the chart. The source for both
The Grafana chart is more feature-rich than this chart - it contains a sidecar that is able to load data sources and dashboards from configmaps deployed into the same cluster. For more information check out the [documentation for the chart](https://github.com/helm/charts/tree/master/stable/grafana)
### Coreos CRDs
The CRDs are provisioned using crd-install hooks, rather than relying on a separate chart installation. If you already have these CRDs provisioned and don't want to remove them, you can disable the CRD creation by these hooks by passing `prometheusOperator.createCustomResource=false`
The CRDs are provisioned using crd-install hooks, rather than relying on a separate chart installation. If you already have these CRDs provisioned and don't want to remove them, you can disable the CRD creation by these hooks by passing `prometheusOperator.createCustomResource=false` (not required if using Helm v3).
### Kubelet Service
Because the kubelet service has a new name in the chart, make sure to clean up the old kubelet service in the `kube-system` namespace to prevent counting container metrics twice.
@@ -1,4 +1,3 @@
{{- if and .Values.prometheusOperator.enabled .Values.prometheusOperator.createCustomResource -}}
# Source https://raw.githubusercontent.com/coreos/kube-prometheus/master/manifests/0prometheus-operator-0alertmanagerCustomResourceDefinition.yaml
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
@@ -6,8 +5,7 @@ metadata:
creationTimestamp: null
name: alertmanagers.monitoring.coreos.com
labels:
app: {{ template "prometheus-operator.name" . }}-operator
{{ include "prometheus-operator.labels" . | indent 4 }}
app: prometheus-operator
annotations:
"helm.sh/hook": crd-install
spec:
@@ -2400,4 +2398,3 @@ spec:
- availableReplicas
- unavailableReplicas
version: v1
{{- end }}
@@ -1,4 +1,3 @@
{{- if and .Values.prometheusOperator.enabled .Values.prometheusOperator.createCustomResource -}}
# Source https://raw.githubusercontent.com/coreos/kube-prometheus/master/manifests/0prometheus-operator-0podmonitorCustomResourceDefinition.yaml
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
@@ -6,8 +5,7 @@ metadata:
creationTimestamp: null
name: podmonitors.monitoring.coreos.com
labels:
app: {{ template "prometheus-operator.name" . }}-operator
{{ include "prometheus-operator.labels" . | indent 4 }}
app: prometheus-operator
annotations:
"helm.sh/hook": crd-install
spec:
@@ -240,4 +238,3 @@ spec:
type: object
type: object
version: v1
{{- end }}
@@ -1,4 +1,3 @@
{{- if and .Values.prometheusOperator.enabled .Values.prometheusOperator.createCustomResource -}}
# Source https://raw.githubusercontent.com/coreos/kube-prometheus/master/manifests/0prometheus-operator-0prometheusCustomResourceDefinition.yaml
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
@@ -6,8 +5,7 @@ metadata:
creationTimestamp: null
name: prometheuses.monitoring.coreos.com
labels:
app: {{ template "prometheus-operator.name" . }}-operator
{{ include "prometheus-operator.labels" . | indent 4 }}
app: prometheus-operator
annotations:
"helm.sh/hook": crd-install
spec:
@@ -3451,4 +3449,3 @@ spec:
type: object
type: object
version: v1
{{- end }}
@@ -1,4 +1,3 @@
{{- if and .Values.prometheusOperator.enabled .Values.prometheusOperator.createCustomResource -}}
# Source https://raw.githubusercontent.com/coreos/kube-prometheus/master/manifests/0prometheus-operator-0prometheusruleCustomResourceDefinition.yaml
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
@@ -6,8 +5,7 @@ metadata:
creationTimestamp: null
name: prometheusrules.monitoring.coreos.com
labels:
app: {{ template "prometheus-operator.name" . }}-operator
{{ include "prometheus-operator.labels" . | indent 4 }}
app: prometheus-operator
annotations:
"helm.sh/hook": crd-install
spec:
@@ -397,4 +395,3 @@ spec:
type: object
type: object
version: v1
{{- end }}
@@ -1,4 +1,3 @@
{{- if and .Values.prometheusOperator.enabled .Values.prometheusOperator.createCustomResource -}}
# Source: https://raw.githubusercontent.com/coreos/kube-prometheus/master/manifests/0prometheus-operator-0servicemonitorCustomResourceDefinition.yaml
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
@@ -6,8 +5,7 @@ metadata:
creationTimestamp: null
name: servicemonitors.monitoring.coreos.com
labels:
app: {{ template "prometheus-operator.name" . }}-operator
{{ include "prometheus-operator.labels" . | indent 4 }}
app: prometheus-operator
annotations:
"helm.sh/hook": crd-install
spec:
@@ -308,4 +306,3 @@ spec:
type: object
type: object
version: v1
{{- end }}
@@ -0,0 +1,6 @@
{{- if and .Values.prometheusOperator.enabled .Values.prometheusOperator.createCustomResource -}}
{{- range $path, $bytes := .Files.Glob "crds/*.yaml" }}
{{ $.Files.Get $path }}
---
{{- end }}
{{- end }}