Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: kubernetes-sigs/node-feature-discovery
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: api/nfd/v0.17.0
Choose a base ref
...
head repository: kubernetes-sigs/node-feature-discovery
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.17.1
Choose a head ref
  • 9 commits
  • 17 files changed
  • 4 contributors

Commits on Jan 8, 2025

  1. Add support running with OwnerReferencesPermissionEnforcement

    when OwnerReferencesPermissionEnforcement validating webhook is
    enabled additional permissions are required to set/update owner ref
    field. NFD worker sets/updates NodeFeature owner ref field to
    the worker pod and owning daemonset.
    
    owner reference can only be updated if the worker has delete permissions
    for NodeFeatures.
    
    if owner reference has blockOwnerDeletion (as the case for the daemonset
    owner reference) then it requires update permissions to the finalizers
    of the owner, to avoid this, we set blockOwnerDeleteion to false for all
    owners referenced from NFD worker pod when setting/updating NodeFeature
    owner ref.
    
    Signed-off-by: adrianc <adrianc@nvidia.com>
    adrianchiris authored and k8s-infra-cherrypick-robot committed Jan 8, 2025

    Verified

    This commit was signed with the committer’s verified signature.
    jtescher Julian Tescher
    Copy the full SHA
    b5b503c View commit details
  2. Merge pull request #2011 from k8s-infra-cherrypick-robot/cherry-pick-…

    …2006-to-release-0.17
    
    [release-0.17] Add support running with OwnerReferencesPermissionEnforcement
    k8s-ci-robot authored Jan 8, 2025
    Copy the full SHA
    2c76100 View commit details

Commits on Jan 10, 2025

  1. Allow for rule processing in case of a missing feature

    Signed-off-by: Marcin Franczyk <marcin0franczyk@gmail.com>
    mfranczy authored and k8s-infra-cherrypick-robot committed Jan 10, 2025
    Copy the full SHA
    f64fdd6 View commit details
  2. Fix image compatibility processing panic in case of a nil pointer

    Signed-off-by: Marcin Franczyk <marcin0franczyk@gmail.com>
    mfranczy authored and k8s-infra-cherrypick-robot committed Jan 10, 2025
    Copy the full SHA
    25d751d View commit details
  3. Sort the list of compatibility artifacts in desc order

    Signed-off-by: Marcin Franczyk <marcin0franczyk@gmail.com>
    mfranczy authored and k8s-infra-cherrypick-robot committed Jan 10, 2025
    Copy the full SHA
    ff364d5 View commit details
  4. Add unit tests for invalid feature in the compatibility spec

    Signed-off-by: Marcin Franczyk <marcin0franczyk@gmail.com>
    mfranczy authored and k8s-infra-cherrypick-robot committed Jan 10, 2025
    Copy the full SHA
    d846548 View commit details
  5. Merge pull request #2016 from k8s-infra-cherrypick-robot/cherry-pick-…

    …2010-to-release-0.17
    
    [release-0.17] Bugfixes for image compatibility feature
    k8s-ci-robot authored Jan 10, 2025
    Copy the full SHA
    62299e6 View commit details
  6. Release v0.17.1

    marquiz committed Jan 10, 2025
    Copy the full SHA
    b6f5b96 View commit details
  7. Merge pull request #2018 from marquiz/release-0.17

    [release-0.17] Release v0.17.1
    k8s-ci-robot authored Jan 10, 2025
    Copy the full SHA
    c758a38 View commit details
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ features and system configuration!
#### Quick-start – the short-short version

```bash
$ kubectl apply -k "https://github.com/kubernetes-sigs/node-feature-discovery/deployment/overlays/default?ref=v0.17.0
$ kubectl apply -k "https://github.com/kubernetes-sigs/node-feature-discovery/deployment/overlays/default?ref=v0.17.1
namespace/node-feature-discovery created
customresourcedefinition.apiextensions.k8s.io/nodefeaturerules.nfd.k8s-sigs.io created
customresourcedefinition.apiextensions.k8s.io/nodefeatures.nfd.k8s-sigs.io created
2 changes: 1 addition & 1 deletion deployment/base/gc/gc.yaml
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ spec:
serviceAccount: nfd-gc
containers:
- name: nfd-gc
image: registry.k8s.io/nfd/node-feature-discovery:v0.17.0
image: registry.k8s.io/nfd/node-feature-discovery:v0.17.1
imagePullPolicy: IfNotPresent
resources:
limits:
2 changes: 1 addition & 1 deletion deployment/base/master/master-deployment.yaml
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ spec:
tolerations: []
containers:
- name: nfd-master
image: registry.k8s.io/nfd/node-feature-discovery:v0.17.0
image: registry.k8s.io/nfd/node-feature-discovery:v0.17.1
imagePullPolicy: IfNotPresent
resources:
limits:
1 change: 1 addition & 0 deletions deployment/base/rbac/worker-role.yaml
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@ rules:
- create
- get
- update
- delete
- apiGroups:
- ""
resources:
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ spec:
serviceAccount: nfd-topology-updater
containers:
- name: nfd-topology-updater
image: registry.k8s.io/nfd/node-feature-discovery:v0.17.0
image: registry.k8s.io/nfd/node-feature-discovery:v0.17.1
imagePullPolicy: IfNotPresent
livenessProbe:
grpc:
2 changes: 1 addition & 1 deletion deployment/base/worker-daemonset/worker-daemonset.yaml
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ spec:
dnsPolicy: ClusterFirstWithHostNet
containers:
- name: nfd-worker
image: registry.k8s.io/nfd/node-feature-discovery:v0.17.0
image: registry.k8s.io/nfd/node-feature-discovery:v0.17.1
imagePullPolicy: IfNotPresent
livenessProbe:
grpc:
2 changes: 1 addition & 1 deletion deployment/base/worker-job/worker-job.yaml
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ spec:
- nfd-worker
containers:
- name: nfd-worker
image: registry.k8s.io/nfd/node-feature-discovery:v0.17.0
image: registry.k8s.io/nfd/node-feature-discovery:v0.17.1
imagePullPolicy: IfNotPresent
command:
- "nfd-worker"
2 changes: 1 addition & 1 deletion deployment/helm/node-feature-discovery/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
appVersion: v0.17.0
appVersion: v0.17.1
description: |
Detects hardware features available on each node in a Kubernetes cluster, and advertises
those features using node labels.
1 change: 1 addition & 0 deletions deployment/helm/node-feature-discovery/templates/role.yaml
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@ rules:
- create
- get
- update
- delete
- apiGroups:
- ""
resources:
2 changes: 1 addition & 1 deletion deployment/overlays/prune/master-job.yaml
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ spec:
tolerations: []
containers:
- name: nfd-master
image: registry.k8s.io/nfd/node-feature-discovery:v0.17.0
image: registry.k8s.io/nfd/node-feature-discovery:v0.17.1
imagePullPolicy: IfNotPresent
command:
- "nfd-master"
4 changes: 2 additions & 2 deletions docs/_config.yml
Original file line number Diff line number Diff line change
@@ -55,7 +55,7 @@ scss: |
# Release is the full released version number. Used to make external links to
# point to the correct blobs in the Github repo. This is also the version shown
# in the sidebar (top left corner of the page)
release: v0.17.0
release: v0.17.1

# Container image which to point to in the documentation
container_image: registry.k8s.io/nfd/node-feature-discovery:v0.17.0
container_image: registry.k8s.io/nfd/node-feature-discovery:v0.17.1
6 changes: 5 additions & 1 deletion pkg/apis/nfd/nodefeaturerule/rule.go
Original file line number Diff line number Diff line change
@@ -269,7 +269,11 @@ func evaluateFeatureMatcher(m *nfdv1alpha1.FeatureMatcher, features *nfdv1alpha1
fI, okI := features.Instances[featureName]
if !okF && !okA && !okI {
klog.V(2).InfoS("feature not available", "featureName", featureName)
return false, nil, nil
if failFast {
return false, nil, nil
}
isMatch = false
continue
}

if term.MatchExpressions != nil {
14 changes: 14 additions & 0 deletions pkg/client-nfd/compat/artifact-client/client.go
Original file line number Diff line number Diff line change
@@ -22,6 +22,8 @@ import (
"context"
"encoding/json"
"fmt"
"slices"
"time"

ocispec "github.com/opencontainers/image-spec/specs-go/v1"
oras "oras.land/oras-go/v2"
@@ -34,6 +36,10 @@ import (
compatv1alpha1 "sigs.k8s.io/node-feature-discovery/api/image-compatibility/v1alpha1"
)

const (
ArtifactCreationTimestampKey = "org.opencontainers.image.created"
)

// ArtifactClient interface contain set of functions to manipulate compatibility artfact.
type ArtifactClient interface {
// FetchCompatibilitySpec downloads the compatibility specifcation associated with the image.
@@ -90,6 +96,14 @@ func (c *Client) FetchCompatibilitySpec(ctx context.Context) (*compatv1alpha1.Sp
} else if len(descs) < 1 {
return nil, fmt.Errorf("compatibility artifact not found")
}

// Sort the artifacts in desc order.
// If the artifact does not have creation timestamp it will be moved to the top of the slice.
slices.SortFunc(descs, func(i, j ocispec.Descriptor) int {
it, _ := time.Parse(time.RFC3339, i.Annotations[ArtifactCreationTimestampKey])
jt, _ := time.Parse(time.RFC3339, j.Annotations[ArtifactCreationTimestampKey])
return it.Compare(jt)
})
artifactDesc := descs[len(descs)-1]

_, content, err := oras.FetchBytes(ctx, repo.Manifests(), artifactDesc.Digest.String(), oras.DefaultFetchBytesOptions)
11 changes: 9 additions & 2 deletions pkg/client-nfd/compat/node-validator/node-validator.go
Original file line number Diff line number Diff line change
@@ -97,6 +97,7 @@ func (nv *nodeValidator) Execute(ctx context.Context) ([]*CompatibilityStatus, e
}

func evaluateRuleStatus(rule *nfdv1alpha1.Rule, matchStatus *nodefeaturerule.MatchStatus) ProcessedRuleStatus {
var matchedFeatureTerms nfdv1alpha1.FeatureMatcher
out := ProcessedRuleStatus{Name: rule.Name, IsMatch: matchStatus.IsMatch}

evaluateFeatureMatcher := func(featureMatcher, matchedFeatureTerms nfdv1alpha1.FeatureMatcher) []MatchedExpression {
@@ -163,11 +164,17 @@ func evaluateRuleStatus(rule *nfdv1alpha1.Rule, matchStatus *nodefeaturerule.Mat
}

if matchFeatures := rule.MatchFeatures; matchFeatures != nil {
out.MatchedExpressions = evaluateFeatureMatcher(matchFeatures, matchStatus.MatchedFeaturesTerms)
if matchStatus.MatchFeatureStatus != nil {
matchedFeatureTerms = matchStatus.MatchFeatureStatus.MatchedFeaturesTerms
}
out.MatchedExpressions = evaluateFeatureMatcher(matchFeatures, matchedFeatureTerms)
}

for i, matchAnyElem := range rule.MatchAny {
matchedExpressions := evaluateFeatureMatcher(matchAnyElem.MatchFeatures, matchStatus.MatchAny[i].MatchedFeaturesTerms)
if matchStatus.MatchAny[i].MatchedFeaturesTerms != nil {
matchedFeatureTerms = matchStatus.MatchAny[i].MatchedFeaturesTerms
}
matchedExpressions := evaluateFeatureMatcher(matchAnyElem.MatchFeatures, matchedFeatureTerms)
out.MatchedAny = append(out.MatchedAny, MatchAnyElem{MatchedExpressions: matchedExpressions})
}

24 changes: 24 additions & 0 deletions pkg/client-nfd/compat/node-validator/node-validator_test.go
Original file line number Diff line number Diff line change
@@ -114,6 +114,17 @@ func TestNodeValidator(t *testing.T) {
},
},
},
{
Name: "fake_5",
MatchFeatures: v1alpha1.FeatureMatcher{
{
Feature: "unknown.unknown",
MatchExpressions: &v1alpha1.MatchExpressionSet{
"name": &v1alpha1.MatchExpression{Op: v1alpha1.MatchIn, Value: v1alpha1.MatchValue{"instance_1"}},
},
},
},
},
},
},
},
@@ -219,6 +230,19 @@ func TestNodeValidator(t *testing.T) {
},
},
},
{
Name: "fake_5",
IsMatch: false,
MatchedExpressions: []MatchedExpression{
{
Feature: "unknown.unknown",
Name: "name",
Expression: &v1alpha1.MatchExpression{Op: v1alpha1.MatchIn, Value: v1alpha1.MatchValue{"instance_1"}},
MatcherType: MatchExpressionType,
IsMatch: false,
},
},
},
},
},
}
6 changes: 5 additions & 1 deletion pkg/nfd-worker/nfd-worker.go
Original file line number Diff line number Diff line change
@@ -37,6 +37,7 @@ import (
"k8s.io/apimachinery/pkg/util/validation"
k8sclient "k8s.io/client-go/kubernetes"
"k8s.io/klog/v2"
"k8s.io/utils/ptr"
klogutils "sigs.k8s.io/node-feature-discovery/pkg/utils/klog"
"sigs.k8s.io/yaml"

@@ -280,7 +281,10 @@ func (w *nfdWorker) setOwnerReference() error {
klog.ErrorS(err, "failed to get self pod, cannot inherit ownerReference for NodeFeature")
return err
} else {
ownerReference = append(ownerReference, selfPod.OwnerReferences...)
for _, owner := range selfPod.OwnerReferences {
owner.BlockOwnerDeletion = ptr.To(false)
ownerReference = append(ownerReference, owner)
}
}

podUID := os.Getenv("POD_UID")
2 changes: 1 addition & 1 deletion test/e2e/utils/rbac.go
Original file line number Diff line number Diff line change
@@ -227,7 +227,7 @@ func createRoleWorker(ctx context.Context, cs clientset.Interface, ns string) (*
{
APIGroups: []string{"nfd.k8s-sigs.io"},
Resources: []string{"nodefeatures"},
Verbs: []string{"create", "get", "update"},
Verbs: []string{"create", "get", "update", "delete"},
},
{
APIGroups: []string{""},