-
Notifications
You must be signed in to change notification settings - Fork 249
CORENET-6130, CORENET-6261, CORENET-6092: Implement PreconfiguredUDNAddresses API changes #2743
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{{if .OVN_PRE_CONF_UDN_ADDR_ENABLE}} | ||
apiVersion: admissionregistration.k8s.io/v1 | ||
kind: ValidatingAdmissionPolicy | ||
metadata: | ||
name: default-network-annotation | ||
spec: | ||
matchConstraints: | ||
resourceRules: | ||
- apiGroups: [""] | ||
apiVersions: ["v1"] | ||
operations: ["UPDATE"] | ||
resources: ["pods"] | ||
failurePolicy: Fail | ||
validations: | ||
# Prevent any changes to the default-network annotation after pod creation: | ||
# - If annotation exists in old pod: new pod must have same annotation with identical value | ||
# - If annotation doesn't exist in old pod: new pod must also not have it | ||
- expression: > | ||
!has(object.metadata.annotations) || !has(oldObject.metadata.annotations) || | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. slight change here that is missing u/s as noted by @kyrtapz already in his comment on the PR. This fix will also go upstream. |
||
(('v1.multus-cni.io/default-network' in oldObject.metadata.annotations) | ||
? ('v1.multus-cni.io/default-network' in object.metadata.annotations) && oldObject.metadata.annotations['v1.multus-cni.io/default-network'] == object.metadata.annotations['v1.multus-cni.io/default-network'] | ||
: !('v1.multus-cni.io/default-network' in object.metadata.annotations)) | ||
message: "The 'v1.multus-cni.io/default-network' annotation cannot be changed after the pod was created" | ||
--- | ||
apiVersion: admissionregistration.k8s.io/v1 | ||
kind: ValidatingAdmissionPolicyBinding | ||
metadata: | ||
name: default-network-annotation-binding | ||
spec: | ||
policyName: default-network-annotation | ||
validationActions: [Deny] | ||
matchResources: | ||
resourceRules: | ||
- apiGroups: [""] | ||
apiVersions: ["v1"] | ||
operations: ["UPDATE"] | ||
resources: ["pods"] | ||
{{end}} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4191,7 +4191,7 @@ func Test_renderOVNKubernetes(t *testing.T) { | |
client: cnofake.NewFakeClient(), | ||
featureGates: preDefUDNFeatureGates, | ||
}, | ||
expectNumObjs: 45, | ||
expectNumObjs: 47, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah the VAP and the role binding? |
||
}, | ||
} | ||
for _, tt := range tests { | ||
|
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.
haha in my head i go:
ignore if:
object != null && object.metadata.namespace == "openshift-ovn-kubernetes" && object.metadata.name == "default"
but i see you did exact opp which is the same thing
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.
i really hope we can't have a NAD with no namespace and metadata.namespace is never none haha like we hit the hitch with metadata.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.
Great point, I will double check that this doesn't happen.