Skip to content

Commit 59ab202

Browse files
authored
Prepare for k8s 1.25 (#218)
* Use registry gsoci * Use namespace value from .Release.Namespace * Add PSS switch * Render service account independent from PSP * Remove imagePullPolicy * Add security settings * Add .global.podSecurityStandards.enforced to values * Add ORIGIN variable * Remove 'https://' from ORIGINS dummy value * Remove quotes
1 parent 883f6dd commit 59ab202

9 files changed

+50
-21
lines changed

helm/handbook/templates/handbook-deployment.yaml

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: apps/v1
22
kind: Deployment
33
metadata:
4-
namespace: intranet
4+
namespace: {{ .Release.Namespace }}
55
name: handbook
66
labels:
77
app: handbook
@@ -19,6 +19,8 @@ spec:
1919
spec:
2020
securityContext:
2121
runAsUser: 1000
22+
seccompProfile:
23+
type: RuntimeDefault
2224
affinity:
2325
podAntiAffinity:
2426
preferredDuringSchedulingIgnoredDuringExecution:
@@ -30,8 +32,15 @@ spec:
3032
weight: 100
3133
containers:
3234
- name: handbook
33-
image: quay.io/giantswarm/handbook:{{ .Chart.Version }}
34-
imagePullPolicy: Always
35+
image: gsoci.azurecr.io/giantswarm/handbook:{{ .Chart.Version }}
36+
securityContext:
37+
allowPrivilegeEscalation: false
38+
runAsNonRoot: true
39+
seccompProfile:
40+
type: RuntimeDefault
41+
capabilities:
42+
drop:
43+
- ALL
3544
ports:
3645
- containerPort: 8080
3746
name: http

helm/handbook/templates/handbook-service.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
kind: Service
22
apiVersion: v1
33
metadata:
4-
namespace: intranet
4+
namespace: {{ .Release.Namespace }}
55
name: handbook
66
labels:
77
app: handbook

helm/handbook/templates/ingress.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: networking.k8s.io/v1
22
kind: Ingress
33
metadata:
4-
namespace: intranet
4+
namespace: {{ .Release.Namespace }}
55
name: handbook
66
labels:
77
app: handbook

helm/handbook/templates/pdb.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: policy/v1
22
kind: PodDisruptionBudget
33
metadata:
44
name: handbook
5-
namespace: intranet
5+
namespace: {{ .Release.Namespace }}
66
spec:
77
minAvailable: 1
88
selector:

helm/handbook/templates/psp-rbac.yaml

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{- if not (((.Values.global).podSecurityStandards).enforced) }}
12
---
23
apiVersion: policy/v1beta1
34
kind: PodSecurityPolicy
@@ -24,17 +25,11 @@ spec:
2425
- configMap
2526
- emptyDir
2627
---
27-
apiVersion: v1
28-
kind: ServiceAccount
29-
metadata:
30-
namespace: intranet
31-
name: handbook
32-
---
3328
apiVersion: rbac.authorization.k8s.io/v1
3429
kind: Role
3530
metadata:
3631
name: handbook
37-
namespace: intranet
32+
namespace: {{ .Release.Namespace }}
3833
rules:
3934
- apiGroups:
4035
- extensions
@@ -49,12 +44,13 @@ apiVersion: rbac.authorization.k8s.io/v1
4944
kind: RoleBinding
5045
metadata:
5146
name: handbook
52-
namespace: intranet
47+
namespace: {{ .Release.Namespace }}
5348
roleRef:
5449
apiGroup: rbac.authorization.k8s.io
5550
kind: Role
5651
name: handbook
5752
subjects:
5853
- kind: ServiceAccount
5954
name: handbook
60-
namespace: intranet
55+
namespace: {{ .Release.Namespace }}
56+
{{- end }}

helm/handbook/templates/sa.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
apiVersion: v1
3+
kind: ServiceAccount
4+
metadata:
5+
name: handbook
6+
namespace: {{ .Release.Namespace }}

helm/handbook/templates/staticjscms-deployment.yaml

+16-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: apps/v1
22
kind: Deployment
33
metadata:
4-
namespace: intranet
4+
namespace: {{ .Release.Namespace }}
55
name: staticjscms-hugo-standalone
66
labels:
77
app: staticjscms-hugo-standalone
@@ -19,6 +19,8 @@ spec:
1919
spec:
2020
securityContext:
2121
runAsUser: 1000
22+
seccompProfile:
23+
type: RuntimeDefault
2224
affinity:
2325
podAntiAffinity:
2426
preferredDuringSchedulingIgnoredDuringExecution:
@@ -31,8 +33,20 @@ spec:
3133
containers:
3234
- name: staticjscms-hugo-standalone
3335
image: gsoci.azurecr.io/giantswarm/staticjscms-hugo-standalone:{{ .Values.staticJsCmsHugoStandaloneVersion }}
34-
imagePullPolicy: Always
36+
securityContext:
37+
allowPrivilegeEscalation: false
38+
runAsNonRoot: true
39+
seccompProfile:
40+
type: RuntimeDefault
41+
capabilities:
42+
drop:
43+
- ALL
3544
env:
45+
- name: ORIGIN
46+
valueFrom:
47+
secretKeyRef:
48+
name: staticjscms-secret
49+
key: ORIGINS
3650
- name: ORIGINS
3751
valueFrom:
3852
secretKeyRef:

helm/handbook/templates/staticjscms-service.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
kind: Service
22
apiVersion: v1
33
metadata:
4-
namespace: intranet
4+
namespace: {{ .Release.Namespace }}
55
name: staticjscms-hugo-standalone
66
labels:
77
app: staticjscms-hugo-standalone

helm/handbook/values.yaml

+7-3
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ secrets:
55
- name: staticjscms-secret
66
data:
77
- key: ORIGINS
8-
value: "aHR0cHM6Ly9oYW5kYm9vay5naWFudHN3YXJtLmlv"
8+
value: aGFuZGJvb2suZ2lhbnRzd2FybS5pbw==
99
- key: OAUTH_CLIENT_ID
10-
value: "MjE5OTEyMzk5MWFzZGVhZGJlZWY="
10+
value: MjE5OTEyMzk5MWFzZGVhZGJlZWY=
1111
- key: OAUTH_CLIENT_SECRET
12-
value: "YWFkc3NhZGFkYWRhZGFkMTIzMTIzMTIzMWFkYWRhZDEyMzEyM2FiYw=="
12+
value: YWFkc3NhZGFkYWRhZGFkMTIzMTIzMTIzMWFkYWRhZDEyMzEyM2FiYw==
1313
- key: GIT_HOSTNAME
1414
value: ""
1515
- name: cms-config
@@ -29,3 +29,7 @@ volumeMounts:
2929
- name: cms-config
3030
mountPath: "/app/config.yml"
3131
subPath: "config.yml"
32+
33+
global:
34+
podSecurityStandards:
35+
enforced: false

0 commit comments

Comments
 (0)