Skip to content

Commit

Permalink
[FEAT] added labels and annotations for pods (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
skrishnan-sap authored Sep 30, 2024
1 parent 7466a68 commit 8b9e336
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 2 deletions.
2 changes: 1 addition & 1 deletion chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
description: Helm chart to deploy CAP Operator https://sap.github.io/cap-operator/
name: cap-operator
version: 0.10.0
version: 0.10.1
appVersion: 0.10.0
11 changes: 10 additions & 1 deletion chart/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# cap-operator

![Version: 0.10.0](https://img.shields.io/badge/Version-0.10.0-informational?style=flat-square) ![AppVersion: 0.10.0](https://img.shields.io/badge/AppVersion-0.10.0-informational?style=flat-square)
![Version: 0.10.1](https://img.shields.io/badge/Version-0.10.1-informational?style=flat-square) ![AppVersion: 0.10.0](https://img.shields.io/badge/AppVersion-0.10.0-informational?style=flat-square)

Helm chart to deploy CAP Operator https://sap.github.io/cap-operator/

Expand All @@ -17,11 +17,15 @@ Helm chart to deploy CAP Operator https://sap.github.io/cap-operator/
| tolerations | list | `[]` | Default tolerations (can be overwritten on component level) |
| priorityClassName | string | `""` | Default priority class (can be overwritten on component level) |
| topologySpreadConstraints | list | `[]` | Default topology spread constraints (can be overwritten on component level) |
| podLabels | object | `{}` | Additional pod labels for all components |
| podAnnotations | object | `{}` | Additional pod annotations for all components |
| controller.replicas | int | `1` | Replicas |
| controller.image.repository | string | `"ghcr.io/sap/cap-operator/controller"` | Image repository |
| controller.image.tag | string | `""` | Image tag |
| controller.image.pullPolicy | string | `""` | Image pull policy |
| controller.imagePullSecrets | list | `[]` | Image pull secrets |
| controller.podLabels | object | `{}` | Additional labels for controller pods |
| controller.podAnnotations | object | `{}` | Additional annotations for controller pods |
| controller.podSecurityContext | object | `{}` | Pod security content |
| controller.nodeSelector | object | `{}` | Node selector |
| controller.affinity | object | `{}` | Affinity settings |
Expand All @@ -44,6 +48,8 @@ Helm chart to deploy CAP Operator https://sap.github.io/cap-operator/
| subscriptionServer.image.tag | string | `""` | Image tag |
| subscriptionServer.image.pullPolicy | string | `""` | Image pull policy |
| subscriptionServer.imagePullSecrets | list | `[]` | Image pull secrets |
| subscriptionServer.podLabels | object | `{}` | Additional labels for subscription server pods |
| subscriptionServer.podAnnotations | object | `{}` | Additional annotations for subscription server pods |
| subscriptionServer.podSecurityContext | object | `{}` | Pod security content |
| subscriptionServer.nodeSelector | object | `{}` | Node selector |
| subscriptionServer.affinity | object | `{}` | Affinity settings |
Expand All @@ -68,6 +74,8 @@ Helm chart to deploy CAP Operator https://sap.github.io/cap-operator/
| webhook.image.tag | string | `""` | Image tag |
| webhook.image.pullPolicy | string | `""` | Image pull policy |
| webhook.imagePullSecrets | list | `[]` | Image pull secrets |
| webhook.podLabels | object | `{}` | Additional labels for validating webhook pods |
| webhook.podAnnotations | object | `{}` | Additional annotations for validating webhook pods |
| webhook.podSecurityContext | object | `{}` | Pod security content |
| webhook.nodeSelector | object | `{}` | Node selector |
| webhook.affinity | object | `{}` | Affinity settings |
Expand All @@ -83,3 +91,4 @@ Helm chart to deploy CAP Operator https://sap.github.io/cap-operator/
| webhook.service.type | string | `"ClusterIP"` | Service type |
| webhook.service.port | int | `443` | Service port |
| webhook.service.targetPort | int | `1443` | Target port |

11 changes: 11 additions & 0 deletions chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{- define "utils.maps.merge" -}}
{{- $workMap := dict -}}
{{- if kindIs "slice" . -}}
{{- range . -}}
{{- $workMap = merge $workMap . -}}
{{- end -}}
{{- end -}}
{{- if gt (len $workMap) 0 -}}
{{ toYaml $workMap }}
{{- end -}}
{{- end -}}
10 changes: 10 additions & 0 deletions chart/templates/controller-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,22 @@ spec:
operator.sme.sap.com/app: controller
operator.sme.sap.com/category: controller
operator.sme.sap.com/release: {{.Release.Name}}
{{- if or (gt (len .Values.podLabels) 0) (gt (len .Values.controller.podLabels) 0) }}
{{- include "utils.maps.merge" (list .Values.podLabels .Values.controller.podLabels) | trim | nindent 6 }}
{{- end }}
template:
metadata:
labels:
operator.sme.sap.com/app: controller
operator.sme.sap.com/category: controller
operator.sme.sap.com/release: {{.Release.Name}}
{{- if or (gt (len .Values.podLabels) 0) (gt (len .Values.controller.podLabels) 0) }}
{{- include "utils.maps.merge" (list .Values.podLabels .Values.controller.podLabels) | trim | nindent 8 }}
{{- end }}
{{- if or (gt (len .Values.podAnnotations) 0) (gt (len .Values.controller.podAnnotations) 0) }}
annotations:
{{- include "utils.maps.merge" (list .Values.podAnnotations .Values.controller.podAnnotations) | trim | nindent 8 }}
{{- end }}
spec:
{{- with .Values.controller.imagePullSecrets | default .Values.imagePullSecrets }}
imagePullSecrets:
Expand Down
10 changes: 10 additions & 0 deletions chart/templates/server-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,22 @@ spec:
operator.sme.sap.com/app: subscription-server
operator.sme.sap.com/category: controller
operator.sme.sap.com/release: {{.Release.Name}}
{{- if or (gt (len .Values.podLabels) 0) (gt (len .Values.subscriptionServer.podLabels) 0) }}
{{- include "utils.maps.merge" (list .Values.podLabels .Values.subscriptionServer.podLabels) | trim | nindent 6 }}
{{- end }}
template:
metadata:
labels:
operator.sme.sap.com/app: subscription-server
operator.sme.sap.com/category: controller
operator.sme.sap.com/release: {{.Release.Name}}
{{- if or (gt (len .Values.podLabels) 0) (gt (len .Values.subscriptionServer.podLabels) 0) }}
{{- include "utils.maps.merge" (list .Values.podLabels .Values.subscriptionServer.podLabels) | trim | nindent 8 }}
{{- end }}
{{- if or (gt (len .Values.podAnnotations) 0) (gt (len .Values.subscriptionServer.podAnnotations) 0) }}
annotations:
{{- include "utils.maps.merge" (list .Values.podAnnotations .Values.subscriptionServer.podAnnotations) | trim | nindent 8 }}
{{- end }}
spec:
{{- with .Values.subscriptionServer.imagePullSecrets | default .Values.imagePullSecrets }}
imagePullSecrets:
Expand Down
10 changes: 10 additions & 0 deletions chart/templates/webhook-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,22 @@ spec:
operator.sme.sap.com/app: webhook
operator.sme.sap.com/category: controller
operator.sme.sap.com/release: {{.Release.Name}}
{{- if or (gt (len .Values.podLabels) 0) (gt (len .Values.webhook.podLabels) 0) }}
{{- include "utils.maps.merge" (list .Values.podLabels .Values.webhook.podLabels) | trim | nindent 6 }}
{{- end }}
template:
metadata:
labels:
operator.sme.sap.com/app: webhook
operator.sme.sap.com/category: controller
operator.sme.sap.com/release: {{.Release.Name}}
{{- if or (gt (len .Values.podLabels) 0) (gt (len .Values.webhook.podLabels) 0) }}
{{- include "utils.maps.merge" (list .Values.podLabels .Values.webhook.podLabels) | trim | nindent 8 }}
{{- end }}
{{- if or (gt (len .Values.podAnnotations) 0) (gt (len .Values.webhook.podAnnotations) 0) }}
annotations:
{{- include "utils.maps.merge" (list .Values.podAnnotations .Values.webhook.podAnnotations) | trim | nindent 8 }}
{{- end }}
spec:
{{- with .Values.webhook.imagePullSecrets | default .Values.imagePullSecrets }}
imagePullSecrets:
Expand Down
16 changes: 16 additions & 0 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ tolerations: []
priorityClassName: ""
# -- Default topology spread constraints (can be overwritten on component level)
topologySpreadConstraints: []
# -- Additional pod labels for all components
podLabels: {}
# -- Additional pod annotations for all components
podAnnotations: {}

controller:
# -- Replicas
Expand All @@ -30,6 +34,10 @@ controller:
pullPolicy: ""
# -- Image pull secrets
imagePullSecrets: []
# -- Additional labels for controller pods
podLabels: {}
# -- Additional annotations for controller pods
podAnnotations: {}
# -- Pod security content
podSecurityContext: {}
# -- Node selector
Expand Down Expand Up @@ -81,6 +89,10 @@ subscriptionServer:
pullPolicy: ""
# -- Image pull secrets
imagePullSecrets: []
# -- Additional labels for subscription server pods
podLabels: {}
# -- Additional annotations for subscription server pods
podAnnotations: {}
# -- Pod security content
podSecurityContext: {}
# -- Node selector
Expand Down Expand Up @@ -137,6 +149,10 @@ webhook:
pullPolicy: ""
# -- Image pull secrets
imagePullSecrets: []
# -- Additional labels for validating webhook pods
podLabels: {}
# -- Additional annotations for validating webhook pods
podAnnotations: {}
# -- Pod security content
podSecurityContext: {}
# -- Node selector
Expand Down

0 comments on commit 8b9e336

Please sign in to comment.