Skip to content

Commit c61b73c

Browse files
authored
Merge pull request #2013 from marquiz/release-0.16
[release-0.16] Add support running with OwnerReferencesPermissionEnforcement
2 parents 725c204 + 2b5e54d commit c61b73c

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

deployment/base/rbac/worker-role.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ rules:
1111
- create
1212
- get
1313
- update
14+
- delete
1415
- apiGroups:
1516
- ""
1617
resources:

deployment/helm/node-feature-discovery/templates/role.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ rules:
1515
- create
1616
- get
1717
- update
18+
- delete
1819
- apiGroups:
1920
- ""
2021
resources:

pkg/nfd-worker/nfd-worker.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import (
4141
"k8s.io/apimachinery/pkg/util/validation"
4242
k8sclient "k8s.io/client-go/kubernetes"
4343
"k8s.io/klog/v2"
44+
"k8s.io/utils/ptr"
4445
klogutils "sigs.k8s.io/node-feature-discovery/pkg/utils/klog"
4546
"sigs.k8s.io/yaml"
4647

@@ -325,7 +326,10 @@ func (w *nfdWorker) Run() error {
325326
klog.ErrorS(err, "failed to get self pod, cannot inherit ownerReference for NodeFeature")
326327
return err
327328
} else {
328-
ownerReference = append(ownerReference, selfPod.OwnerReferences...)
329+
for _, owner := range selfPod.OwnerReferences {
330+
owner.BlockOwnerDeletion = ptr.To(false)
331+
ownerReference = append(ownerReference, owner)
332+
}
329333
}
330334

331335
podUID := os.Getenv("POD_UID")

test/e2e/utils/rbac.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ func createRoleWorker(ctx context.Context, cs clientset.Interface, ns string) (*
222222
{
223223
APIGroups: []string{"nfd.k8s-sigs.io"},
224224
Resources: []string{"nodefeatures"},
225-
Verbs: []string{"create", "get", "update"},
225+
Verbs: []string{"create", "get", "update", "delete"},
226226
},
227227
{
228228
APIGroups: []string{""},

0 commit comments

Comments
 (0)