Skip to content

Commit

Permalink
fix(helm): .Values.podLabels should not be included in the deployment…
Browse files Browse the repository at this point in the history
… selectors
  • Loading branch information
jonstacks committed Dec 18, 2024
1 parent 3038976 commit 365b219
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 15 deletions.
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
24 changes: 24 additions & 0 deletions helm/ngrok-operator/tests/bindings-forwarder/deployment_test.yaml
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

0 comments on commit 365b219

Please sign in to comment.