Skip to content

Commit

Permalink
Deploy webhook in pod admission restricted mode
Browse files Browse the repository at this point in the history
Signed-off-by: Pat Riehecky <riehecky@fnal.gov>
  • Loading branch information
jcpunk committed May 16, 2023
1 parent b692c69 commit 9f05407
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
4 changes: 4 additions & 0 deletions config/webhook/0-namespace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ apiVersion: v1
kind: Namespace
metadata:
name: gateway-system
labels:
pod-security.kubernetes.io/enforce: restricted
pod-security.kubernetes.io/audit: restricted
pod-security.kubernetes.io/warn: restricted
9 changes: 9 additions & 0 deletions config/webhook/admission_webhook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,16 @@ spec:
mountPath: /etc/certs
readOnly: true
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 65532
runAsGroup: 65532
capabilities:
drop:
- "ALL"
seccompProfile:
type: RuntimeDefault
volumes:
- name: webhook-certs
secret:
Expand Down
24 changes: 24 additions & 0 deletions config/webhook/certificate_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,23 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 2000
runAsGroup: 2000
capabilities:
drop:
- "ALL"
seccompProfile:
type: RuntimeDefault
restartPolicy: OnFailure
serviceAccountName: gateway-api-admission
securityContext:
runAsNonRoot: true
runAsUser: 2000
runAsGroup: 2000
---
apiVersion: batch/v1
kind: Job
Expand Down Expand Up @@ -137,8 +149,20 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 2000
runAsGroup: 2000
capabilities:
drop:
- "ALL"
seccompProfile:
type: RuntimeDefault
restartPolicy: OnFailure
serviceAccountName: gateway-api-admission
securityContext:
runAsNonRoot: true
runAsUser: 2000
runAsGroup: 2000

0 comments on commit 9f05407

Please sign in to comment.