Skip to content

Commit

Permalink
feat: add podLabels to helm charts (#627)
Browse files Browse the repository at this point in the history
Signed-off-by: Anish Ramasekar <[email protected]>
  • Loading branch information
aramase committed Nov 9, 2022
1 parent b382e9f commit 6a8e4bb
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ helm upgrade -n azure-workload-identity-system [RELEASE_NAME] azure-workload-ide

| Parameter | Description | Default |
| :---------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------ |
| labels | The labels to add to the azure-workload-identity webhook pods | `azure-workload-identity.io/system: "true"` |
| replicaCount | The number of azure-workload-identity replicas to deploy for the webhook | `2` |
| image.repository | Image repository | `mcr.microsoft.com/oss/azure/workload-identity/webhook` |
| image.pullPolicy | Image pullPolicy | `IfNotPresent` |
Expand All @@ -54,6 +53,7 @@ helm upgrade -n azure-workload-identity-system [RELEASE_NAME] azure-workload-ide
| priorityClassName | The priority class name for webhook manager | `system-cluster-critical` |
| mutatingWebhookObjectSelector | The label selector to further refine which namespaced resources will be selected by the webhook. | `` |
| mutatingWebhookAnnotations | The annotations to add to the MutatingWebhookConfiguration | `{}` |
| podLabels | The labels to add to the azure-workload-identity webhook pods | `{}` |

## Contributing Changes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,12 @@ Selector labels
app.kubernetes.io/name: {{ include "workload-identity-webhook.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Adds the pod labels.
*/}}
{{- define "workload-identity-webhook.podLabels" -}}
{{- if .Values.podLabels }}
{{- toYaml .Values.podLabels | nindent 8 }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ spec:
template:
metadata:
labels:
{{- include "workload-identity-webhook.podLabels" . }}
app: '{{ template "workload-identity-webhook.name" . }}'
azure-workload-identity.io/system: "true"
chart: '{{ template "workload-identity-webhook.name" . }}'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

labels:
azure-workload-identity.io/system: "true"
replicaCount: 2
image:
repository: mcr.microsoft.com/oss/azure/workload-identity/webhook
Expand Down Expand Up @@ -36,3 +34,4 @@ mutatingWebhookFailurePolicy: Ignore
priorityClassName: system-cluster-critical
mutatingWebhookObjectSelector: {}
mutatingWebhookAnnotations: {}
podLabels: {}
4 changes: 4 additions & 0 deletions third_party/open-policy-agent/gatekeeper/helmify/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ func (ks *kindSet) Write() error {
destFile := path.Join(*outputDir, subPath, fileName)
fmt.Printf("Writing %s\n", destFile)

if kind == "Deployment" {
obj = strings.Replace(obj, " labels:", " labels:\n{{- include \"workload-identity-webhook.podLabels\" . }}", 1)
}

if err := os.WriteFile(destFile, []byte(obj), 0600); err != nil {
return err
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ helm upgrade -n azure-workload-identity-system [RELEASE_NAME] azure-workload-ide

| Parameter | Description | Default |
| :---------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------ |
| labels | The labels to add to the azure-workload-identity webhook pods | `azure-workload-identity.io/system: "true"` |
| replicaCount | The number of azure-workload-identity replicas to deploy for the webhook | `2` |
| image.repository | Image repository | `mcr.microsoft.com/oss/azure/workload-identity/webhook` |
| image.pullPolicy | Image pullPolicy | `IfNotPresent` |
Expand All @@ -54,6 +53,7 @@ helm upgrade -n azure-workload-identity-system [RELEASE_NAME] azure-workload-ide
| priorityClassName | The priority class name for webhook manager | `system-cluster-critical` |
| mutatingWebhookObjectSelector | The label selector to further refine which namespaced resources will be selected by the webhook. | `` |
| mutatingWebhookAnnotations | The annotations to add to the MutatingWebhookConfiguration | `{}` |
| podLabels | The labels to add to the azure-workload-identity webhook pods | `{}` |

## Contributing Changes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,12 @@ Selector labels
app.kubernetes.io/name: {{ include "workload-identity-webhook.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Adds the pod labels.
*/}}
{{- define "workload-identity-webhook.podLabels" -}}
{{- if .Values.podLabels }}
{{- toYaml .Values.podLabels | nindent 8 }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

labels:
azure-workload-identity.io/system: "true"
replicaCount: 2
image:
repository: mcr.microsoft.com/oss/azure/workload-identity/webhook
Expand Down Expand Up @@ -36,3 +34,4 @@ mutatingWebhookFailurePolicy: Ignore
priorityClassName: system-cluster-critical
mutatingWebhookObjectSelector: {}
mutatingWebhookAnnotations: {}
podLabels: {}

0 comments on commit 6a8e4bb

Please sign in to comment.