added repo

This commit is contained in:
Your Name
2026-08-26 03:39:42 +05:30
parent 45c25a95af
commit b8575bb8b9
6889 changed files with 1217125 additions and 0 deletions
@@ -0,0 +1,14 @@
{{- if not .Values.manager.collectorImage.repository }}
{{ fail "[ERROR] 'manager.collectorImage.repository' must be set. See https://github.com/open-telemetry/opentelemetry-helm-charts/blob/main/charts/opentelemetry-operator/UPGRADING.md for instructions." }}
{{ end }}
{{- if and .Values.manager.featureGates .Values.manager.featureGatesMap }}
{{ fail "[ERROR] only one of 'manager.featureGates' and 'manager.featureGatesMap' can be set at a time" }}
{{ end }}
{{- if .Values.manager.featureGates }}
The 'manager.featureGates' value is deprecated. Please migrate to use the 'manager.featureGatesMap' value.
{{ end }}
{{ $.Chart.Name }} has been installed. Check its status by running:
kubectl --namespace {{ .Release.Namespace }} get pods -l "app.kubernetes.io/name={{ $.Release.Name }}"
Visit https://github.com/open-telemetry/opentelemetry-operator for instructions on how to create & configure OpenTelemetryCollector and Instrumentation custom resources by using the Operator.
@@ -0,0 +1,168 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "opentelemetry-operator.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "opentelemetry-operator.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "opentelemetry-operator.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "opentelemetry-operator.labels" -}}
helm.sh/chart: {{ include "opentelemetry-operator.chart" . }}
{{ include "opentelemetry-operator.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Values.additionalLabels }}
{{ include "opentelemetry-operator.additionalLabels" . }}
{{- end }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "opentelemetry-operator.selectorLabels" -}}
app.kubernetes.io/name: {{ include "opentelemetry-operator.name" . }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "opentelemetry-operator.serviceAccountName" -}}
{{- if .Values.manager.serviceAccount.create }}
{{- default (include "opentelemetry-operator.name" .) .Values.manager.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.manager.serviceAccount.name }}
{{- end }}
{{- end }}
{{- define "opentelemetry-operator.podAnnotations" -}}
{{- if .Values.manager.podAnnotations }}
{{- .Values.manager.podAnnotations | toYaml }}
{{- end }}
{{- end }}
{{- define "opentelemetry-operator.podLabels" -}}
{{- if .Values.manager.podLabels }}
{{- .Values.manager.podLabels | toYaml }}
{{- end }}
{{- end }}
{{- define "opentelemetry-operator.additionalLabels" -}}
{{- if .Values.additionalLabels }}
{{- tpl (.Values.additionalLabels | toYaml) . }}
{{- end }}
{{- end }}
{{/*
Create an ordered name of the MutatingWebhookConfiguration
*/}}
{{- define "opentelemetry-operator.MutatingWebhookName" -}}
{{- printf "%s-%s" (.Values.admissionWebhooks.namePrefix | toString) (include "opentelemetry-operator.fullname" .) | trimPrefix "-" }}
{{- end }}
{{/*
Return certificate and CA for Webhooks.
It handles variants when a cert has to be generated by Helm,
a cert is loaded from an existing secret or is provided via `.Values`
*/}}
{{- define "opentelemetry-operator.WebhookCert" -}}
{{- $caCertEnc := "" }}
{{- $certCrtEnc := "" }}
{{- $certKeyEnc := "" }}
{{- if .Values.admissionWebhooks.autoGenerateCert.enabled }}
{{- $prevSecret := (lookup "v1" "Secret" .Release.Namespace (default (printf "%s-controller-manager-service-cert" (include "opentelemetry-operator.fullname" .)) .Values.admissionWebhooks.secretName )) }}
{{- if and (not .Values.admissionWebhooks.autoGenerateCert.recreate) $prevSecret }}
{{- $certCrtEnc = index $prevSecret "data" "tls.crt" }}
{{- $certKeyEnc = index $prevSecret "data" "tls.key" }}
{{- $caCertEnc = index $prevSecret "data" "ca.crt" }}
{{- if not $caCertEnc }}
{{- $prevHook := (lookup "admissionregistration.k8s.io/v1" "MutatingWebhookConfiguration" .Release.Namespace (print (include "opentelemetry-operator.MutatingWebhookName" . ) "-mutation")) }}
{{- if not (eq (toString $prevHook) "<nil>") }}
{{- $caCertEnc = (first $prevHook.webhooks).clientConfig.caBundle }}
{{- end }}
{{- end }}
{{- else }}
{{- $altNames := list ( printf "%s-webhook.%s" (include "opentelemetry-operator.fullname" .) .Release.Namespace ) ( printf "%s-webhook.%s.svc" (include "opentelemetry-operator.fullname" .) .Release.Namespace ) -}}
{{- $tmpperioddays := int .Values.admissionWebhooks.autoGenerateCert.certPeriodDays | default 365 }}
{{- $ca := genCA "opentelemetry-operator-operator-ca" $tmpperioddays }}
{{- $cert := genSignedCert (include "opentelemetry-operator.fullname" .) nil $altNames $tmpperioddays $ca }}
{{- $certCrtEnc = b64enc $cert.Cert }}
{{- $certKeyEnc = b64enc $cert.Key }}
{{- $caCertEnc = b64enc $ca.Cert }}
{{- end }}
{{- else }}
{{- $certCrtEnc = .Files.Get .Values.admissionWebhooks.certFile | b64enc }}
{{- $certKeyEnc = .Files.Get .Values.admissionWebhooks.keyFile | b64enc }}
{{- $caCertEnc = .Files.Get .Values.admissionWebhooks.caFile | b64enc }}
{{- end }}
{{- $result := dict "crt" $certCrtEnc "key" $certKeyEnc "ca" $caCertEnc }}
{{- $result | toYaml }}
{{- end }}
{{/*
Return the name of cert-manager's Certificate resources for webhooks.
*/}}
{{- define "opentelemetry-operator.webhookCertName" -}}
{{ template "opentelemetry-operator.fullname" . }}-serving-cert
{{- end }}
{{/*
Return the name of the cert-manager.io/inject-ca-from annotation for webhooks and CRDs.
*/}}
{{- define "opentelemetry-operator.webhookCertAnnotation" -}}
{{- if not .Values.admissionWebhooks.certManager.enabled }}
{{- "none" }}
{{- else }}
{{- printf "%s/%s" .Release.Namespace (include "opentelemetry-operator.webhookCertName" .) }}
{{- end }}
{{- end }}
{{/*
The image to use for opentelemetry-operator.
*/}}
{{- define "opentelemetry-operator.image" -}}
{{- printf "%s:%s" .Values.manager.image.repository (default .Chart.AppVersion .Values.manager.image.tag) }}
{{- end }}
{{- define "opentelemetry-operator.featureGatesMap" -}}
{{$first := true}}
{{- range $key, $value := .Values.manager.featureGatesMap -}}
{{- if $first -}}
{{ $first = false }}
{{- else -}}
,
{{- end -}}
{{- if $value -}}
{{- $key }}
{{- end -}}
{{- end -}}
{{- end }}
@@ -0,0 +1,237 @@
{{- if and (.Values.admissionWebhooks.create) (.Values.admissionWebhooks.certManager.enabled) }}
apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
metadata:
annotations:
cert-manager.io/inject-ca-from: {{ include "opentelemetry-operator.webhookCertAnnotation" . }}
labels:
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
app.kubernetes.io/component: webhook
name: {{ template "opentelemetry-operator.MutatingWebhookName" . }}-mutation
webhooks:
- admissionReviewVersions:
- v1
clientConfig:
service:
name: {{ template "opentelemetry-operator.fullname" . }}-webhook
namespace: {{ .Release.Namespace }}
path: /mutate-opentelemetry-io-v1alpha1-instrumentation
port: {{ .Values.admissionWebhooks.servicePort }}
failurePolicy: {{ .Values.admissionWebhooks.failurePolicy }}
name: minstrumentation.kb.io
{{- if .Values.admissionWebhooks.namespaceSelector }}
namespaceSelector:
{{- toYaml .Values.admissionWebhooks.namespaceSelector | nindent 6 }}
{{- end }}
{{- if .Values.admissionWebhooks.objectSelector }}
objectSelector:
{{- toYaml .Values.admissionWebhooks.objectSelector | nindent 6 }}
{{- end }}
rules:
- apiGroups:
- opentelemetry.io
apiVersions:
- v1alpha1
operations:
- CREATE
- UPDATE
resources:
- instrumentations
scope: Namespaced
sideEffects: None
timeoutSeconds: {{ .Values.admissionWebhooks.timeoutSeconds }}
- admissionReviewVersions:
- v1
clientConfig:
service:
name: {{ template "opentelemetry-operator.fullname" . }}-webhook
namespace: {{ .Release.Namespace }}
path: /mutate-opentelemetry-io-v1beta1-opentelemetrycollector
port: {{ .Values.admissionWebhooks.servicePort }}
failurePolicy: {{ .Values.admissionWebhooks.failurePolicy }}
name: mopentelemetrycollectorbeta.kb.io
{{- if .Values.admissionWebhooks.namespaceSelector }}
namespaceSelector:
{{- toYaml .Values.admissionWebhooks.namespaceSelector | nindent 6 }}
{{- end }}
{{- if .Values.admissionWebhooks.objectSelector }}
objectSelector:
{{- toYaml .Values.admissionWebhooks.objectSelector | nindent 6 }}
{{- end }}
rules:
- apiGroups:
- opentelemetry.io
apiVersions:
- v1beta1
operations:
- CREATE
- UPDATE
resources:
- opentelemetrycollectors
scope: Namespaced
sideEffects: None
timeoutSeconds: {{ .Values.admissionWebhooks.timeoutSeconds }}
- admissionReviewVersions:
- v1
clientConfig:
service:
name: {{ template "opentelemetry-operator.fullname" . }}-webhook
namespace: {{ .Release.Namespace }}
path: /mutate-v1-pod
port: {{ .Values.admissionWebhooks.servicePort }}
{{- if .Values.admissionWebhooks.namespaceSelector }}
namespaceSelector:
{{- toYaml .Values.admissionWebhooks.namespaceSelector | nindent 6 }}
{{- end }}
{{- if .Values.admissionWebhooks.objectSelector }}
objectSelector:
{{- toYaml .Values.admissionWebhooks.objectSelector | nindent 6 }}
{{- end }}
failurePolicy: {{ .Values.admissionWebhooks.pods.failurePolicy }}
name: mpod.kb.io
rules:
- apiGroups:
- ""
apiVersions:
- v1
operations:
- CREATE
resources:
- pods
scope: Namespaced
sideEffects: None
timeoutSeconds: {{ .Values.admissionWebhooks.timeoutSeconds }}
---
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
annotations:
cert-manager.io/inject-ca-from: {{ include "opentelemetry-operator.webhookCertAnnotation" . }}
labels:
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
app.kubernetes.io/component: webhook
name: {{ template "opentelemetry-operator.fullname" . }}-validation
webhooks:
- admissionReviewVersions:
- v1
clientConfig:
service:
name: {{ template "opentelemetry-operator.fullname" . }}-webhook
namespace: {{ .Release.Namespace }}
path: /validate-opentelemetry-io-v1alpha1-instrumentation
port: {{ .Values.admissionWebhooks.servicePort }}
failurePolicy: {{ .Values.admissionWebhooks.failurePolicy }}
name: vinstrumentationcreateupdate.kb.io
{{- if .Values.admissionWebhooks.namespaceSelector }}
namespaceSelector:
{{- toYaml .Values.admissionWebhooks.namespaceSelector | nindent 6 }}
{{- end }}
{{- if .Values.admissionWebhooks.objectSelector }}
objectSelector:
{{- toYaml .Values.admissionWebhooks.objectSelector | nindent 6 }}
{{- end }}
rules:
- apiGroups:
- opentelemetry.io
apiVersions:
- v1alpha1
operations:
- CREATE
- UPDATE
resources:
- instrumentations
scope: Namespaced
sideEffects: None
timeoutSeconds: {{ .Values.admissionWebhooks.timeoutSeconds }}
- admissionReviewVersions:
- v1
clientConfig:
service:
name: {{ template "opentelemetry-operator.fullname" . }}-webhook
namespace: {{ .Release.Namespace }}
path: /validate-opentelemetry-io-v1alpha1-instrumentation
port: {{ .Values.admissionWebhooks.servicePort }}
failurePolicy: Ignore
name: vinstrumentationdelete.kb.io
{{- if .Values.admissionWebhooks.namespaceSelector }}
namespaceSelector:
{{- toYaml .Values.admissionWebhooks.namespaceSelector | nindent 6 }}
{{- end }}
{{- if .Values.admissionWebhooks.objectSelector }}
objectSelector:
{{- toYaml .Values.admissionWebhooks.objectSelector | nindent 6 }}
{{- end }}
rules:
- apiGroups:
- opentelemetry.io
apiVersions:
- v1alpha1
operations:
- DELETE
resources:
- instrumentations
scope: Namespaced
sideEffects: None
timeoutSeconds: {{ .Values.admissionWebhooks.timeoutSeconds }}
- admissionReviewVersions:
- v1
clientConfig:
service:
name: {{ template "opentelemetry-operator.fullname" . }}-webhook
namespace: {{ .Release.Namespace }}
path: /validate-opentelemetry-io-v1beta1-opentelemetrycollector
port: {{ .Values.admissionWebhooks.servicePort }}
failurePolicy: {{ .Values.admissionWebhooks.failurePolicy }}
name: vopentelemetrycollectorcreateupdatebeta.kb.io
{{- if .Values.admissionWebhooks.namespaceSelector }}
namespaceSelector:
{{- toYaml .Values.admissionWebhooks.namespaceSelector | nindent 6 }}
{{- end }}
{{- if .Values.admissionWebhooks.objectSelector }}
objectSelector:
{{- toYaml .Values.admissionWebhooks.objectSelector | nindent 6 }}
{{- end }}
rules:
- apiGroups:
- opentelemetry.io
apiVersions:
- v1beta1
operations:
- CREATE
- UPDATE
resources:
- opentelemetrycollectors
scope: Namespaced
sideEffects: None
timeoutSeconds: {{ .Values.admissionWebhooks.timeoutSeconds }}
- admissionReviewVersions:
- v1
clientConfig:
service:
name: {{ template "opentelemetry-operator.fullname" . }}-webhook
namespace: {{ .Release.Namespace }}
path: /validate-opentelemetry-io-v1beta1-opentelemetrycollector
port: {{ .Values.admissionWebhooks.servicePort }}
failurePolicy: Ignore
name: vopentelemetrycollectordeletebeta.kb.io
{{- if .Values.admissionWebhooks.namespaceSelector }}
namespaceSelector:
{{- toYaml .Values.admissionWebhooks.namespaceSelector | nindent 6 }}
{{- end }}
{{- if .Values.admissionWebhooks.objectSelector }}
objectSelector:
{{- toYaml .Values.admissionWebhooks.objectSelector | nindent 6 }}
{{- end }}
rules:
- apiGroups:
- opentelemetry.io
apiVersions:
- v1beta1
operations:
- DELETE
resources:
- opentelemetrycollectors
scope: Namespaced
sideEffects: None
timeoutSeconds: {{ .Values.admissionWebhooks.timeoutSeconds }}
{{- end }}
@@ -0,0 +1,282 @@
{{- if and (.Values.admissionWebhooks.create) (not .Values.admissionWebhooks.certManager.enabled) }}
{{- $cert := fromYaml (include "opentelemetry-operator.WebhookCert" .) }}
{{- $caCertEnc := $cert.ca }}
{{- $certCrtEnc := $cert.crt }}
{{- $certKeyEnc := $cert.key }}
apiVersion: v1
kind: Secret
type: kubernetes.io/tls
metadata:
annotations:
"helm.sh/hook": "pre-install,pre-upgrade"
"helm.sh/hook-delete-policy": "before-hook-creation"
{{- if .Values.admissionWebhooks.secretAnnotations }}
{{- toYaml .Values.admissionWebhooks.secretAnnotations | nindent 4 }}
{{- end }}
labels:
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
app.kubernetes.io/component: webhook
{{- if .Values.admissionWebhooks.secretLabels }}
{{- toYaml .Values.admissionWebhooks.secretLabels | nindent 4 }}
{{- end }}
name: {{ default (printf "%s-controller-manager-service-cert" (include "opentelemetry-operator.fullname" .)) .Values.admissionWebhooks.secretName }}
namespace: {{ .Release.Namespace }}
data:
tls.crt: {{ $certCrtEnc }}
tls.key: {{ $certKeyEnc }}
ca.crt: {{ $caCertEnc }}
---
apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
metadata:
labels:
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
app.kubernetes.io/component: webhook
name: {{ template "opentelemetry-operator.MutatingWebhookName" . }}-mutation
webhooks:
- admissionReviewVersions:
- v1
clientConfig:
caBundle: {{ $caCertEnc }}
service:
name: {{ template "opentelemetry-operator.fullname" . }}-webhook
namespace: {{ .Release.Namespace }}
path: /mutate-opentelemetry-io-v1alpha1-instrumentation
port: {{ .Values.admissionWebhooks.servicePort }}
failurePolicy: {{ .Values.admissionWebhooks.failurePolicy }}
name: minstrumentation.kb.io
{{- if .Values.admissionWebhooks.namespaceSelector }}
namespaceSelector:
{{- toYaml .Values.admissionWebhooks.namespaceSelector | nindent 6 }}
{{- end }}
{{- if .Values.admissionWebhooks.objectSelector }}
objectSelector:
{{- toYaml .Values.admissionWebhooks.objectSelector | nindent 6 }}
{{- end }}
rules:
- apiGroups:
- opentelemetry.io
apiVersions:
- v1alpha1
operations:
- CREATE
- UPDATE
resources:
- instrumentations
scope: Namespaced
sideEffects: None
timeoutSeconds: {{ .Values.admissionWebhooks.timeoutSeconds }}
- admissionReviewVersions:
- v1
clientConfig:
caBundle: {{ $caCertEnc }}
service:
name: {{ template "opentelemetry-operator.fullname" . }}-webhook
namespace: {{ .Release.Namespace }}
path: /mutate-opentelemetry-io-v1beta1-opentelemetrycollector
port: {{ .Values.admissionWebhooks.servicePort }}
failurePolicy: {{ .Values.admissionWebhooks.failurePolicy }}
name: mopentelemetrycollectorbeta.kb.io
{{- if .Values.admissionWebhooks.namespaceSelector }}
namespaceSelector:
{{- toYaml .Values.admissionWebhooks.namespaceSelector | nindent 6 }}
{{- end }}
{{- if .Values.admissionWebhooks.objectSelector }}
objectSelector:
{{- toYaml .Values.admissionWebhooks.objectSelector | nindent 6 }}
{{- end }}
rules:
- apiGroups:
- opentelemetry.io
apiVersions:
- v1beta1
operations:
- CREATE
- UPDATE
resources:
- opentelemetrycollectors
scope: Namespaced
sideEffects: None
timeoutSeconds: {{ .Values.admissionWebhooks.timeoutSeconds }}
- admissionReviewVersions:
- v1
clientConfig:
caBundle: {{ $caCertEnc }}
service:
name: {{ template "opentelemetry-operator.fullname" . }}-webhook
namespace: {{ .Release.Namespace }}
path: /mutate-v1-pod
port: {{ .Values.admissionWebhooks.servicePort }}
failurePolicy: {{ .Values.admissionWebhooks.pods.failurePolicy }}
name: mpod.kb.io
{{- if .Values.admissionWebhooks.namespaceSelector }}
namespaceSelector:
{{- toYaml .Values.admissionWebhooks.namespaceSelector | nindent 6 }}
{{- end }}
{{- if .Values.admissionWebhooks.objectSelector }}
objectSelector:
{{- toYaml .Values.admissionWebhooks.objectSelector | nindent 6 }}
{{- end }}
rules:
- apiGroups:
- ""
apiVersions:
- v1
operations:
- CREATE
resources:
- pods
scope: Namespaced
sideEffects: None
timeoutSeconds: {{ .Values.admissionWebhooks.timeoutSeconds }}
---
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
annotations:
cert-manager.io/inject-ca-from: {{ include "opentelemetry-operator.webhookCertAnnotation" . }}
labels:
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
app.kubernetes.io/component: webhook
name: {{ template "opentelemetry-operator.fullname" . }}-validation
webhooks:
- admissionReviewVersions:
- v1
clientConfig:
caBundle: {{ $caCertEnc }}
service:
name: {{ template "opentelemetry-operator.fullname" . }}-webhook
namespace: {{ .Release.Namespace }}
path: /validate-opentelemetry-io-v1alpha1-instrumentation
port: {{ .Values.admissionWebhooks.servicePort }}
failurePolicy: {{ .Values.admissionWebhooks.failurePolicy }}
name: vinstrumentationcreateupdate.kb.io
{{- if .Values.admissionWebhooks.namespaceSelector }}
namespaceSelector:
{{- toYaml .Values.admissionWebhooks.namespaceSelector | nindent 6 }}
{{- end }}
{{- if .Values.admissionWebhooks.objectSelector }}
objectSelector:
{{- toYaml .Values.admissionWebhooks.objectSelector | nindent 6 }}
{{- end }}
rules:
- apiGroups:
- opentelemetry.io
apiVersions:
- v1alpha1
operations:
- CREATE
- UPDATE
resources:
- instrumentations
scope: Namespaced
sideEffects: None
timeoutSeconds: {{ .Values.admissionWebhooks.timeoutSeconds }}
- admissionReviewVersions:
- v1
clientConfig:
caBundle: {{ $caCertEnc }}
service:
name: {{ template "opentelemetry-operator.fullname" . }}-webhook
namespace: {{ .Release.Namespace }}
path: /validate-opentelemetry-io-v1alpha1-instrumentation
port: {{ .Values.admissionWebhooks.servicePort }}
failurePolicy: Ignore
name: vinstrumentationdelete.kb.io
{{- if .Values.admissionWebhooks.namespaceSelector }}
namespaceSelector:
{{- toYaml .Values.admissionWebhooks.namespaceSelector | nindent 6 }}
{{- end }}
{{- if .Values.admissionWebhooks.objectSelector }}
objectSelector:
{{- toYaml .Values.admissionWebhooks.objectSelector | nindent 6 }}
{{- end }}
rules:
- apiGroups:
- opentelemetry.io
apiVersions:
- v1alpha1
operations:
- DELETE
resources:
- instrumentations
scope: Namespaced
sideEffects: None
timeoutSeconds: {{ .Values.admissionWebhooks.timeoutSeconds }}
- admissionReviewVersions:
- v1
clientConfig:
caBundle: {{ $caCertEnc }}
service:
name: {{ template "opentelemetry-operator.fullname" . }}-webhook
namespace: {{ .Release.Namespace }}
path: /validate-opentelemetry-io-v1beta1-opentelemetrycollector
port: {{ .Values.admissionWebhooks.servicePort }}
failurePolicy: {{ .Values.admissionWebhooks.failurePolicy }}
name: vopentelemetrycollectorcreateupdatebeta.kb.io
{{- if .Values.admissionWebhooks.namespaceSelector }}
namespaceSelector:
{{- toYaml .Values.admissionWebhooks.namespaceSelector | nindent 6 }}
{{- end }}
{{- if .Values.admissionWebhooks.objectSelector }}
objectSelector:
{{- toYaml .Values.admissionWebhooks.objectSelector | nindent 6 }}
{{- end }}
rules:
- apiGroups:
- opentelemetry.io
apiVersions:
- v1beta1
operations:
- CREATE
- UPDATE
resources:
- opentelemetrycollectors
scope: Namespaced
sideEffects: None
timeoutSeconds: {{ .Values.admissionWebhooks.timeoutSeconds }}
- admissionReviewVersions:
- v1
clientConfig:
caBundle: {{ $caCertEnc }}
service:
name: {{ template "opentelemetry-operator.fullname" . }}-webhook
namespace: {{ .Release.Namespace }}
path: /validate-opentelemetry-io-v1beta1-opentelemetrycollector
port: {{ .Values.admissionWebhooks.servicePort }}
failurePolicy: Ignore
name: vopentelemetrycollectordeletebeta.kb.io
{{- if .Values.admissionWebhooks.namespaceSelector }}
namespaceSelector:
{{- toYaml .Values.admissionWebhooks.namespaceSelector | nindent 6 }}
{{- end }}
{{- if .Values.admissionWebhooks.objectSelector }}
objectSelector:
{{- toYaml .Values.admissionWebhooks.objectSelector | nindent 6 }}
{{- end }}
rules:
- apiGroups:
- opentelemetry.io
apiVersions:
- v1beta1
operations:
- DELETE
resources:
- opentelemetrycollectors
scope: Namespaced
sideEffects: None
timeoutSeconds: {{ .Values.admissionWebhooks.timeoutSeconds }}
---
{{- $contextWithCaBundle := merge $ (dict "caBundle" $caCertEnc) }}
{{- tpl (.Files.Get "conf/crds/crd-opentelemetry.io_opampbridges.yaml") $contextWithCaBundle }}
---
{{- tpl (.Files.Get "conf/crds/crd-opentelemetrycollector.yaml") $contextWithCaBundle }}
---
{{- tpl (.Files.Get "conf/crds/crd-opentelemetryinstrumentation.yaml") $contextWithCaBundle }}
{{- else }}
{{- tpl (.Files.Get "conf/crds/crd-opentelemetry.io_opampbridges.yaml") . }}
---
{{- tpl (.Files.Get "conf/crds/crd-opentelemetrycollector.yaml") . }}
---
{{- tpl (.Files.Get "conf/crds/crd-opentelemetryinstrumentation.yaml") . }}
{{- end }}
@@ -0,0 +1,52 @@
{{- if and .Values.admissionWebhooks.create .Values.admissionWebhooks.certManager.enabled }}
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
{{- if .Values.admissionWebhooks.certManager.certificateAnnotations }}
annotations:
{{- toYaml .Values.admissionWebhooks.certManager.certificateAnnotations | nindent 4 }}
{{- end }}
labels:
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
app.kubernetes.io/component: webhook
name: {{ template "opentelemetry-operator.webhookCertName" . }}
namespace: {{ .Release.Namespace }}
spec:
{{- if .Values.admissionWebhooks.certManager.duration }}
duration: {{ .Values.admissionWebhooks.certManager.duration }}
{{- end }}
{{- if .Values.admissionWebhooks.certManager.renewBefore }}
renewBefore: {{ .Values.admissionWebhooks.certManager.renewBefore }}
{{- end }}
dnsNames:
- {{ template "opentelemetry-operator.fullname" . }}-webhook.{{ .Release.Namespace }}.svc
- {{ template "opentelemetry-operator.fullname" . }}-webhook.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}
issuerRef:
{{- if .Values.admissionWebhooks.certManager.issuerRef }}
{{- toYaml .Values.admissionWebhooks.certManager.issuerRef | nindent 4 }}
{{- else }}
kind: Issuer
name: {{ template "opentelemetry-operator.fullname" . }}-selfsigned-issuer
{{- end }}
secretName: {{ default (printf "%s-controller-manager-service-cert" (include "opentelemetry-operator.fullname" .)) .Values.admissionWebhooks.secretName }}
subject:
organizationalUnits:
- {{ template "opentelemetry-operator.fullname" . }}
{{- if not .Values.admissionWebhooks.certManager.issuerRef }}
---
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
{{- if .Values.admissionWebhooks.certManager.issuerAnnotations }}
annotations:
{{- toYaml .Values.admissionWebhooks.certManager.issuerAnnotations | nindent 4 }}
{{- end }}
labels:
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
app.kubernetes.io/component: webhook
name: {{ template "opentelemetry-operator.fullname" . }}-selfsigned-issuer
namespace: {{ .Release.Namespace }}
spec:
selfSigned: {}
{{- end }}
{{- end }}
@@ -0,0 +1,293 @@
{{- if .Values.clusterRole.create }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
app.kubernetes.io/component: controller-manager
name: {{ template "opentelemetry-operator.fullname" . }}-manager
rules:
- apiGroups:
- ""
resources:
- configmaps
- persistentvolumeclaims
- persistentvolumes
- pods
- serviceaccounts
- services
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
resources:
- events
verbs:
- create
- patch
- apiGroups:
- ""
resources:
- namespaces
verbs:
- list
- watch
- apiGroups:
- apps
resources:
- daemonsets
- deployments
- statefulsets
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- apps
- extensions
resources:
- replicasets
verbs:
- get
- list
- watch
- apiGroups:
- autoscaling
resources:
- horizontalpodautoscalers
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
{{- if .Values.manager.createRbacPermissions }}
- apiGroups:
- rbac.authorization.k8s.io
resources:
- clusterroles
- clusterrolebindings
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
resources:
- nodes
- namespaces
verbs:
- get
- list
- watch
{{- end }}
- apiGroups:
- batch
resources:
- jobs
verbs:
- get
- list
- watch
- apiGroups:
- config.openshift.io
resources:
- infrastructures
- infrastructures/status
verbs:
- get
- list
- watch
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- create
- get
- list
- update
- apiGroups:
- monitoring.coreos.com
resources:
- podmonitors
- servicemonitors
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- networking.k8s.io
resources:
- ingresses
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- opentelemetry.io
resources:
- instrumentations
verbs:
- get
- list
- patch
- update
- watch
- apiGroups:
- opentelemetry.io
resources:
- opampbridges
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- opentelemetry.io
resources:
- opampbridges/finalizers
verbs:
- update
- apiGroups:
- opentelemetry.io
resources:
- opampbridges/status
verbs:
- get
- patch
- update
- apiGroups:
- opentelemetry.io
resources:
- opentelemetrycollectors
verbs:
- get
- list
- patch
- update
- watch
- apiGroups:
- opentelemetry.io
resources:
- opentelemetrycollectors/finalizers
verbs:
- get
- patch
- update
- apiGroups:
- opentelemetry.io
resources:
- opentelemetrycollectors/status
verbs:
- get
- patch
- update
- apiGroups:
- policy
resources:
- poddisruptionbudgets
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- route.openshift.io
resources:
- routes
- routes/custom-host
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
{{- if .Values.manager.featureGatesMap }}
{{- if ".Values.manager.featureGatesMap.operator.targetallocator.mtls" }}
- apiGroups:
- cert-manager.io
resources:
- issuers
- certificaterequests
- certificates
verbs:
- create
- get
- list
- watch
- update
- patch
- delete
{{- end }}
{{- end }}
{{ if .Values.kubeRBACProxy.enabled }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
app.kubernetes.io/component: controller-manager
name: {{ template "opentelemetry-operator.fullname" . }}-metrics
rules:
- nonResourceURLs:
- /metrics
verbs:
- get
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
app.kubernetes.io/component: controller-manager
name: {{ template "opentelemetry-operator.fullname" . }}-proxy
rules:
- apiGroups:
- authentication.k8s.io
resources:
- tokenreviews
verbs:
- create
- apiGroups:
- authorization.k8s.io
resources:
- subjectaccessreviews
verbs:
- create
{{- end }}
{{ end }}
@@ -0,0 +1,36 @@
{{- if .Values.clusterRole.create }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
app.kubernetes.io/component: controller-manager
name: {{ template "opentelemetry-operator.fullname" . }}-manager
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ template "opentelemetry-operator.fullname" . }}-manager
subjects:
- kind: ServiceAccount
name: {{ template "opentelemetry-operator.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{ if .Values.kubeRBACProxy.enabled }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
app.kubernetes.io/component: controller-manager
name: {{ template "opentelemetry-operator.fullname" . }}-proxy
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ template "opentelemetry-operator.fullname" . }}-proxy
subjects:
- kind: ServiceAccount
name: {{ template "opentelemetry-operator.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{- end }}
{{ end }}
@@ -0,0 +1,182 @@
apiVersion: apps/v1
kind: Deployment
metadata:
{{- with .Values.manager.deploymentAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
app.kubernetes.io/component: controller-manager
name: {{ template "opentelemetry-operator.fullname" . }}
namespace: {{ .Release.Namespace }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "opentelemetry-operator.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: controller-manager
template:
metadata:
annotations:
{{- if .Values.manager.rolling }}
rollme: {{ randAlphaNum 5 | quote }}
{{- end }}
kubectl.kubernetes.io/default-container: manager
{{- if .Values.manager.podAnnotations }}
{{- include "opentelemetry-operator.podAnnotations" . | nindent 8 }}
{{- end }}
labels:
{{- include "opentelemetry-operator.selectorLabels" . | nindent 8 }}
{{- if .Values.manager.podLabels }}
{{- include "opentelemetry-operator.podLabels" . | nindent 8 }}
{{- end }}
app.kubernetes.io/component: controller-manager
spec:
hostNetwork: {{ .Values.hostNetwork }}
{{- if .Values.priorityClassName }}
priorityClassName: {{ .Values.priorityClassName | quote }}
{{- end }}
containers:
- args:
- --metrics-addr=0.0.0.0:{{ .Values.manager.ports.metricsPort }}
{{- if .Values.manager.leaderElection.enabled }}
- --enable-leader-election
{{- end }}
- --health-probe-addr=:{{ .Values.manager.ports.healthzPort }}
{{- if or .Values.admissionWebhooks.create .Values.admissionWebhooks.secretName }}
- --webhook-port={{ .Values.manager.ports.webhookPort }}
{{- end }}
{{- if and .Values.manager.collectorImage.repository .Values.manager.collectorImage.tag }}
- --collector-image={{ .Values.manager.collectorImage.repository }}:{{ .Values.manager.collectorImage.tag }}
{{- end }}
{{- if and .Values.manager.opampBridgeImage.repository .Values.manager.opampBridgeImage.tag }}
- --operator-opamp-bridge-image={{ .Values.manager.opampBridgeImage.repository }}:{{ .Values.manager.opampBridgeImage.tag }}
{{- end }}
{{- if and .Values.manager.targetAllocatorImage.repository .Values.manager.targetAllocatorImage.tag }}
- --target-allocator-image={{ .Values.manager.targetAllocatorImage.repository }}:{{ .Values.manager.targetAllocatorImage.tag }}
{{- end }}
{{- if and .Values.manager.autoInstrumentationImage.java.repository .Values.manager.autoInstrumentationImage.java.tag }}
- --auto-instrumentation-java-image={{ .Values.manager.autoInstrumentationImage.java.repository }}:{{ .Values.manager.autoInstrumentationImage.java.tag }}
{{- end }}
{{- if and .Values.manager.autoInstrumentationImage.nodejs.repository .Values.manager.autoInstrumentationImage.nodejs.tag }}
- --auto-instrumentation-nodejs-image={{ .Values.manager.autoInstrumentationImage.nodejs.repository }}:{{ .Values.manager.autoInstrumentationImage.nodejs.tag }}
{{- end }}
{{- if and .Values.manager.autoInstrumentationImage.python.repository .Values.manager.autoInstrumentationImage.python.tag }}
- --auto-instrumentation-python-image={{ .Values.manager.autoInstrumentationImage.python.repository }}:{{ .Values.manager.autoInstrumentationImage.python.tag }}
{{- end }}
{{- if and .Values.manager.autoInstrumentationImage.dotnet.repository .Values.manager.autoInstrumentationImage.dotnet.tag }}
- --auto-instrumentation-dotnet-image={{ .Values.manager.autoInstrumentationImage.dotnet.repository }}:{{ .Values.manager.autoInstrumentationImage.dotnet.tag }}
{{- end }}
{{- if and .Values.manager.autoInstrumentationImage.go.repository .Values.manager.autoInstrumentationImage.go.tag }}
- --auto-instrumentation-go-image={{ .Values.manager.autoInstrumentationImage.go.repository }}:{{ .Values.manager.autoInstrumentationImage.go.tag }}
{{- end }}
{{- if and .Values.manager.autoInstrumentationImage.apacheHttpd.repository .Values.manager.autoInstrumentationImage.apacheHttpd.tag }}
- --auto-instrumentation-apache-httpd-image={{ .Values.manager.autoInstrumentationImage.apacheHttpd.repository }}:{{ .Values.manager.autoInstrumentationImage.apacheHttpd.tag }}
{{- end }}
{{- if .Values.manager.featureGatesMap }}
- --feature-gates={{ include "opentelemetry-operator.featureGatesMap" . }}
{{- else if ne .Values.manager.featureGates "" }}
- --feature-gates={{ .Values.manager.featureGates }}
{{- end }}
{{- if .Values.manager.extraArgs }}
{{- .Values.manager.extraArgs | toYaml | nindent 12 }}
{{- end }}
command:
- /manager
{{- if or .Values.manager.env .Values.manager.createRbacPermissions }}
env:
{{- if .Values.manager.env }}
{{- range $name, $value := .Values.manager.env }}
- name: {{ $name }}
value: {{ $value | quote -}}
{{- end }}
{{- end }}
{{- if .Values.manager.createRbacPermissions }}
- name: SERVICE_ACCOUNT_NAME
valueFrom:
fieldRef:
fieldPath: spec.serviceAccountName
{{- end }}
{{- end }}
image: {{ include "opentelemetry-operator.image" . | quote }}
name: manager
ports:
- containerPort: {{ .Values.manager.ports.metricsPort }}
name: metrics
protocol: TCP
{{- if or .Values.admissionWebhooks.create .Values.admissionWebhooks.secretName }}
- containerPort: {{ .Values.manager.ports.webhookPort }}
name: webhook-server
protocol: TCP
{{- end }}
livenessProbe:
httpGet:
path: /healthz
port: {{ .Values.manager.ports.healthzPort }}
initialDelaySeconds: 15
periodSeconds: 20
readinessProbe:
httpGet:
path: /readyz
port: {{ .Values.manager.ports.healthzPort }}
initialDelaySeconds: 5
periodSeconds: 10
resources: {{ toYaml .Values.manager.resources | nindent 12 }}
{{- if or .Values.admissionWebhooks.create .Values.admissionWebhooks.secretName }}
volumeMounts:
- mountPath: /tmp/k8s-webhook-server/serving-certs
name: cert
readOnly: true
{{- end }}
{{- with .Values.manager.securityContext }}
securityContext: {{ toYaml . | nindent 12 }}
{{- end }}
{{ if .Values.kubeRBACProxy.enabled }}
- args:
- --secure-listen-address=0.0.0.0:{{ .Values.kubeRBACProxy.ports.proxyPort }}
- --upstream=http://127.0.0.1:{{ .Values.manager.ports.metricsPort }}/
- --v=0
{{- if .Values.kubeRBACProxy.extraArgs }}
{{- .Values.kubeRBACProxy.extraArgs | toYaml | nindent 12 }}
{{- end }}
image: "{{ .Values.kubeRBACProxy.image.repository }}:{{ .Values.kubeRBACProxy.image.tag }}"
name: kube-rbac-proxy
ports:
- containerPort: {{ .Values.kubeRBACProxy.ports.proxyPort }}
name: https
protocol: TCP
{{- with .Values.kubeRBACProxy.resources }}
resources: {{ toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.kubeRBACProxy.securityContext }}
securityContext: {{ toYaml . | nindent 12 }}
{{- end }}
{{- end }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.topologySpreadConstraints }}
topologySpreadConstraints: {{ toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ template "opentelemetry-operator.serviceAccountName" . }}
terminationGracePeriodSeconds: 10
{{- if or .Values.admissionWebhooks.create .Values.admissionWebhooks.secretName }}
volumes:
- name: cert
secret:
defaultMode: 420
secretName: {{ default (printf "%s-controller-manager-service-cert" (include "opentelemetry-operator.fullname" .)) .Values.admissionWebhooks.secretName }}
{{- end }}
securityContext:
{{ toYaml .Values.securityContext | indent 8 }}
@@ -0,0 +1,21 @@
{{- if .Values.pdb.create }}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
labels:
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
app.kubernetes.io/component: controller-manager
name: {{ template "opentelemetry-operator.fullname" . }}
namespace: {{ .Release.Namespace }}
spec:
{{- if .Values.pdb.minAvailable }}
minAvailable: {{ .Values.pdb.minAvailable }}
{{- end }}
{{- if .Values.pdb.maxUnavailable }}
maxUnavailable: {{ .Values.pdb.maxUnavailable }}
{{- end }}
selector:
matchLabels:
{{- include "opentelemetry-operator.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: controller-manager
{{- end }}
@@ -0,0 +1,54 @@
{{- if and .Values.manager.prometheusRule.enabled .Values.manager.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: {{ include "opentelemetry-operator.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
app.kubernetes.io/component: controller-manager
{{- range $key, $value := .Values.manager.prometheusRule.extraLabels }}
{{- printf "%s: %s" $key (tpl $value $ | quote) | nindent 4 }}
{{- end }}
annotations:
{{- range $key, $value := .Values.manager.prometheusRule.annotations }}
{{- printf "%s: %s" $key (tpl $value $ | quote) | nindent 4 }}
{{- end }}
spec:
groups:
{{- if .Values.manager.prometheusRule.groups }}
{{- toYaml .Values.manager.prometheusRule.groups | nindent 4 }}
{{- end }}
{{- if .Values.manager.prometheusRule.defaultRules.enabled }}
- name: managerRules
rules:
- alert: ReconcileErrors
expr: rate(controller_runtime_reconcile_total{controller="opentelemetrycollector",result="error"}[5m]) > 0
for: 5m
labels:
severity: warning
{{- with .Values.manager.prometheusRule.defaultRules.additionalRuleLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
annotations:
description: '{{`Reconciliation errors for {{ $labels.controller }} is increasing and has now reached {{ humanize $value }} `}}'
runbook_url: '{{ default "https://opentelemetry.io/docs/kubernetes/operator/troubleshooting/prometheus-alerts-runbooks/" .Values.manager.prometheusRule.runbookUrl }}#reconcileerrors'
{{- with .Values.manager.prometheusRule.defaultRules.additionalRuleAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
- alert: WorkqueueDepth
expr: workqueue_depth{name="opentelemetrycollector"} > 0
for: 5m
labels:
severity: warning
{{- with .Values.manager.prometheusRule.defaultRules.additionalRuleLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
annotations:
description: '{{`Queue depth for {{ $labels.name }} has reached {{ $value }} `}}'
runbook_url: '{{ default "https://opentelemetry.io/docs/kubernetes/operator/troubleshooting/prometheus-alerts-runbooks/" .Values.manager.prometheusRule.runbookUrl }}#workqueuedepth'
{{- with .Values.manager.prometheusRule.defaultRules.additionalRuleAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- end }}
@@ -0,0 +1,38 @@
{{- if and .Values.role.create .Values.manager.leaderElection.enabled }}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
labels:
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
app.kubernetes.io/component: controller-manager
name: {{ template "opentelemetry-operator.fullname" . }}-leader-election
namespace: {{ .Release.Namespace }}
rules:
- apiGroups:
- ""
resources:
- configmaps
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- ""
resources:
- configmaps/status
verbs:
- get
- update
- patch
- apiGroups:
- ""
resources:
- events
verbs:
- create
- patch
{{- end }}
@@ -0,0 +1,18 @@
{{- if and .Values.role.create .Values.manager.leaderElection.enabled }}
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
app.kubernetes.io/component: controller-manager
name: {{ template "opentelemetry-operator.fullname" . }}-leader-election
namespace: {{ .Release.Namespace }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ template "opentelemetry-operator.fullname" . }}-leader-election
subjects:
- kind: ServiceAccount
name: {{ template "opentelemetry-operator.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{- end }}
@@ -0,0 +1,51 @@
apiVersion: v1
kind: Service
metadata:
{{- with .Values.manager.serviceAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
app.kubernetes.io/component: controller-manager
name: {{ template "opentelemetry-operator.fullname" . }}
namespace: {{ .Release.Namespace }}
spec:
ports:
{{- if .Values.kubeRBACProxy.enabled }}
- name: https
port: {{ .Values.kubeRBACProxy.ports.proxyPort }}
protocol: TCP
targetPort: https
{{- end }}
- name: metrics
port: {{ .Values.manager.ports.metricsPort }}
protocol: TCP
targetPort: metrics
selector:
{{- include "opentelemetry-operator.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: controller-manager
{{- if or .Values.admissionWebhooks.create .Values.admissionWebhooks.secretName }}
---
apiVersion: v1
kind: Service
metadata:
{{- with .Values.admissionWebhooks.serviceAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
app.kubernetes.io/component: controller-manager
name: {{ template "opentelemetry-operator.fullname" . }}-webhook
namespace: {{ .Release.Namespace }}
spec:
ports:
- port: {{ .Values.admissionWebhooks.servicePort }}
protocol: TCP
targetPort: webhook-server
selector:
{{- include "opentelemetry-operator.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: controller-manager
{{- end }}
@@ -0,0 +1,16 @@
{{- if .Values.manager.serviceAccount.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ template "opentelemetry-operator.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
app.kubernetes.io/component: controller-manager
{{- if .Values.manager.serviceAccount.annotations }}
annotations:
{{- range $key, $value := .Values.manager.serviceAccount.annotations }}
{{- printf "%s: %s" $key (tpl $value $ | quote) | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}
@@ -0,0 +1,37 @@
{{- if .Values.manager.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "opentelemetry-operator.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
app.kubernetes.io/component: controller-manager
{{- range $key, $value := .Values.manager.serviceMonitor.extraLabels }}
{{- printf "%s: %s" $key (tpl $value $ | quote) | nindent 4 }}
{{- end }}
{{- if .Values.manager.serviceMonitor.annotations }}
annotations:
{{- range $key, $value := .Values.manager.serviceMonitor.annotations }}
{{- printf "%s: %s" $key (tpl $value $ | quote) | nindent 4 }}
{{- end }}
{{- end }}
spec:
selector:
matchLabels:
{{- include "opentelemetry-operator.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: controller-manager
endpoints:
{{- toYaml .Values.manager.serviceMonitor.metricsEndpoints | nindent 4 }}
{{- with .Values.manager.serviceMonitor.relabelings }}
relabelings:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.manager.serviceMonitor.metricRelabelings }}
metricRelabelings:
{{- toYaml . | nindent 8 }}
{{- end }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
{{- end }}
@@ -0,0 +1,42 @@
{{- if and .Values.admissionWebhooks.create .Values.admissionWebhooks.certManager.enabled }}
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "opentelemetry-operator.fullname" . }}-cert-manager"
namespace: {{ .Release.Namespace }}
labels:
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
app.kubernetes.io/component: webhook
annotations:
"helm.sh/hook": test
spec:
containers:
- name: wget
image: "{{ .Values.testFramework.image.repository }}:{{ .Values.testFramework.image.tag }}"
env:
- name: CERT_MANAGER_CLUSTERIP
value: "cert-manager-webhook"
- name: CERT_MANAGER_PORT
value: "443"
command:
- sh
- -c
# The following shell script tests if the cert-manager service is up. If the service is up, when we try
# to wget its exposed port, we will get an HTTP error 400.
- |
wget_output=$(wget -q "$CERT_MANAGER_CLUSTERIP:$CERT_MANAGER_PORT")
if wget_output=="wget: server returned error: HTTP/1.0 400 Bad Request"
then exit 0
else exit 1
fi
restartPolicy: Never
{{- with .Values.affinity }}
affinity: {{ toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations: {{ toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector: {{ toYaml . | nindent 4 }}
{{- end }}
{{- end }}
@@ -0,0 +1,84 @@
{{ if .Values.kubeRBACProxy.enabled }}
---
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "opentelemetry-operator.fullname" . }}-metrics"
namespace: {{ .Release.Namespace }}
labels:
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
app.kubernetes.io/component: controller-manager
annotations:
"helm.sh/hook": test
spec:
containers:
- name: wget
image: "{{ .Values.testFramework.image.repository }}:{{ .Values.testFramework.image.tag }}"
env:
- name: MANAGER_METRICS_SERVICE_CLUSTERIP
value: "{{ include "opentelemetry-operator.fullname" . }}"
- name: MANAGER_METRICS_SERVICE_PORT
value: "{{ .Values.kubeRBACProxy.ports.proxyPort }}"
command:
- sh
- -c
# The following shell script tests if the controller-manager-metrics-service is up.
# If the service is up, when we try to wget its exposed port, we will get an HTTP error 400.
- |
wget_output=$(wget -q "$MANAGER_METRICS_SERVICE_CLUSTERIP:$MANAGER_METRICS_SERVICE_PORT")
if wget_output=="wget: server returned error: HTTP/1.0 400 Bad Request"
then exit 0
else exit 1
fi
restartPolicy: Never
{{- with .Values.affinity }}
affinity: {{ toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations: {{ toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector: {{ toYaml . | nindent 4 }}
{{- end }}
{{- end }}
---
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "opentelemetry-operator.fullname" . }}-webhook"
namespace: {{ .Release.Namespace }}
labels:
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
app.kubernetes.io/component: controller-manager
annotations:
"helm.sh/hook": test
spec:
containers:
- name: wget
image: "{{ .Values.testFramework.image.repository }}:{{ .Values.testFramework.image.tag }}"
env:
- name: WEBHOOK_SERVICE_CLUSTERIP
value: "{{ include "opentelemetry-operator.fullname" . }}-webhook"
- name: WEBHOOK_SERVICE_PORT
value: "{{ .Values.admissionWebhooks.servicePort }}"
command:
- sh
- -c
# The following shell script tests if the webhook service is up. If the service is up, when we try
# to wget its exposed port, we will get an HTTP error 400.
- |
wget_output=$(wget -q "$WEBHOOK_SERVICE_CLUSTERIP:$WEBHOOK_SERVICE_PORT")
if wget_output=="wget: server returned error: HTTP/1.0 400 Bad Request"
then exit 0
else exit 1
fi
restartPolicy: Never
{{- with .Values.affinity }}
affinity: {{ toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations: {{ toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector: {{ toYaml . | nindent 4 }}
{{- end }}
@@ -0,0 +1,38 @@
{{- if and (.Capabilities.APIVersions.Has "autoscaling.k8s.io/v1") (.Values.manager.verticalPodAutoscaler.enabled) }}
apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
name: {{ template "opentelemetry-operator.fullname" . }}-operator
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "opentelemetry-operator.name" . }}-operator
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
spec:
resourcePolicy:
containerPolicies:
- containerName: manager
{{- if .Values.manager.verticalPodAutoscaler.controlledResources }}
controlledResources: {{ .Values.manager.verticalPodAutoscaler.controlledResources }}
{{- end }}
{{- if .Values.manager.verticalPodAutoscaler.maxAllowed }}
maxAllowed:
{{- toYaml .Values.manager.verticalPodAutoscaler.maxAllowed | nindent 8 }}
{{- end }}
{{- if .Values.manager.verticalPodAutoscaler.minAllowed }}
minAllowed:
{{- toYaml .Values.manager.verticalPodAutoscaler.minAllowed | nindent 8 }}
{{- end }}
targetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ template "opentelemetry-operator.fullname" . }}
{{- if .Values.manager.verticalPodAutoscaler.updatePolicy }}
updatePolicy:
{{- if .Values.manager.verticalPodAutoscaler.updatePolicy.updateMode }}
updateMode: {{ .Values.manager.verticalPodAutoscaler.updatePolicy.updateMode }}
{{- end }}
{{- if .Values.manager.verticalPodAutoscaler.updatePolicy.minReplicas }}
minReplicas: {{ .Values.manager.verticalPodAutoscaler.updatePolicy.minReplicas }}
{{- end }}
{{- end }}
{{- end }}