1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2024-12-14 11:57:51 +00:00

nfd-master: rename -featurerules-controller flag to -crd-controller

Deprecate the '-featurerules-controller' command line flag as the name
does not describe the functionality anymore: in practice it controls the
CRD controller handling both NodeFeature and NodeFeatureRule objects.
The patch introduces a duplicate, more generally named, flag
'-crd-controller'. A warning is printed in the log if
'-featurerules-controller' flag is encountered.
This commit is contained in:
Markus Lehtonen 2022-11-22 11:51:20 +02:00
parent 8a153c12cf
commit 9f0806593d
6 changed files with 46 additions and 27 deletions

View file

@ -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,

View file

@ -87,11 +87,14 @@ spec:
{{- if .Values.master.resourceLabels | empty | not }}
- "--resource-labels={{- join "," .Values.master.resourceLabels }}"
{{- end }}
{{- if .Values.master.crdController | kindIs "invalid" | not }}
- "-crd-controller={{ .Values.master.crdController }}"
{{- else }}
## 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 }}"
{{- else }}
## By default, disable NodeFeatureRules controller for other than the default instances
- "-featurerules-controller={{ .Values.master.instance | empty }}"
{{- end }}
{{- if .Values.tls.enable }}
- "--ca-file=/etc/kubernetes/node-feature-discovery/certs/ca.crt"

View file

@ -17,6 +17,7 @@ master:
featureApi:
extraLabelNs: []
resourceLabels: []
crdController: null
featureRulesController: null
deploymentAnnotations: {}
replicaCount: 1

View file

@ -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)|

View file

@ -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

View file

@ -69,7 +69,7 @@ type Args struct {
KeyFile string
Kubeconfig string
LabelWhiteList utils.RegexpVal
FeatureRulesController bool
CrdController bool
EnableNodeFeatureApi bool
NoPublish bool
EnableTaints bool
@ -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