Skip to content

Commit 3744878

Browse files
committed
Merge remote-tracking branch 'origin/main' into PROJ-1949-Utilise-opensearch-la-place-d-algolia
2 parents 9f164ba + 170e011 commit 3744878

File tree

5 files changed

+57
-33
lines changed

5 files changed

+57
-33
lines changed

k8s/projects-backend/Chart.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
dependencies:
22
- name: common
33
repository: oci://criprodprod.azurecr.io/helm
4-
version: 0.2.2
5-
digest: sha256:4acf4dc5eb4837691080a74c531fbd9799d460999ec61511d2675a2b961c88f4
6-
generated: "2024-08-08T11:31:39.945125013+02:00"
4+
version: 0.3.3
5+
digest: sha256:0ff29bcf57521c451eb9931a0bd014283f40c1c6dcbae6dec1e03d5ceb52778b
6+
generated: "2024-12-09T10:55:34.525875278+01:00"

k8s/projects-backend/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ appVersion: "1.16.0"
2525
dependencies:
2626
- name: common
2727
repository: oci://criprodprod.azurecr.io/helm
28-
version: 0.2.2
28+
version: 0.3.3

k8s/projects-backend/templates/ingress.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1+
{{- if .Values.traefik }}
2+
apiVersion: networking.k8s.io/v1
3+
kind: Ingress
4+
metadata:
5+
name: {{ tpl .Values.fullName . }}
6+
labels:
7+
{{- (tpl ($.Values.backend.commonLabels | toYaml ) $) | nindent 4 }}
8+
annotations:
9+
cert-manager.io/cluster-issuer: letsencrypt-prod-traefik
10+
kubernetes.io/ingress.class: traefik
11+
spec:
12+
rules:
13+
- host: {{ .Values.hostname }}
14+
http:
15+
paths:
16+
- path: {{ .Values.ingressPath }}
17+
pathType: Prefix
18+
backend:
19+
service:
20+
name: {{ tpl .Values.fullName . }}
21+
port:
22+
name: http
23+
tls:
24+
- hosts:
25+
- {{ .Values.hostname }}
26+
secretName: {{ printf "%s-tls" .Values.hostname }}
27+
{{- else }}
128
apiVersion: networking.k8s.io/v1
229
kind: Ingress
330
metadata:
@@ -24,3 +51,4 @@ spec:
2451
- hosts:
2552
- {{ .Values.hostname }}
2653
secretName: {{ printf "%s-tls" .Values.hostname }}
54+
{{- end }}

k8s/projects-backend/templates/network-policy.yaml

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,13 @@
1-
apiVersion: networking.k8s.io/v1
2-
kind: NetworkPolicy
3-
metadata:
4-
name: {{ tpl $.Values.fullName $ }}
5-
labels:
6-
{{- (tpl ($.Values.backend.commonLabels | toYaml ) $) | nindent 4 }}
7-
spec:
8-
podSelector:
9-
matchLabels:
10-
{{- (tpl ($.Values.backend.commonLabels | toYaml ) $) | nindent 6 }}
11-
policyTypes:
12-
- Ingress
13-
ingress:
14-
- from:
15-
# Incoming http traffic from nginx-ingress
16-
- namespaceSelector:
17-
matchLabels:
18-
kubernetes.io/metadata.name: ingress-nginx
19-
# Incoming traffic from projects namespace
20-
- namespaceSelector:
21-
matchLabels:
22-
kubernetes.io/metadata.name: {{ .Values.namespace }}
23-
# Incoming traffic from monitoring namespace
24-
- namespaceSelector:
25-
matchLabels:
26-
kubernetes.io/metadata.name: {{ .Values.monitoringNamespace }}
27-
ports:
28-
- protocol: TCP
29-
port: http
1+
{{ include "common.security.networkPolicy" (dict
2+
"name" (tpl .Values.fullName .)
3+
"podSelector" (dict "matchLabels" (tpl (.Values.backend.commonLabels | toJson) .| fromJson) )
4+
"allowFromReverseProxy" true
5+
"reverseProxyNamespace" (ternary "traefik" "ingress-nginx" .Values.traefik )
6+
"additionalIngresses" (get (tpl ((dict "root" .Values.backend.networkPolicyAdditionalIngresses) | toJson) . | fromJson) "root")
7+
"commonLabels" (tpl (.Values.backend.commonLabels | toJson) . | fromJson)
8+
"enableEgress" false
9+
) }}
10+
3011
---
3112
apiVersion: networking.k8s.io/v1
3213
kind: NetworkPolicy

k8s/projects-backend/values.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,19 @@ backend:
7575
minReplicas: 1
7676
maxReplicas: 4
7777
targetCPUUtilizationPercentage: 50
78+
networkPolicyAdditionalIngresses:
79+
- from:
80+
# Incoming traffic from projects namespace
81+
- namespaceSelector:
82+
matchLabels:
83+
kubernetes.io/metadata.name: "{{ .Values.namespace }}"
84+
# Incoming traffic from monitoring namespace
85+
- namespaceSelector:
86+
matchLabels:
87+
kubernetes.io/metadata.name: "{{ .Values.monitoringNamespace }}"
88+
ports:
89+
- protocol: TCP
90+
port: http
7891

7992
celery:
8093
enabled: true
@@ -158,3 +171,5 @@ workflow:
158171
templateName: create-db
159172

160173
runMigrations: true
174+
175+
traefik: false

0 commit comments

Comments
 (0)