diff --git a/magnum/drivers/common/templates/kubernetes/fragments/flannel-service.sh b/magnum/drivers/common/templates/kubernetes/fragments/flannel-service.sh index 093933340a..abb2497761 100644 --- a/magnum/drivers/common/templates/kubernetes/fragments/flannel-service.sh +++ b/magnum/drivers/common/templates/kubernetes/fragments/flannel-service.sh @@ -14,62 +14,11 @@ if [ "$NETWORK_DRIVER" = "flannel" ]; then set +x cat << EOF > ${FLANNEL_DEPLOY} --- -apiVersion: policy/v1beta1 -kind: PodSecurityPolicy -metadata: - name: psp.flannel.unprivileged - annotations: - seccomp.security.alpha.kubernetes.io/allowedProfileNames: docker/default - seccomp.security.alpha.kubernetes.io/defaultProfileName: docker/default - apparmor.security.beta.kubernetes.io/allowedProfileNames: runtime/default - apparmor.security.beta.kubernetes.io/defaultProfileName: runtime/default -spec: - privileged: false - volumes: - - configMap - - secret - - emptyDir - - hostPath - allowedHostPaths: - - pathPrefix: "/etc/cni/net.d" - - pathPrefix: "/etc/kube-flannel" - - pathPrefix: "/run/flannel" - readOnlyRootFilesystem: false - # Users and groups - runAsUser: - rule: RunAsAny - supplementalGroups: - rule: RunAsAny - fsGroup: - rule: RunAsAny - # Privilege Escalation - allowPrivilegeEscalation: false - defaultAllowPrivilegeEscalation: false - # Capabilities - allowedCapabilities: ['NET_ADMIN'] - defaultAddCapabilities: [] - requiredDropCapabilities: [] - # Host namespaces - hostPID: false - hostIPC: false - hostNetwork: true - hostPorts: - - min: 0 - max: 65535 - # SELinux - seLinux: - # SELinux is unsed in CaaSP - rule: 'RunAsAny' ---- kind: ClusterRole apiVersion: rbac.authorization.k8s.io/v1 metadata: name: flannel rules: - - apiGroups: ['extensions'] - resources: ['podsecuritypolicies'] - verbs: ['use'] - resourceNames: ['psp.flannel.unprivileged'] - apiGroups: - "" resources: diff --git a/magnum/drivers/common/templates/kubernetes/fragments/kube-apiserver-to-kubelet-role.sh b/magnum/drivers/common/templates/kubernetes/fragments/kube-apiserver-to-kubelet-role.sh index c9759e6d3f..74a4146deb 100644 --- a/magnum/drivers/common/templates/kubernetes/fragments/kube-apiserver-to-kubelet-role.sh +++ b/magnum/drivers/common/templates/kubernetes/fragments/kube-apiserver-to-kubelet-role.sh @@ -78,67 +78,6 @@ EOF } kubectl apply --validate=false -f ${ADMIN_RBAC} -POD_SECURITY_POLICIES=/srv/magnum/kubernetes/podsecuritypolicies.yaml -# Pod Security Policies -[ -f ${POD_SECURITY_POLICIES} ] || { - echo "Writing File: $POD_SECURITY_POLICIES" - mkdir -p $(dirname ${POD_SECURITY_POLICIES}) - cat > ${POD_SECURITY_POLICIES} < List of admission control plugins to activate - default: "PodSecurityPolicy,NamespaceLifecycle,LimitRanger,ServiceAccount,ResourceQuota,TaintNodesByCondition,Priority,DefaultTolerationSeconds,DefaultStorageClass,StorageObjectInUseProtection,PersistentVolumeClaimResize,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,RuntimeClass" + default: "NamespaceLifecycle,LimitRanger,ServiceAccount,ResourceQuota,TaintNodesByCondition,Priority,DefaultTolerationSeconds,DefaultStorageClass,StorageObjectInUseProtection,PersistentVolumeClaimResize,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,RuntimeClass" kube_allow_priv: type: string diff --git a/releasenotes/notes/remove-podsecuritypolicy-5851f4009f1a166c.yaml b/releasenotes/notes/remove-podsecuritypolicy-5851f4009f1a166c.yaml new file mode 100644 index 0000000000..82b92d22ad --- /dev/null +++ b/releasenotes/notes/remove-podsecuritypolicy-5851f4009f1a166c.yaml @@ -0,0 +1,13 @@ +--- +deprecations: + - | + PodSecurityPolicy has been removed in Kubernetes v1.25 [1]. To allow Magnum + to support Kubernetes v1.25 and above, PodSecurityPolicy Admission + Controller has has been removed. + + This means that there is a behaviour change in Cluster Templates created + after this change, where new Clusters with such Cluster Templates will not + have PodSecurityPolicy. Please be aware of the subsequent impact on Helm + Charts, etc. + + [1] https://kubernetes.io/docs/concepts/security/pod-security-policy/