Skip to content

Commit

Permalink
feat(helm-chart): add annotations and labels to resources (#51)
Browse files Browse the repository at this point in the history
* feat: add default labels to ClusterRole and ClusterRoleBinding

* feat: add ability to specify annotations for service

* feat: add ability to specify labels for Ingress, Service & ServiceAccount

* fix: add missing serviceAccount.annotations to values.yaml
  • Loading branch information
druchoo authored Jan 14, 2024
1 parent b31289c commit 9d75e0d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions charts/komoplane/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ metadata:
name: {{ $fullName }}
labels:
{{- include "app.labels" . | nindent 4 }}
{{- with .Values.ingress.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
Expand Down
7 changes: 7 additions & 0 deletions charts/komoplane/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ metadata:
name: {{ include "app.fullname" . }}
labels:
{{- include "app.labels" . | nindent 4 }}
{{- with .Values.service.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.service.type }}
ports:
Expand Down
7 changes: 7 additions & 0 deletions charts/komoplane/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ metadata:
name: {{ include "app.serviceAccountName" . }}
labels:
{{- include "app.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
Expand All @@ -15,6 +18,8 @@ kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ include "app.serviceAccountName" . }}
labels:
{{- include "app.labels" . | nindent 4 }}
rules:
- apiGroups: ["*"]
resources: ["*"]
Expand All @@ -24,6 +29,8 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "app.serviceAccountName" . }}
labels:
{{- include "app.labels" . | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
Expand Down
5 changes: 5 additions & 0 deletions charts/komoplane/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ serviceAccount:
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: ""
annotations: { }
labels: { }

resources:
requests:
Expand Down Expand Up @@ -63,11 +65,14 @@ securityContext:
service:
type: ClusterIP
port: 8090
annotations: { }
labels: { }

ingress:
enabled: false
className: ""
annotations: { }
labels: { }
hosts:
- host: chart-example.local
paths:
Expand Down

0 comments on commit 9d75e0d

Please sign in to comment.