1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2025-03-17 13:58:21 +00:00

Merge pull request #1379 from k8s-infra-cherrypick-robot/cherry-pick-1378-to-release-0.14

[release-0.14] nfd-master: fix filtering of extended resources
This commit is contained in:
Kubernetes Prow Robot 2023-09-27 02:45:23 -07:00 committed by GitHub
commit c4ae0dcaf0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View file

@ -804,7 +804,7 @@ func filterExtendedResources(features *nfdv1alpha1.Features, extendedResources E
func filterExtendedResource(name, value string, features *nfdv1alpha1.Features) (string, error) { func filterExtendedResource(name, value string, features *nfdv1alpha1.Features) (string, error) {
// Check if given NS is allowed // Check if given NS is allowed
ns, _ := splitNs(name) ns, _ := splitNs(name)
if ns != nfdv1alpha1.ExtendedResourceNs && !strings.HasPrefix(ns, nfdv1alpha1.ExtendedResourceSubNsSuffix) { if ns != nfdv1alpha1.ExtendedResourceNs && !strings.HasSuffix(ns, nfdv1alpha1.ExtendedResourceSubNsSuffix) {
if ns == "kubernetes.io" || strings.HasSuffix(ns, ".kubernetes.io") { if ns == "kubernetes.io" || strings.HasSuffix(ns, ".kubernetes.io") {
return "", fmt.Errorf("namespace %q is not allowed", ns) return "", fmt.Errorf("namespace %q is not allowed", ns)
} }

View file

@ -23,7 +23,7 @@ spec:
- name: "e2e static rule" - name: "e2e static rule"
extendedResources: extendedResources:
vendor.io/static: "123" vendor.feature.node.kubernetes.io/static: "123"
matchFeatures: matchFeatures:
- name: "e2e not allowed rule" - name: "e2e not allowed rule"

View file

@ -771,13 +771,13 @@ core:
expectedTaints["*"] = []corev1.Taint{} expectedTaints["*"] = []corev1.Taint{}
eventuallyNonControlPlaneNodes(ctx, f.ClientSet).Should(MatchTaints(expectedTaints, nodes, false)) eventuallyNonControlPlaneNodes(ctx, f.ClientSet).Should(MatchTaints(expectedTaints, nodes, false))
expectedAnnotations["*"] = k8sAnnotations{"nfd.node.kubernetes.io/extended-resources": "nons,vendor.io/dynamic,vendor.io/static"} expectedAnnotations["*"] = k8sAnnotations{"nfd.node.kubernetes.io/extended-resources": "nons,vendor.feature.node.kubernetes.io/static,vendor.io/dynamic"}
expectedCapacity := map[string]corev1.ResourceList{ expectedCapacity := map[string]corev1.ResourceList{
"*": { "*": {
"feature.node.kubernetes.io/nons": resourcev1.MustParse("123"), "feature.node.kubernetes.io/nons": resourcev1.MustParse("123"),
"vendor.io/dynamic": resourcev1.MustParse("10"), "vendor.io/dynamic": resourcev1.MustParse("10"),
"vendor.io/static": resourcev1.MustParse("123"), "vendor.feature.node.kubernetes.io/static": resourcev1.MustParse("123"),
}, },
} }