@@ -57,7 +57,7 @@ import (
5757 nfdv1alpha1 "sigs.k8s.io/node-feature-discovery/api/nfd/v1alpha1"
5858 "sigs.k8s.io/node-feature-discovery/pkg/apis/nfd/nodefeaturerule"
5959 "sigs.k8s.io/node-feature-discovery/pkg/apis/nfd/validate"
60- "sigs.k8s.io/node-feature-discovery/pkg/features"
60+ nfdfeatures "sigs.k8s.io/node-feature-discovery/pkg/features"
6161 pb "sigs.k8s.io/node-feature-discovery/pkg/labeler"
6262 "sigs.k8s.io/node-feature-discovery/pkg/utils"
6363 "sigs.k8s.io/node-feature-discovery/pkg/version"
@@ -318,7 +318,7 @@ func (m *nfdMaster) Run() error {
318318 grpcErr := make (chan error )
319319 // If the NodeFeature API is enabled, don'tregister the labeler API
320320 // server. Otherwise, register the labeler server.
321- if ! features .NFDFeatureGate .Enabled (features .NodeFeatureAPI ) {
321+ if ! nfdfeatures .NFDFeatureGate .Enabled (nfdfeatures .NodeFeatureAPI ) {
322322 go m .runGrpcServer (grpcErr )
323323 }
324324
@@ -373,7 +373,7 @@ func (m *nfdMaster) Run() error {
373373 m .nodeUpdaterPool .start (m .config .NfdApiParallelism )
374374
375375 // Update all nodes when the configuration changes
376- if m .nfdController != nil && features .NFDFeatureGate .Enabled (features .NodeFeatureAPI ) {
376+ if m .nfdController != nil && nfdfeatures .NFDFeatureGate .Enabled (nfdfeatures .NodeFeatureAPI ) {
377377 m .nfdController .updateAllNodesChan <- struct {}{}
378378 }
379379
@@ -471,7 +471,7 @@ func (m *nfdMaster) runGrpcServer(errChan chan<- error) {
471471func (m * nfdMaster ) nfdAPIUpdateHandler () {
472472 // We want to unconditionally update all nodes at startup if gRPC is
473473 // disabled (i.e. NodeFeature API is enabled)
474- updateAll := features .NFDFeatureGate .Enabled (features .NodeFeatureAPI )
474+ updateAll := nfdfeatures .NFDFeatureGate .Enabled (nfdfeatures .NodeFeatureAPI )
475475 updateNodes := make (map [string ]struct {})
476476 rateLimit := time .After (time .Second )
477477 for {
@@ -801,12 +801,12 @@ func (m *nfdMaster) nfdAPIUpdateOneNode(cli k8sclient.Interface, node *corev1.No
801801 // NOTE: changing the rule api to support handle multiple objects instead
802802 // of merging would probably perform better with lot less data to copy.
803803 features = objs [0 ].Spec .DeepCopy ()
804- if m .config .AutoDefaultNs {
804+ if ! nfdfeatures . NFDFeatureGate . Enabled ( nfdfeatures . DisableAutoPrefix ) && m .config .AutoDefaultNs {
805805 features .Labels = addNsToMapKeys (features .Labels , nfdv1alpha1 .FeatureLabelNs )
806806 }
807807 for _ , o := range objs [1 :] {
808808 s := o .Spec .DeepCopy ()
809- if m .config .AutoDefaultNs {
809+ if ! nfdfeatures . NFDFeatureGate . Enabled ( nfdfeatures . DisableAutoPrefix ) && m .config .AutoDefaultNs {
810810 s .Labels = addNsToMapKeys (s .Labels , nfdv1alpha1 .FeatureLabelNs )
811811 }
812812 s .MergeInto (features )
@@ -864,7 +864,7 @@ func filterExtendedResource(name, value string, features *nfdv1alpha1.Features)
864864}
865865
866866func (m * nfdMaster ) refreshNodeFeatures (cli k8sclient.Interface , node * corev1.Node , labels map [string ]string , features * nfdv1alpha1.Features ) error {
867- if m .config .AutoDefaultNs {
867+ if ! nfdfeatures . NFDFeatureGate . Enabled ( nfdfeatures . DisableAutoPrefix ) && m .config .AutoDefaultNs {
868868 labels = addNsToMapKeys (labels , nfdv1alpha1 .FeatureLabelNs )
869869 } else if labels == nil {
870870 labels = make (map [string ]string )
@@ -1041,7 +1041,7 @@ func (m *nfdMaster) processNodeFeatureRule(nodeName string, features *nfdv1alpha
10411041 l := ruleOut .Labels
10421042 e := ruleOut .ExtendedResources
10431043 a := ruleOut .Annotations
1044- if m .config .AutoDefaultNs {
1044+ if ! nfdfeatures . NFDFeatureGate . Enabled ( nfdfeatures . DisableAutoPrefix ) && m .config .AutoDefaultNs {
10451045 l = addNsToMapKeys (ruleOut .Labels , nfdv1alpha1 .FeatureLabelNs )
10461046 e = addNsToMapKeys (ruleOut .ExtendedResources , nfdv1alpha1 .ExtendedResourceNs )
10471047 a = addNsToMapKeys (ruleOut .Annotations , nfdv1alpha1 .FeatureAnnotationNs )
@@ -1363,7 +1363,7 @@ func (m *nfdMaster) startNfdApiController() error {
13631363 }
13641364 klog .InfoS ("starting the nfd api controller" )
13651365 m .nfdController , err = newNfdController (kubeconfig , nfdApiControllerOptions {
1366- DisableNodeFeature : ! features .NFDFeatureGate .Enabled (features .NodeFeatureAPI ),
1366+ DisableNodeFeature : ! nfdfeatures .NFDFeatureGate .Enabled (nfdfeatures .NodeFeatureAPI ),
13671367 ResyncPeriod : m .config .ResyncPeriod .Duration ,
13681368 })
13691369 if err != nil {
0 commit comments