Skip to content

Commit

Permalink
Partly remove support for seccomp annotations
Browse files Browse the repository at this point in the history
We now partly drop the support for seccomp annotations which is planned
for v1.25 as part of the KEP:

kubernetes/enhancements#135

Pod security policies are not touched by this change and therefore we
have to keep the annotation key constants.

This means we only allow the usage of the annotations for backwards
compatibility reasons while the synchronization of the field to
annotation is no longer supported. Using the annotations for static pods
is also not supported any more.

Making the annotations fully non-functional will be deferred to a
future release.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>

Kubernetes-commit: 584783ee9f89fbff58bb69f6107db18f18ba8746
  • Loading branch information
saschagrunert authored and k8s-publishing-bot committed May 5, 2022
1 parent e1f25b8 commit 6b7d1dc
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions admission/admission.go
Original file line number Diff line number Diff line change
Expand Up @@ -626,13 +626,10 @@ func (a *Admission) PolicyToEvaluate(labels map[string]string) (api.Policy, fiel
}

// isSignificantPodUpdate determines whether a pod update should trigger a policy evaluation.
// Relevant mutable pod fields as of 1.21 are image and seccomp annotations:
// Relevant mutable pod fields as of 1.21 are image annotations:
// * https://github.com/kubernetes/kubernetes/blob/release-1.21/pkg/apis/core/validation/validation.go#L3947-L3949
func isSignificantPodUpdate(pod, oldPod *corev1.Pod) bool {
// TODO: invert this logic to only allow specific update types.
if pod.Annotations[corev1.SeccompPodAnnotationKey] != oldPod.Annotations[corev1.SeccompPodAnnotationKey] {
return true
}
if len(pod.Spec.Containers) != len(oldPod.Spec.Containers) {
return true
}
Expand Down Expand Up @@ -672,6 +669,7 @@ func isSignificantContainerUpdate(container, oldContainer *corev1.Container, ann
if container.Image != oldContainer.Image {
return true
}
// TODO(saschagrunert): Remove this logic in 1.27.
seccompKey := corev1.SeccompContainerAnnotationKeyPrefix + container.Name
return annotations[seccompKey] != oldAnnotations[seccompKey]
}
Expand Down

0 comments on commit 6b7d1dc

Please sign in to comment.