Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(helm): .Values.podLabels should not be included in the deployment selectors #558

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions helm/ngrok-operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ To uninstall the chart:

| Name | Description | Value |
| ------------------------------------ | ----------------------------------------------------------------------------------------- | ------- |
| `podAnnotations` | Used to apply custom annotations to the ingress pods. | `{}` |
| `podLabels` | Used to apply custom labels to the ingress pods. | `{}` |
| `podAnnotations` | Custom pod annotations to apply to all pods. | `{}` |
| `podLabels` | Custom pod labels to apply to all pods. | `{}` |
| `replicaCount` | The number of controllers to run. | `1` |
| `affinity` | Affinity for the controller pod assignment | `{}` |
| `podAffinityPreset` | Pod affinity preset. Ignored if `affinity` is set. Allowed values: `soft` or `hard` | `""` |
Expand Down
3 changes: 0 additions & 3 deletions helm/ngrok-operator/templates/agent/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ spec:
selector:
matchLabels:
{{- include "ngrok-operator.selectorLabels" . | nindent 6 }}
{{- if .Values.podLabels }}
{{- toYaml .Values.podLabels | nindent 6 }}
{{- end }}
app.kubernetes.io/component: {{ $component }}
template:
metadata:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ spec:
selector:
matchLabels:
{{- include "ngrok-operator.selectorLabels" . | nindent 6 }}
{{- if .Values.podLabels }}
{{- toYaml .Values.podLabels | nindent 6 }}
{{- end }}
app.kubernetes.io/component: {{ $component }}
template:
metadata:
Expand Down
3 changes: 0 additions & 3 deletions helm/ngrok-operator/templates/controller-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ spec:
selector:
matchLabels:
{{- include "ngrok-operator.selectorLabels" . | nindent 6 }}
{{- if .Values.podLabels }}
{{- toYaml .Values.podLabels | nindent 6 }}
{{- end }}
app.kubernetes.io/component: {{ $component }}
template:
metadata:
Expand Down
24 changes: 24 additions & 0 deletions helm/ngrok-operator/tests/agent/deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,27 @@ tests:
- it: Should match snapshot
asserts:
- matchSnapshot: {}
- it: Adds .Values.podLabels to the controller deployment podspec
set:
podLabels:
labelKey1: labelValue1
labelKey2: labelValue2
template: agent/deployment.yaml
asserts:
- isSubset:
path: spec.template.metadata.labels
content:
labelKey1: labelValue1
labelKey2: labelValue2
- it: Does not add .Values.podLabels to the controller deployment's selector
set:
podLabels:
labelKey1: labelValue1
labelKey2: labelValue2
template: agent/deployment.yaml
asserts:
- isNotSubset:
path: spec.selector.matchLabels
content:
labelKey1: labelValue1
labelKey2: labelValue2
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,27 @@ tests:
- equal:
path: metadata.name
value: RELEASE-NAME-ngrok-operator-bindings-forwarder
- it: Adds .Values.podLabels to the controller deployment podspec
set:
podLabels:
labelKey1: labelValue1
labelKey2: labelValue2
template: bindings-forwarder/deployment.yaml
asserts:
- isSubset:
path: spec.template.metadata.labels
content:
labelKey1: labelValue1
labelKey2: labelValue2
- it: Does not add .Values.podLabels to the controller deployment's selector
set:
podLabels:
labelKey1: labelValue1
labelKey2: labelValue2
template: bindings-forwarder/deployment.yaml
asserts:
- isNotSubset:
path: spec.selector.matchLabels
content:
labelKey1: labelValue1
labelKey2: labelValue2
26 changes: 26 additions & 0 deletions helm/ngrok-operator/tests/controller-deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -354,3 +354,29 @@ tests:
- equal:
path: spec.template.spec.priorityClassName
value: high-priority
- it: Adds .Values.podLabels to the controller deployment podspec
set:
podLabels:
labelKey1: labelValue1
labelKey2: labelValue2
template: controller-deployment.yaml
documentIndex: 0 # Document 0 is the deployment since its the first template
asserts:
- isSubset:
path: spec.template.metadata.labels
content:
labelKey1: labelValue1
labelKey2: labelValue2
- it: Does not add .Values.podLabels to the controller deployment's selector
set:
podLabels:
labelKey1: labelValue1
labelKey2: labelValue2
template: controller-deployment.yaml
documentIndex: 0 # Document 0 is the deployment since its the first template
asserts:
- isNotSubset:
path: spec.selector.matchLabels
content:
labelKey1: labelValue1
labelKey2: labelValue2
4 changes: 2 additions & 2 deletions helm/ngrok-operator/values.schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions helm/ngrok-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ clusterDomain: svc.cluster.local
##
## @section Operator Manager parameters
##
## @param podAnnotations Used to apply custom annotations to the ingress pods.
## @param podLabels Used to apply custom labels to the ingress pods.
## @param podAnnotations Custom pod annotations to apply to all pods.
## @param podLabels Custom pod labels to apply to all pods.
##
podAnnotations: {}
podLabels: {}
Expand Down
Loading