Skip to content

Commit

Permalink
add commonLabels to be applied to all created resources
Browse files Browse the repository at this point in the history
  • Loading branch information
Bassem, DEBBABI committed Dec 18, 2023
1 parent f7ec974 commit c25b4f5
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
{{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }}
name: {{ template "fencing.fullname" . }}-controller
spec:
replicas: {{ .Values.controller.replicas }}
Expand All @@ -12,7 +14,8 @@ spec:
template:
metadata:
labels:
app: {{ template "fencing.fullname" . }}-controller
app: {{ template "fencing.fullname" . }}-controller
{{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 8 }}{{- end }}
spec:
{{- with .Values.controller.nodeSelector }}
nodeSelector:
Expand Down
10 changes: 10 additions & 0 deletions deploy/helm/kube-fencing/templates/controller-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
{{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }}
name: {{ template "fencing.fullname" . }}-controller
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
labels:
{{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }}
name: {{ template "fencing.fullname" . }}-controller
rules:
- apiGroups: ["batch", "extensions"]
Expand All @@ -32,6 +36,8 @@ rules:
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
labels:
{{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }}
name: {{ template "fencing.fullname" . }}-controller
subjects:
- kind: ServiceAccount
Expand All @@ -45,6 +51,8 @@ roleRef:
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
labels:
{{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }}
name: {{ template "fencing.fullname" . }}-controller
rules:
- apiGroups: [""]
Expand All @@ -66,6 +74,8 @@ rules:
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
labels:
{{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }}
name: {{ template "fencing.fullname" . }}-controller
roleRef:
apiGroup: rbac.authorization.k8s.io
Expand Down
2 changes: 2 additions & 0 deletions deploy/helm/kube-fencing/templates/podsecuritypolicy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
labels:
{{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }}
name: {{ template "fencing.fullname" . }}
annotations:
seccomp.security.alpha.kubernetes.io/allowedProfileNames: '*'
Expand Down
3 changes: 3 additions & 0 deletions deploy/helm/kube-fencing/templates/switcher-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
labels:
{{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }}
name: {{ template "fencing.fullname" . }}-switcher
spec:
selector:
Expand All @@ -12,6 +14,7 @@ spec:
metadata:
labels:
app: {{ template "fencing.fullname" . }}-switcher
{{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 8 }}{{- end }}
spec:
{{- with .Values.switcher.nodeSelector }}
nodeSelector:
Expand Down
10 changes: 10 additions & 0 deletions deploy/helm/kube-fencing/templates/switcher-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
{{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }}
name: {{ template "fencing.fullname" . }}-switcher
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
labels:
{{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }}
name: {{ template "fencing.fullname" . }}-switcher
rules:
- apiGroups: [""]
Expand All @@ -17,6 +21,8 @@ rules:
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
labels:
{{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }}
name: {{ template "fencing.fullname" . }}-switcher
roleRef:
apiGroup: rbac.authorization.k8s.io
Expand All @@ -31,6 +37,8 @@ subjects:
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
labels:
{{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }}
name: {{ template "fencing.fullname" . }}-switcher
rules:
- apiGroups: ["extensions"]
Expand All @@ -41,6 +49,8 @@ rules:
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
labels:
{{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }}
name: {{ template "fencing.fullname" . }}-switcher
roleRef:
kind: Role
Expand Down
2 changes: 2 additions & 0 deletions deploy/helm/kube-fencing/values.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Labels to apply to all resources
commonLabels: {}
# ------------------------------------------------------------------------------
# fencing-controller watches for the failed nodes and initializates fencing
# process
Expand Down

0 comments on commit c25b4f5

Please sign in to comment.