@@ -1102,6 +1102,41 @@ func TestLabellingUpdates(t *testing.T) {
11021102 labels : map [string ]string {},
11031103 shouldBeAllowed : true ,
11041104 },
1105+ // https://issues.redhat.com/browse/SREP-1770 - test explicit exception for nvidia-gpu-operator
1106+ {
1107+ testID : "nvidia-gpu-operator-can-add-label-to-unprotected-ns" ,
1108+ targetNamespace : "nvidia-gpu-operator" ,
1109+ username : "system:serviceaccount:nvidia-gpu-operator:gpu-operator" ,
1110+ userGroups : []string {"system:authenticated" , "system:authenticated:oauth" },
1111+ operation : admissionv1 .Update ,
1112+ oldObject : createOldObject ("nvidia-gpu-operator" , "nvidia-gpu-operato-can-add-label-to-unprotected-ns" , map [string ]string {}),
1113+ labels : map [string ]string {"openshift.io/cluster-monitoring" : "true" },
1114+ shouldBeAllowed : true ,
1115+ },
1116+ {
1117+ testID : "nvidia-gpu-operator-can-remove-label-from-unprotected-ns" ,
1118+ targetNamespace : "nvidia-gpu-operator" ,
1119+ username : "system:serviceaccount:nvidia-gpu-operator:gpu-operator" ,
1120+ userGroups : []string {"system:authenticated" , "system:authenticated:oauth" },
1121+ operation : admissionv1 .Update ,
1122+ oldObject : createOldObject ("nvidia-gpu-operator" , "nvidia-gpu-operato-can-remove-label-from-unprotected-ns" , map [string ]string {
1123+ "openshift.io/cluster-monitoring" : "true" ,
1124+ }),
1125+ labels : map [string ]string {},
1126+ shouldBeAllowed : true ,
1127+ },
1128+ {
1129+ testID : "nvidia-gpu-operator-cannot-remove-label-from-protected-ns" ,
1130+ targetNamespace : "nvidia-gpu-operator" ,
1131+ username : "system:serviceaccount:nvidia-gpu-operator:gpu-operator" ,
1132+ userGroups : []string {"system:authenticated" , "system:authenticated:oauth" },
1133+ operation : admissionv1 .Update ,
1134+ oldObject : createOldObject ("openshift-kube-apiserver" , "nvidia-gpu-operato-cannot-remove-label-from-protected-ns" , map [string ]string {
1135+ "openshift.io/cluster-monitoring" : "true" ,
1136+ }),
1137+ labels : map [string ]string {},
1138+ shouldBeAllowed : false ,
1139+ },
11051140 }
11061141 runNamespaceTests (t , tests )
11071142}
0 commit comments