File tree Expand file tree Collapse file tree 2 files changed +41
-4
lines changed
bindata/network/ovn-kubernetes/common Expand file tree Collapse file tree 2 files changed +41
-4
lines changed Original file line number Diff line number Diff line change
1
+ {{if .OVN_PRE_CONF_UDN_ADDR_ENABLE}}
2
+ apiVersion : admissionregistration.k8s.io/v1
3
+ kind : ValidatingAdmissionPolicy
4
+ metadata :
5
+ name : default-network-annotation
6
+ spec :
7
+ matchConstraints :
8
+ resourceRules :
9
+ - apiGroups : [""]
10
+ apiVersions : ["v1"]
11
+ operations : ["UPDATE"]
12
+ resources : ["pods"]
13
+ failurePolicy : Fail
14
+ validations :
15
+ # Prevent any changes to the default-network annotation after pod creation:
16
+ # - If annotation exists in old pod: new pod must have same annotation with identical value
17
+ # - If annotation doesn't exist in old pod: new pod must also not have it
18
+ - expression : >
19
+ ('v1.multus-cni.io/default-network' in oldObject.metadata.annotations)
20
+ ? ('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']
21
+ : !('v1.multus-cni.io/default-network' in object.metadata.annotations)
22
+ message: "The 'v1.multus-cni.io/default-network' annotation cannot be changed after the pod was created"
23
+ ---
24
+ apiVersion : admissionregistration.k8s.io/v1
25
+ kind : ValidatingAdmissionPolicyBinding
26
+ metadata :
27
+ name : default-network-annotation-binding
28
+ spec :
29
+ policyName : default-network-annotation
30
+ validationActions : [Deny]
31
+ matchResources :
32
+ resourceRules :
33
+ - apiGroups : [""]
34
+ apiVersions : ["v1"]
35
+ operations : ["UPDATE"]
36
+ resources : ["pods"]
37
+ {{end}}
Original file line number Diff line number Diff line change @@ -4187,11 +4187,11 @@ func Test_renderOVNKubernetes(t *testing.T) {
4187
4187
config .DefaultNetwork .OVNKubernetesConfig .RouteAdvertisements = operv1 .RouteAdvertisementsEnabled
4188
4188
return config
4189
4189
}, bootstrapResult : fakeBootstrapResultOVN ,
4190
- manifestDir : manifestDirOvn ,
4191
- client : cnofake .NewFakeClient (),
4192
- featureGates : preDefUDNFeatureGates ,
4190
+ manifestDir : manifestDirOvn ,
4191
+ client : cnofake .NewFakeClient (),
4192
+ featureGates : preDefUDNFeatureGates ,
4193
4193
},
4194
- expectNumObjs : 45 ,
4194
+ expectNumObjs : 47 ,
4195
4195
},
4196
4196
}
4197
4197
for _ , tt := range tests {
You can’t perform that action at this time.
0 commit comments