-
Notifications
You must be signed in to change notification settings - Fork 51
OCPBUGS-11933: Ignore informative annotations upon admission #117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OCPBUGS-11933: Ignore informative annotations upon admission #117
Conversation
@liouk: This pull request references Jira Issue OCPBUGS-11933, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/jira refresh |
@liouk: This pull request references Jira Issue OCPBUGS-11933, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
Requesting review from QA contact: In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
4b9741c
to
d892ff7
Compare
d892ff7
to
9a75644
Compare
/hold |
/hold |
please create a proof PR in openshift/kubernetes |
dbffacb
to
9836a75
Compare
/hold cancel |
9836a75
to
077f27f
Compare
077f27f
to
7385c01
Compare
@stlaz this is the poc PR: openshift/kubernetes#1708 |
/approve |
7385c01
to
593b8dc
Compare
593b8dc
to
a0fc30b
Compare
return false, admission.NewForbidden(a, fmt.Errorf("object was marked as kind pod but was unable to be converted: %v", a.GetOldObject())) | ||
} | ||
|
||
// never ignore any spec changes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
once vertical scaling is a thing, we will ignore some. Just be ready.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is #128 legit, too?
a0fc30b
to
def0bab
Compare
|
||
// do not consider annotations for further comparisons, they were checked above | ||
origNewAnnotations := newPod.ObjectMeta.Annotations | ||
newPod.ObjectMeta.Annotations = oldPod.ObjectMeta.Annotations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't mutate inputs. This got us into trouble in validation a couple years back. This isn't needed to make the mutatingGCFields check work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right -- I wanted to avoid another deep copy (as the IsMutatingGCFields
check does one). I did this now by overriding the equalities, and in particular for the map[string]string
type (which is the type of Annotations
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed with @stlaz, opted for doing an object deep-copy and modifying the annotations of the copy in order to perform the controller GCFields check.
def0bab
to
08aef77
Compare
08aef77
to
8e50815
Compare
@liouk: all tests passed! Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: liouk, stlaz The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@liouk: Jira Issue OCPBUGS-11933: All pull requests linked via external trackers have merged: Jira Issue OCPBUGS-11933 has been moved to the MODIFIED state. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
Fix included in accepted release 4.16.0-0.nightly-2024-04-13-070448 |
This PR introduces a list of known informative annotations; pod admission then will ignore any pod mutations that only add these annotations.
The goal is to prevent a pod to be re-admitted and potentially change the SCC under which it gets admitted when a mutation only adds informative annotations, which shouldn't cause SCC changes.
This also fixes a bug in the
TestShouldIgnore
unit test withinpkg/securitycontextconstraints/sccadmission/admission_test.go
.