Skip to content

Commit

Permalink
[operator] populate labels and selector labels from helper definition…
Browse files Browse the repository at this point in the history
…s (#463)

Co-authored-by: Tyler Helmuth <[email protected]>
  • Loading branch information
edwintye and TylerHelmuth authored Nov 21, 2022
1 parent 3fc5f71 commit e322c86
Show file tree
Hide file tree
Showing 26 changed files with 95 additions and 27 deletions.
2 changes: 1 addition & 1 deletion charts/opentelemetry-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: opentelemetry-operator
version: 0.18.2
version: 0.18.3
description: OpenTelemetry Operator Helm chart for Kubernetes
type: application
home: https://opentelemetry.io/
Expand Down
6 changes: 3 additions & 3 deletions charts/opentelemetry-operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ _See [helm repo](https://helm.sh/docs/helm/helm_repo/) for command documentation

```console
$ helm install \
my-opentelemetry-operator open-telemetry/opentelemetry-operator
opentelemetry-operator open-telemetry/opentelemetry-operator
```

If you created a custom namespace, like in the TLS Certificate Requirement section above, you will need to specify the namespace with the `--namespace` helm option:

```console
$ helm install --namespace opentelemetry-operator-system \
my-opentelemetry-operator open-telemetry/opentelemetry-operator
opentelemetry-operator open-telemetry/opentelemetry-operator
```

_See [helm install](https://helm.sh/docs/helm/helm_install/) for command documentation._
Expand All @@ -52,7 +52,7 @@ _See [helm install](https://helm.sh/docs/helm/helm_install/) for command documen
The following command uninstalls the chart whose release name is my-opentelemetry-operator.

```console
$ helm uninstall my-opentelemetry-operator
$ helm uninstall opentelemetry-operator
```

_See [helm uninstall](https://helm.sh/docs/helm/helm_uninstall/) for command documentation._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ metadata:
annotations:
cert-manager.io/inject-ca-from: default/opentelemetry-operator-serving-cert
labels:
helm.sh/chart: opentelemetry-operator-0.18.3
app.kubernetes.io/name: opentelemetry-operator
app.kubernetes.io/version: "0.63.1"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: example
name: opentelemetry-operator-mutating-webhook-configuration
webhooks:
- admissionReviewVersions:
Expand Down Expand Up @@ -79,7 +83,11 @@ metadata:
annotations:
cert-manager.io/inject-ca-from: default/opentelemetry-operator-serving-cert
labels:
helm.sh/chart: opentelemetry-operator-0.18.3
app.kubernetes.io/name: opentelemetry-operator
app.kubernetes.io/version: "0.63.1"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: example
name: opentelemetry-operator-validating-webhook-configuration
webhooks:
- admissionReviewVersions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
labels:
helm.sh/chart: opentelemetry-operator-0.18.3
app.kubernetes.io/name: opentelemetry-operator
app.kubernetes.io/version: "0.63.1"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: example
name: opentelemetry-operator-serving-cert
namespace: default
spec:
Expand All @@ -24,7 +28,11 @@ apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
labels:
helm.sh/chart: opentelemetry-operator-0.18.3
app.kubernetes.io/name: opentelemetry-operator
app.kubernetes.io/version: "0.63.1"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: example
name: opentelemetry-operator-selfsigned-issuer
namespace: default
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
creationTimestamp: null
labels:
helm.sh/chart: opentelemetry-operator-0.18.3
app.kubernetes.io/name: opentelemetry-operator
app.kubernetes.io/version: "0.63.1"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: example
name: opentelemetry-operator-manager-role
rules:
- apiGroups:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
helm.sh/chart: opentelemetry-operator-0.18.3
app.kubernetes.io/name: opentelemetry-operator
app.kubernetes.io/version: "0.63.1"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: example
name: opentelemetry-operator-manager-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
Expand All @@ -20,7 +24,11 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
helm.sh/chart: opentelemetry-operator-0.18.3
app.kubernetes.io/name: opentelemetry-operator
app.kubernetes.io/version: "0.63.1"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: example
name: opentelemetry-operator-proxy-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ apiVersion: apps/v1
kind: Deployment
metadata:
labels:
helm.sh/chart: opentelemetry-operator-0.18.3
app.kubernetes.io/name: opentelemetry-operator
app.kubernetes.io/version: "0.63.1"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: example
control-plane: controller-manager
name: opentelemetry-operator-controller-manager
namespace: default
Expand All @@ -20,7 +24,11 @@ spec:
kubectl.kubernetes.io/default-container: manager

labels:
helm.sh/chart: opentelemetry-operator-0.18.3
app.kubernetes.io/name: opentelemetry-operator
app.kubernetes.io/version: "0.63.1"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: example
control-plane: controller-manager
spec:
hostNetwork: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
labels:
helm.sh/chart: opentelemetry-operator-0.18.3
app.kubernetes.io/name: opentelemetry-operator
app.kubernetes.io/version: "0.63.1"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: example
name: opentelemetry-operator-leader-election-role
namespace: default
rules:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
helm.sh/chart: opentelemetry-operator-0.18.3
app.kubernetes.io/name: opentelemetry-operator
app.kubernetes.io/version: "0.63.1"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: example
name: opentelemetry-operator-leader-election-rolebinding
namespace: default
roleRef:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ apiVersion: v1
kind: Service
metadata:
labels:
helm.sh/chart: opentelemetry-operator-0.18.2
helm.sh/chart: opentelemetry-operator-0.18.3
app.kubernetes.io/name: opentelemetry-operator
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.63.1"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: example
control-plane: controller-manager
name: opentelemetry-operator-controller-manager-metrics-service
namespace: default
Expand All @@ -32,7 +32,11 @@ apiVersion: v1
kind: Service
metadata:
labels:
helm.sh/chart: opentelemetry-operator-0.18.3
app.kubernetes.io/name: opentelemetry-operator
app.kubernetes.io/version: "0.63.1"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: example
name: opentelemetry-operator-webhook-service
namespace: default
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ metadata:
name: opentelemetry-operator-controller-manager
namespace: default
labels:
helm.sh/chart: opentelemetry-operator-0.18.3
app.kubernetes.io/name: opentelemetry-operator
app.kubernetes.io/version: "0.63.1"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: example
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ metadata:
name: "opentelemetry-operator-cert-manager-test-connection"
namespace: default
labels:
helm.sh/chart: opentelemetry-operator-0.18.3
app.kubernetes.io/name: opentelemetry-operator
app.kubernetes.io/version: "0.63.1"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: example
control-plane: controller-manager
annotations:
"helm.sh/hook": test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ metadata:
name: "opentelemetry-operator-controller-manager-metrics-test-connection"
namespace: default
labels:
helm.sh/chart: opentelemetry-operator-0.18.3
app.kubernetes.io/name: opentelemetry-operator
app.kubernetes.io/version: "0.63.1"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: example
control-plane: controller-manager
annotations:
"helm.sh/hook": test
Expand Down Expand Up @@ -38,6 +43,11 @@ metadata:
name: "opentelemetry-operator-webhook-test-connection"
namespace: default
labels:
helm.sh/chart: opentelemetry-operator-0.18.3
app.kubernetes.io/name: opentelemetry-operator
app.kubernetes.io/version: "0.63.1"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: example
control-plane: controller-manager
annotations:
"helm.sh/hook": test
Expand Down
2 changes: 1 addition & 1 deletion charts/opentelemetry-operator/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ helm.sh/chart: {{ include "opentelemetry-operator.chart" . }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "opentelemetry-operator.selectorLabels" -}}
app.kubernetes.io/name: {{ include "opentelemetry-operator.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
annotations:
cert-manager.io/inject-ca-from: {{ printf "%s/%s-serving-cert" .Release.Namespace (include "opentelemetry-operator.name" .) }}
labels:
app.kubernetes.io/name: opentelemetry-operator
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
name: {{ template "opentelemetry-operator.name" . }}-mutating-webhook-configuration
webhooks:
- admissionReviewVersions:
Expand Down Expand Up @@ -93,7 +93,7 @@ metadata:
annotations:
cert-manager.io/inject-ca-from: {{ printf "%s/%s-serving-cert" .Release.Namespace (include "opentelemetry-operator.name" .) }}
labels:
app.kubernetes.io/name: opentelemetry-operator
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
name: {{ template "opentelemetry-operator.name" . }}-validating-webhook-configuration
webhooks:
- admissionReviewVersions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
metadata:
labels:
app.kubernetes.io/name: opentelemetry-operator
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
name: {{ template "opentelemetry-operator.name" . }}-mutating-webhook-configuration
webhooks:
- admissionReviewVersions:
Expand Down Expand Up @@ -121,7 +121,7 @@ metadata:
annotations:
cert-manager.io/inject-ca-from: {{ printf "%s/%s-serving-cert" .Release.Namespace (include "opentelemetry-operator.name" .) }}
labels:
app.kubernetes.io/name: opentelemetry-operator
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
name: {{ template "opentelemetry-operator.name" . }}-validating-webhook-configuration
webhooks:
- admissionReviewVersions:
Expand Down
4 changes: 2 additions & 2 deletions charts/opentelemetry-operator/templates/certmanager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
labels:
app.kubernetes.io/name: opentelemetry-operator
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
name: {{ template "opentelemetry-operator.name" . }}-serving-cert
namespace: {{ .Release.Namespace }}
spec:
Expand All @@ -27,7 +27,7 @@ apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
labels:
app.kubernetes.io/name: opentelemetry-operator
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
name: {{ template "opentelemetry-operator.name" . }}-selfsigned-issuer
namespace: {{ .Release.Namespace }}
spec:
Expand Down
3 changes: 1 addition & 2 deletions charts/opentelemetry-operator/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/name: opentelemetry-operator
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
name: {{ template "opentelemetry-operator.name" . }}-manager-role
rules:
- apiGroups:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
app.kubernetes.io/name: opentelemetry-operator
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
name: {{ template "opentelemetry-operator.name" . }}-manager-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
Expand All @@ -20,7 +20,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
app.kubernetes.io/name: opentelemetry-operator
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
name: {{ template "opentelemetry-operator.name" . }}-proxy-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
Expand Down
6 changes: 3 additions & 3 deletions charts/opentelemetry-operator/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@ apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/name: opentelemetry-operator
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
control-plane: controller-manager
name: {{ template "opentelemetry-operator.name" . }}-controller-manager
namespace: {{ .Release.Namespace }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: opentelemetry-operator
{{- include "opentelemetry-operator.selectorLabels" . | nindent 6 }}
control-plane: controller-manager
template:
metadata:
annotations:
kubectl.kubernetes.io/default-container: manager
{{- include "opentelemetry-operator.podAnnotations" . | nindent 8 }}
labels:
app.kubernetes.io/name: opentelemetry-operator
{{- include "opentelemetry-operator.labels" . | nindent 8 }}
control-plane: controller-manager
spec:
hostNetwork: {{ .Values.hostNetwork }}
Expand Down
2 changes: 1 addition & 1 deletion charts/opentelemetry-operator/templates/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
labels:
app.kubernetes.io/name: opentelemetry-operator
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
name: {{ template "opentelemetry-operator.name" . }}-leader-election-role
namespace: {{ .Release.Namespace }}
rules:
Expand Down
2 changes: 1 addition & 1 deletion charts/opentelemetry-operator/templates/rolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
app.kubernetes.io/name: opentelemetry-operator
{{- include "opentelemetry-operator.labels" . | nindent 4 }}
name: {{ template "opentelemetry-operator.name" . }}-leader-election-rolebinding
namespace: {{ .Release.Namespace }}
roleRef:
Expand Down
Loading

0 comments on commit e322c86

Please sign in to comment.