@@ -210,6 +210,60 @@ func TestUserChanges(t *testing.T) {
210
210
},
211
211
},
212
212
},
213
+ }, {
214
+ name : "Deny changes to HNC annotations in propagated objects" ,
215
+ fail : true ,
216
+ oldInst : & unstructured.Unstructured {
217
+ Object : map [string ]interface {}{
218
+ "apiVersion" : "v1" ,
219
+ "kind" : "Pod" ,
220
+ "metadata" : map [string ]interface {}{
221
+ "labels" : map [string ]interface {}{
222
+ api .LabelInheritedFrom : "foo" ,
223
+ },
224
+ },
225
+ },
226
+ },
227
+ inst : & unstructured.Unstructured {
228
+ Object : map [string ]interface {}{
229
+ "apiVersion" : "v1" ,
230
+ "kind" : "Pod" ,
231
+ "metadata" : map [string ]interface {}{
232
+ "labels" : map [string ]interface {}{
233
+ api .LabelInheritedFrom : "foo" ,
234
+ },
235
+ "annotations" : map [string ]interface {}{
236
+ api .AnnotationPropagatePrefix + "/select" : "abc" ,
237
+ },
238
+ },
239
+ },
240
+ },
241
+ }, {
242
+ name : "Deny changes to HNC labels in propagated objects" ,
243
+ fail : true ,
244
+ oldInst : & unstructured.Unstructured {
245
+ Object : map [string ]interface {}{
246
+ "apiVersion" : "v1" ,
247
+ "kind" : "Pod" ,
248
+ "metadata" : map [string ]interface {}{
249
+ "labels" : map [string ]interface {}{
250
+ api .LabelInheritedFrom : "foo" ,
251
+ },
252
+ },
253
+ },
254
+ },
255
+ inst : & unstructured.Unstructured {
256
+ Object : map [string ]interface {}{
257
+ "apiVersion" : "v1" ,
258
+ "kind" : "Pod" ,
259
+ "metadata" : map [string ]interface {}{
260
+ "labels" : map [string ]interface {}{
261
+ api .LabelInheritedFrom : "foo" ,
262
+ api .MetaGroup + "/foo" : "foo" ,
263
+ },
264
+ },
265
+ },
266
+ },
213
267
}, {
214
268
name : "Deny spec changes to propagated objects" ,
215
269
fail : true ,
0 commit comments