diff --git a/cmd/nfd-master/main.go b/cmd/nfd-master/main.go index 40cafd7aeb..c929ec551e 100644 --- a/cmd/nfd-master/main.go +++ b/cmd/nfd-master/main.go @@ -50,6 +50,14 @@ func main() { os.Exit(2) } + // Check deprecated flags + flags.Visit(func(f *flag.Flag) { + switch f.Name { + case "featurerules-controller": + klog.Warningf("-featurerules-controller is deprecated, use '-crd-controller' flag instead") + } + }) + if *printVersion { fmt.Println(ProgramName, version.Get()) os.Exit(0) @@ -100,8 +108,10 @@ func initFlags(flagset *flag.FlagSet) *master.Args { "Do not publish feature labels") flagset.BoolVar(&args.EnableTaints, "enable-taints", false, "Enable node tainting feature") - flagset.BoolVar(&args.FeatureRulesController, "featurerules-controller", true, - "Enable controller for NodeFeatureRule objects. Generates node labels based on the rules in these CRs.") + flagset.BoolVar(&args.CrdController, "featurerules-controller", true, + "Enable NFD CRD API controller. DEPRECATED: use -crd-controller instead") + flagset.BoolVar(&args.CrdController, "crd-controller", true, + "Enable NFD CRD API controller for processing NodeFeature and NodeFeatureRule objects.") 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 03e995934b..26a326cb80 100644 --- a/deployment/helm/node-feature-discovery/templates/master.yaml +++ b/deployment/helm/node-feature-discovery/templates/master.yaml @@ -87,12 +87,15 @@ spec: {{- if .Values.master.resourceLabels | empty | not }} - "--resource-labels={{- join "," .Values.master.resourceLabels }}" {{- end }} - {{- if .Values.master.featureRulesController | kindIs "invalid" | not }} - - "-featurerules-controller={{ .Values.master.featureRulesController }}" + {{- if .Values.master.crdController | kindIs "invalid" | not }} + - "-crd-controller={{ .Values.master.crdController }}" {{- else }} - ## By default, disable NodeFeatureRules controller for other than the default instances + ## By default, disable crd controller for other than the default instances - "-featurerules-controller={{ .Values.master.instance | empty }}" {{- end }} + {{- if .Values.master.featureRulesController | kindIs "invalid" | not }} + - "-featurerules-controller={{ .Values.master.featureRulesController }}" + {{- end }} {{- if .Values.tls.enable }} - "--ca-file=/etc/kubernetes/node-feature-discovery/certs/ca.crt" - "--key-file=/etc/kubernetes/node-feature-discovery/certs/tls.key" diff --git a/deployment/helm/node-feature-discovery/values.yaml b/deployment/helm/node-feature-discovery/values.yaml index 85a737ce1a..8531e963af 100644 --- a/deployment/helm/node-feature-discovery/values.yaml +++ b/deployment/helm/node-feature-discovery/values.yaml @@ -17,6 +17,7 @@ master: featureApi: extraLabelNs: [] resourceLabels: [] + crdController: null featureRulesController: null deploymentAnnotations: {} replicaCount: 1 diff --git a/docs/deployment/helm.md b/docs/deployment/helm.md index 6e032026e1..03115988e9 100644 --- a/docs/deployment/helm.md +++ b/docs/deployment/helm.md @@ -107,7 +107,8 @@ We have introduced the following Chart parameters. | `master.instance` | string | | Instance name. Used to separate annotation namespaces for multiple parallel deployments | | `master.extraLabelNs` | array | [] | List of allowed extra label namespaces | | `master.resourceLabels` | array | [] | List of labels to be registered as extended resources | -| `master.featureRulesController` | bool | null | Specifies whether the controller for processing of NodeFeatureRule objects is enabled. If not set, controller will be enabled if `master.instance` is empty. | +| `master.crdController` | bool | null | Specifies whether the NFD CRD API controller is enabled. If not set, controller will be enabled if `master.instance` is empty. | +| `master.featureRulesController` | bool | null | DEPRECATED: use `master.crdController` instead | | `master.replicaCount` | integer | 1 | Number of desired pods. This is a pointer to distinguish between explicit zero and not specified | | `master.podSecurityContext` | dict | {} | [PodSecurityContext](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod) holds pod-level security attributes and common container settings | | `master.securityContext` | dict | {} | Container [security settings](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container)| diff --git a/docs/reference/master-commandline-reference.md b/docs/reference/master-commandline-reference.md index c7dae1d60d..6bda05d505 100644 --- a/docs/reference/master-commandline-reference.md +++ b/docs/reference/master-commandline-reference.md @@ -177,20 +177,24 @@ Example: nfd-master -no-publish ``` -### -featurerules-controller +### -crd-controller -The `-featurerules-controller` flag controlers the processing of -NodeFeatureRule objects, effectively enabling/disabling labels from these -custom labeling rules. +The `-crd-controller` flag specifies whether the NFD CRD API controller is +enabled or not. The controller is responsible for processing NodeFeature and +NodeFeatureRule objects. Default: *true* Example: ```bash -nfd-master -featurerules-controller=false +nfd-master -crd-controller=false ``` +### -featurerules-controller + +**DEPRECATED**: use [`-crd-controller`](#-crd-controller) instead. + ### -label-whitelist The `-label-whitelist` specifies a regular expression for filtering feature diff --git a/pkg/nfd-master/nfd-master.go b/pkg/nfd-master/nfd-master.go index afc9719e39..7d1bdac3e2 100644 --- a/pkg/nfd-master/nfd-master.go +++ b/pkg/nfd-master/nfd-master.go @@ -62,21 +62,21 @@ 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 - FeatureRulesController bool - EnableNodeFeatureApi bool - NoPublish bool - EnableTaints 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 + CrdController bool + EnableNodeFeatureApi bool + NoPublish bool + EnableTaints bool + Port int + Prune bool + VerifyNodeName bool + ResourceLabels utils.StringSetVal } type NfdMaster interface { @@ -154,7 +154,7 @@ func (m *nfdMaster) Run() error { return m.prune() } - if m.args.FeatureRulesController { + if m.args.CrdController { kubeconfig, err := m.getKubeconfig() if err != nil { return err