Skip to content

Commit

Permalink
Resolve PodSecurityAdmission restrictions on 1.23+ for deprecated Pod…
Browse files Browse the repository at this point in the history
…SecurityPolicy

This commit fixes the issue where the securityContext are not restricted
in PodSecurityAdmission(PSA). This removes the PodSeucrityPolicy, which
is deprecated in Kubernetes v1.21 and removed from v1.25. This adds to the
PSA restricted label with respective policies enforced by PSP but not
covered by the restricted standard of PSA.
  • Loading branch information
JeromeJu committed Oct 18, 2022
1 parent 2b5b3bc commit 9694410
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 72 deletions.
1 change: 1 addition & 0 deletions config/100-namespace/100-namespace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ metadata:
labels:
app.kubernetes.io/instance: default
app.kubernetes.io/part-of: tekton-pipelines
pod-security.kubernetes.io/enforce: restricted
57 changes: 0 additions & 57 deletions config/101-podsecuritypolicy.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions config/200-clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,6 @@ rules:
# When there are changes to the configs or secrets, knative updates the validatingwebhook config
# with the updated certificates or the refreshed set of rules.
verbs: ["get", "update", "delete"]
- apiGroups: ["policy"]
resources: ["podsecuritypolicies"]
resourceNames: ["tekton-pipelines"]
verbs: ["use"]
- apiGroups: [""]
resources: ["namespaces"]
verbs: ["get"]
Expand Down
8 changes: 0 additions & 8 deletions config/200-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ rules:
resources: ["configmaps"]
verbs: ["get"]
resourceNames: ["config-logging", "config-observability", "config-artifact-bucket", "config-artifact-pvc", "feature-flags", "config-leader-election", "config-registry-cert"]
- apiGroups: ["policy"]
resources: ["podsecuritypolicies"]
resourceNames: ["tekton-pipelines"]
verbs: ["use"]
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
Expand Down Expand Up @@ -63,10 +59,6 @@ rules:
resources: ["secrets"]
verbs: ["get", "update"]
resourceNames: ["webhook-certs"]
- apiGroups: ["policy"]
resources: ["podsecuritypolicies"]
resourceNames: ["tekton-pipelines"]
verbs: ["use"]
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
Expand Down
5 changes: 4 additions & 1 deletion config/controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,13 @@ spec:
allowPrivilegeEscalation: false
capabilities:
drop:
- all
- "ALL"
# User 65532 is the nonroot user ID
runAsUser: 65532
runAsGroup: 65532
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
ports:
- name: metrics
containerPort: 9090
Expand Down
4 changes: 3 additions & 1 deletion config/resolvers/resolvers-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,6 @@ spec:
runAsNonRoot: true
capabilities:
drop:
- all
- "ALL"
seccompProfile:
type: RuntimeDefault
5 changes: 4 additions & 1 deletion config/webhook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,13 @@ spec:
allowPrivilegeEscalation: false
capabilities:
drop:
- all
- "ALL"
# User 65532 is the distroless nonroot user ID
runAsUser: 65532
runAsGroup: 65532
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
ports:
- name: metrics
containerPort: 9090
Expand Down
8 changes: 8 additions & 0 deletions kind1.23.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
name: kind1.23.12
nodes:
- role: control-plane
image: kindest/node:v1.23.12@sha256:9402cf1330bbd3a0d097d2033fa489b2abe40d479cc5ef47d0b6a6960613148a
- role: worker
image: kindest/node:v1.23.12@sha256:9402cf1330bbd3a0d097d2033fa489b2abe40d479cc5ef47d0b6a6960613148a

0 comments on commit 9694410

Please sign in to comment.