1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2025-03-28 02:37:11 +00:00

nfd-master: add -featurerules-controller flag

Add a new command line flag for disabling/enabling the controller for
NodeFeatureRule objects. In practice, disabling the controller disables
all labels generated from rules in NodeFeatureRule objects.
This commit is contained in:
Markus Lehtonen 2021-06-09 07:41:39 +03:00
parent e6e32a88c3
commit e8872462dc
6 changed files with 38 additions and 16 deletions

View file

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

View file

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

View file

@ -24,6 +24,7 @@ nodeFeatureRule:
master:
instance:
extraLabelNs: []
featureRulesController: true
replicaCount: 1

View file

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

View file

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

View file

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