Commit 2f5a830e by Guangbo Chen Committed by Alena Prokharchyk

Add prometheus operator-init for CRDs configs

parent d8268a56
apiVersion: v1
name: operator-init
version: 0.1.0
appVersion: 0.1.0
tillerVersion: ">=2.7.2-0"
description: Helm chart to initialize Prometheus Operator CRDs
keywords:
- prometheus-operator
- crd
maintainers:
- name: support
email: support@rancher.com
engine: gotpl
# operator-init
## Introduction
This chart bootstraps prometheus-operator's [CRDs](https://github.com/helm/charts/tree/master/stable/prometheus-operator/templates/prometheus-operator)
which are an internal implementation detail of prometheus-operator. CRDs define data structures for storing runtime configuration
specified by a human operator.
This chart must be run to completion prior to running other Prometheus Operator charts, or other prometheus-operator charts will fail to initialize.
## Prerequisites
- Kubernetes 1.9 or newer cluster with RBAC (Role-Based Access Control) enabled is required
- Helm 2.7.2 or newer or alternately the ability to modify RBAC rules is also required
## Resources Required
The chart deploys pods that consume minimal resources.
## Uninstalling the Chart
> Warning: Deleting CRDs will delete any configuration that you have made to prometheus-operator.
To delete all CRDs, run the following command
```
kubectl delete -f files/.
```
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
apiVersion: v1
kind: ConfigMap
metadata:
namespace: {{ .Release.Namespace }}
name: {{ template "app.fullname" . }}
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
data:
{{ (.Files.Glob "files/crd-*.yaml").AsConfig | indent 2 }}
apiVersion: batch/v1
kind: Job
metadata:
name: {{ template "app.fullname" . }}
namespace: {{ .Release.Namespace }}
annotations:
"helm.sh/hook": post-install
"helm.sh/hook-delete-policy": hook-succeeded
spec:
ttlSecondsAfterFinished: 100
backoffLimit: 3
template:
spec:
serviceAccountName: {{ template "app.fullname" . }}
containers:
- name: operator-init-crds
image: {{ template "system_default_registry" . }}{{ .Values.image.repository }}:{{ .Values.image.tag }}
volumeMounts:
- name: data-crds
mountPath: /etc/operator-init
readOnly: true
command: ["kubectl", "apply", "-f", "/etc/operator-init/."]
volumes:
- name: data-crds
configMap:
name: {{ template "app.fullname" . }}
restartPolicy: Never
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ template "app.fullname" . }}
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
rules:
- apiGroups: [""]
resources: ["configmaps"]
verbs: ["get", "list", "create", "watch"]
- apiGroups: ["apiextensions.k8s.io"]
resources: ["customresourcedefinitions"]
verbs: ["create", "get", "list", "watch", "patch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ template "app.fullname" . }}
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: operator-init-{{ .Release.Name }}
subjects:
- kind: ServiceAccount
name: {{ template "app.fullname" . }}
namespace: {{ .Release.Namespace }}
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ template "app.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
enabled: true
apiGroup: "monitoring.coreos.com"
image:
repository: rancher/istio-kubectl
tag: 1.1.5
resources:
limits:
cpu: 20m
memory: 50Mi
requests:
cpu: 20m
memory: 20Mi
...@@ -68,3 +68,8 @@ dependencies: ...@@ -68,3 +68,8 @@ dependencies:
version: 0.0.2 version: 0.0.2
condition: operator.enabled,enabled condition: operator.enabled,enabled
repository: "file://./charts/operator/" repository: "file://./charts/operator/"
- name: operator-init
version: 0.1.0
condition: operator-init.enabled
repository: "file://./charts/operator-init/"
{{- if and .Release.IsInstall .Values.global.installCRDs -}}
{{- if not (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1") }}
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: {{ printf "alertmanagers.%s" (.Values.operator.apiGroup | default "monitoring.coreos.com") }}
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
annotations:
"helm.sh/hook": crd-install
spec:
group: {{ .Values.operator.apiGroup | default "monitoring.coreos.com" }}
names:
kind: Alertmanager
plural: alertmanagers
scope: Namespaced
version: v1
---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: {{ printf "prometheuses.%s" (.Values.operator.apiGroup | default "monitoring.coreos.com") }}
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
annotations:
"helm.sh/hook": crd-install
spec:
group: {{ .Values.operator.apiGroup | default "monitoring.coreos.com" }}
names:
kind: Prometheus
plural: prometheuses
scope: Namespaced
version: v1
---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: {{ printf "prometheusrules.%s" (.Values.operator.apiGroup | default "monitoring.coreos.com") }}
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
annotations:
"helm.sh/hook": crd-install
spec:
group: {{ .Values.operator.apiGroup | default "monitoring.coreos.com" }}
names:
kind: PrometheusRule
plural: prometheusrules
scope: Namespaced
version: v1
---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: {{ printf "servicemonitors.%s" (.Values.operator.apiGroup | default "monitoring.coreos.com") }}
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
annotations:
"helm.sh/hook": crd-install
spec:
group: {{ .Values.operator.apiGroup | default "monitoring.coreos.com" }}
names:
kind: ServiceMonitor
plural: servicemonitors
scope: Namespaced
version: v1
{{- end }}
{{- end -}}
...@@ -356,3 +356,18 @@ global: ...@@ -356,3 +356,18 @@ global:
systemDefaultRegistry: "" systemDefaultRegistry: ""
clusterName: "" clusterName: ""
projectName: "" projectName: ""
installCRDs: true
operator-init:
enabled: false
apiGroup: "monitoring.coreos.com"
image:
repository: rancher/istio-kubectl
tag: 1.1.5
resources:
limits:
cpu: 20m
memory: 50Mi
requests:
cpu: 20m
memory: 20Mi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment