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: Separate project's and core app ingress annotations #511

Merged
merged 4 commits into from
Dec 3, 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
1 change: 1 addition & 0 deletions helm/flowforge/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ For other values please refer to the documentation below.
- `forge.projectNetworkPolicy.enabled` specified if [Network Policies](https://kubernetes.io/docs/concepts/services-networking/network-policies/) should be created for project pods ( default `false`)
- `forge.projectNetworkPolicy.ingress` a list of ingress rules for the [Network Policy](https://kubernetes.io/docs/concepts/services-networking/network-policies/) applied on project pods ( default `[]`)
- `forge.projectNetworkPolicy.egress` a list of egress rules for the [Network Policy](https://kubernetes.io/docs/concepts/services-networking/network-policies/) applied in project pods ( default `[]`)
- `forge.projectIngressAnnotations` ingress annotations for project instances (default is `{}`)
- `forge.managementSelector` a collection of labels and values to filter nodes the Forge App will run on (default `role: management`)
- `forge.affinity` allows to configure [affinity or anti-affinity](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity) for the core application pod
- `forge.license` FlowForge EE license string (optional, default not set)
Expand Down
5 changes: 4 additions & 1 deletion helm/flowforge/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ spec:
{{ end -}}
imagePullPolicy: Always
env:
{{- if .Values.ingress.annotations }}
{{- if .Values.forge.projectIngressAnnotations }}
- name: INGRESS_ANNOTATIONS
value: {{ .Values.forge.projectIngressAnnotations | toJson | quote }}
{{- else if .Values.ingress.annotations }}
- name: INGRESS_ANNOTATIONS
value: {{ .Values.ingress.annotations | toJson | quote }}
{{- end }}
Expand Down
36 changes: 35 additions & 1 deletion helm/flowforge/tests/deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ tests:
count: 1
- isKind:
of: Deployment

- it: should create a deployment with init container
template: deployment.yaml
asserts:
Expand All @@ -38,4 +39,37 @@ tests:
value: SMTPPASSWORD
- equal:
path: spec.template.spec.initContainers[0].env[*].valueFrom.secretKeyRef.name
value: flowfuse-secrets
value: flowfuse-secrets

- it: should create a deployment without INGRESS_ANNOTATIONS environmental variable
template: deployment.yaml
asserts:
- notExists:
path: spec.template.spec.containers[0].env[?(@.name == "INGRESS_ANNOTATIONS")]

- it: should create container with INGRESS_ANNOTATIONS env and value from `ingress.annotations`
template: deployment.yaml
set:
ingress.annotations:
customIngressAnnotation: "true"
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: INGRESS_ANNOTATIONS
value: '{"customIngressAnnotation":"true"}'

- it: should create container with INGRESS_ANNOTATIONS env and value `forge.projectIngressAnnotations`
template: deployment.yaml
set:
ingress.annotations:
customIngressAnnotation: "false"
forge.projectIngressAnnotations:
customProjectAnnotation: "true"
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: INGRESS_ANNOTATIONS
value: '{"customProjectAnnotation":"true"}'

3 changes: 3 additions & 0 deletions helm/flowforge/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@
},
"default": []
},
"projectIngressAnnotations": {
"type": "object"
},
"managementSelector": {
"type": "object"
},
Expand Down
1 change: 1 addition & 0 deletions helm/flowforge/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ forge:
projectDeploymentTolerations: []
projectNetworkPolicy:
enabled: false
projectIngressAnnotations: {}
managementSelector:
role: management
telemetry:
Expand Down
Loading