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) 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 { if *printVersion {
fmt.Println(ProgramName, version.Get()) fmt.Println(ProgramName, version.Get())
os.Exit(0) os.Exit(0)
@ -100,8 +108,10 @@ func initFlags(flagset *flag.FlagSet) *master.Args {
"Do not publish feature labels") "Do not publish feature labels")
flagset.BoolVar(&args.EnableTaints, "enable-taints", false, flagset.BoolVar(&args.EnableTaints, "enable-taints", false,
"Enable node tainting feature") "Enable node tainting feature")
flagset.BoolVar(&args.FeatureRulesController, "featurerules-controller", true, flagset.BoolVar(&args.CrdController, "featurerules-controller", true,
"Enable controller for NodeFeatureRule objects. Generates node labels based on the rules in these CRs.") "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, flagset.IntVar(&args.Port, "port", 8080,
"Port on which to listen for connections.") "Port on which to listen for connections.")
flagset.BoolVar(&args.Prune, "prune", false, flagset.BoolVar(&args.Prune, "prune", false,

View file

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

View file

@ -17,6 +17,7 @@ master:
featureApi: featureApi:
extraLabelNs: [] extraLabelNs: []
resourceLabels: [] resourceLabels: []
crdController: null
featureRulesController: null featureRulesController: null
deploymentAnnotations: {} deploymentAnnotations: {}
replicaCount: 1 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.instance` | string | | Instance name. Used to separate annotation namespaces for multiple parallel deployments |
| `master.extraLabelNs` | array | [] | List of allowed extra label namespaces | | `master.extraLabelNs` | array | [] | List of allowed extra label namespaces |
| `master.resourceLabels` | array | [] | List of labels to be registered as extended resources | | `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.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.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)| | `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 nfd-master -no-publish
``` ```
### -featurerules-controller ### -crd-controller
The `-featurerules-controller` flag controlers the processing of The `-crd-controller` flag specifies whether the NFD CRD API controller is
NodeFeatureRule objects, effectively enabling/disabling labels from these enabled or not. The controller is responsible for processing NodeFeature and
custom labeling rules. NodeFeatureRule objects.
Default: *true* Default: *true*
Example: Example:
```bash ```bash
nfd-master -featurerules-controller=false nfd-master -crd-controller=false
``` ```
### -featurerules-controller
**DEPRECATED**: use [`-crd-controller`](#-crd-controller) instead.
### -label-whitelist ### -label-whitelist
The `-label-whitelist` specifies a regular expression for filtering feature The `-label-whitelist` specifies a regular expression for filtering feature

View file

@ -62,21 +62,21 @@ type Annotations map[string]string
// Args holds command line arguments // Args holds command line arguments
type Args struct { type Args struct {
CaFile string CaFile string
CertFile string CertFile string
ExtraLabelNs utils.StringSetVal ExtraLabelNs utils.StringSetVal
Instance string Instance string
KeyFile string KeyFile string
Kubeconfig string Kubeconfig string
LabelWhiteList utils.RegexpVal LabelWhiteList utils.RegexpVal
FeatureRulesController bool CrdController bool
EnableNodeFeatureApi bool EnableNodeFeatureApi bool
NoPublish bool NoPublish bool
EnableTaints bool EnableTaints bool
Port int Port int
Prune bool Prune bool
VerifyNodeName bool VerifyNodeName bool
ResourceLabels utils.StringSetVal ResourceLabels utils.StringSetVal
} }
type NfdMaster interface { type NfdMaster interface {
@ -154,7 +154,7 @@ func (m *nfdMaster) Run() error {
return m.prune() return m.prune()
} }
if m.args.FeatureRulesController { if m.args.CrdController {
kubeconfig, err := m.getKubeconfig() kubeconfig, err := m.getKubeconfig()
if err != nil { if err != nil {
return err return err