Skip to content

Commit

Permalink
Labels
Browse files Browse the repository at this point in the history
  • Loading branch information
cvlc committed May 26, 2022
1 parent 4908ce7 commit de33393
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 3 deletions.
3 changes: 3 additions & 0 deletions charts/etcd-cluster-operator/MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@ The next step will then template various values in the `templates` directory to
sed -i templates/* -e 's/namespace: storageos-etcd/namespace: {{ .Release.Namespace }}/g' -e 's/storageos-etcd.svc/{{ .Release.Namespace }}.svc/g'
sed -i templates/Namespace-storageos-etcd.yml -e 's/name: storageos-etcd/name: {{ .Release.Namespace }}/g'
sed -i templates/* -e 's/storageos-etcd/{{ .Release.Name }}/g'
sed -i templates/*.yml -e '0,/labels:/{/labels:/d;}' -e '0,/metadata:/{s/metadata:/metadata:\n{{- template "etcd-cluster-operator.labels" . }}/}'
```

Be sure to update `appVersion` in `Chart.yaml` to the new version used of the operator.

When this is complete, we should rewrite `templates/etcdcluster_cr.yaml` with any changes. This one file is heavily templated for Helm to provide configurability and is correspondent to the file `storageos-etcd-cluster.yaml` from the above mentioned repository.

Before you commit, be sure to check the output of `git diff` and `helm template .` and ensure that the changes make sense.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
{{- template "etcd-cluster-operator.labels" . }}
creationTimestamp: null
name: {{ .Release.Name }}-manager-role
rules:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
{{- template "etcd-cluster-operator.labels" . }}
name: {{ .Release.Name }}-manager-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
{{- template "etcd-cluster-operator.labels" . }}
control-plane: controller-manager
name: {{ .Release.Name }}-controller-manager
namespace: {{ .Release.Namespace }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
{{- template "etcd-cluster-operator.labels" . }}
control-plane: proxy
name: {{ .Release.Name }}-proxy
namespace: {{ .Release.Namespace }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
apiVersion: v1
kind: Namespace
metadata:
{{- template "etcd-cluster-operator.labels" . }}
name: {{ .Values.cluster.namespace }}
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
{{- template "etcd-cluster-operator.labels" . }}
name: {{ .Release.Name }}-leader-election-role
namespace: {{ .Release.Namespace }}
rules:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
{{- template "etcd-cluster-operator.labels" . }}
name: {{ .Release.Name }}-leader-election-rolebinding
namespace: {{ .Release.Namespace }}
roleRef:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: v1
kind: Service
metadata:
labels:
{{- template "etcd-cluster-operator.labels" . }}
control-plane: proxy
name: {{ .Release.Name }}-proxy
namespace: {{ .Release.Namespace }}
Expand Down
8 changes: 8 additions & 0 deletions charts/etcd-cluster-operator/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{{- define "etcd-cluster-operator.labels" }}
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
{{- end }}

0 comments on commit de33393

Please sign in to comment.