Skip to content

Commit

Permalink
Merge pull request #2006 from adrianchiris/fix-worker-role
Browse files Browse the repository at this point in the history
Add support running with OwnerReferencesPermissionEnforcement
  • Loading branch information
k8s-ci-robot authored Jan 8, 2025
2 parents 1b1a47d + 3f012c2 commit 3bedeaf
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions deployment/base/rbac/worker-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ rules:
- create
- get
- update
- delete
- apiGroups:
- ""
resources:
Expand Down
1 change: 1 addition & 0 deletions deployment/helm/node-feature-discovery/templates/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ rules:
- create
- get
- update
- delete
- apiGroups:
- ""
resources:
Expand Down
6 changes: 5 additions & 1 deletion pkg/nfd-worker/nfd-worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/utils/rbac.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{""},
Expand Down

0 comments on commit 3bedeaf

Please sign in to comment.