diff --git a/cmd/nfd-master/main.go b/cmd/nfd-master/main.go index ca2a576dc..07c41c50f 100644 --- a/cmd/nfd-master/main.go +++ b/cmd/nfd-master/main.go @@ -96,6 +96,8 @@ func initFlags(flagset *flag.FlagSet) *master.Args { "NB: the label namespace is omitted i.e. the filter is only applied to the name part after '/'.") flagset.BoolVar(&args.NoPublish, "no-publish", false, "Do not publish feature labels") + flagset.BoolVar(&args.FeatureRulesController, "featurerules-controller", true, + "Enable controller for NodeFeatureRule objects. Generates node labels based on the rules in these CRs.") flagset.IntVar(&args.Port, "port", 8080, "Port on which to listen for connections.") flagset.BoolVar(&args.Prune, "prune", false, diff --git a/deployment/helm/node-feature-discovery/templates/master.yaml b/deployment/helm/node-feature-discovery/templates/master.yaml index 63dea55d0..6e07ee2ef 100644 --- a/deployment/helm/node-feature-discovery/templates/master.yaml +++ b/deployment/helm/node-feature-discovery/templates/master.yaml @@ -62,6 +62,7 @@ spec: {{- if .Values.master.extraLabelNs | empty | not }} - "--extra-label-ns={{- join "," .Values.master.extraLabelNs }}" {{- end }} + - "-featurerules-controller={{ .Values.master.featureRulesController }}" ## Enable TLS authentication ## The example below assumes having the root certificate named ca.crt stored in ## a ConfigMap named nfd-ca-cert, and, the TLS authentication credentials stored diff --git a/deployment/helm/node-feature-discovery/values.yaml b/deployment/helm/node-feature-discovery/values.yaml index 1765d65e3..4622972a8 100644 --- a/deployment/helm/node-feature-discovery/values.yaml +++ b/deployment/helm/node-feature-discovery/values.yaml @@ -24,6 +24,7 @@ nodeFeatureRule: master: instance: extraLabelNs: [] + featureRulesController: true replicaCount: 1 diff --git a/docs/advanced/master-commandline-reference.md b/docs/advanced/master-commandline-reference.md index b4af90d12..c9a266958 100644 --- a/docs/advanced/master-commandline-reference.md +++ b/docs/advanced/master-commandline-reference.md @@ -151,6 +151,20 @@ Example: nfd-master -no-publish ``` +### -featurerules-controller + +The `-featurerules-controller` flag controlers the processing of +NodeFeatureRule objects, effectively enabling/disabling labels from these +custom labeling rules. + +Default: *true* + +Example: + +```bash +nfd-master -featurerules-controller=false +``` + ### -label-whitelist The `-label-whitelist` specifies a regular expression for filtering feature diff --git a/docs/get-started/deployment-and-usage.md b/docs/get-started/deployment-and-usage.md index b9035e040..01f443ab8 100644 --- a/docs/get-started/deployment-and-usage.md +++ b/docs/get-started/deployment-and-usage.md @@ -299,6 +299,7 @@ We have introduced the following Chart parameters. | `master.*` | dict | | NFD master deployment configuration | | `master.instance` | string | | Instance name. Used to separate annotation namespaces for multiple parallel deployments | | `master.extraLabelNs` | array | [] | List of allowed extra label namespaces | +| `master.featureRulesController` | bool | True | Specifies whether the controller for processing of NodeFeatureRule objects is enable. | | `master.replicaCount` | integer | 1 | Number of desired pods. This is a pointer to distinguish between explicit zero and not specified | | `master.podSecurityContext` | dict | {} | SecurityContext holds pod-level security attributes and common container settings | | `master.service.type` | string | ClusterIP | NFD master service type | diff --git a/pkg/nfd-master/nfd-master.go b/pkg/nfd-master/nfd-master.go index efe2ceb8b..7dba0d715 100644 --- a/pkg/nfd-master/nfd-master.go +++ b/pkg/nfd-master/nfd-master.go @@ -83,18 +83,19 @@ type Annotations map[string]string // Args holds command line arguments type Args struct { - CaFile string - CertFile string - ExtraLabelNs utils.StringSetVal - Instance string - KeyFile string - Kubeconfig string - LabelWhiteList utils.RegexpVal - NoPublish bool - Port int - Prune bool - VerifyNodeName bool - ResourceLabels utils.StringSetVal + CaFile string + CertFile string + ExtraLabelNs utils.StringSetVal + Instance string + KeyFile string + Kubeconfig string + LabelWhiteList utils.RegexpVal + FeatureRulesController bool + NoPublish bool + Port int + Prune bool + VerifyNodeName bool + ResourceLabels utils.StringSetVal } type NfdMaster interface { @@ -173,11 +174,13 @@ func (m *nfdMaster) Run() error { return m.prune() } - kubeconfig, err := m.getKubeconfig() - if err != nil { - return err + if m.args.FeatureRulesController { + kubeconfig, err := m.getKubeconfig() + if err != nil { + return err + } + m.nfdController = newNfdController(kubeconfig) } - m.nfdController = newNfdController(kubeconfig) if !m.args.NoPublish { err := m.updateMasterNode()