Skip to content

Commit

Permalink
Merge pull request #56 from ArangoGutierrez/devel/instance-flag
Browse files Browse the repository at this point in the history
add support for NFD-Master instance flag
  • Loading branch information
k8s-ci-robot authored Apr 20, 2021
2 parents 7117133 + 378e361 commit 0d926be
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions api/v1/nodefeaturediscovery_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
// +k8s:openapi-gen=true
type NodeFeatureDiscoverySpec struct {
Operand OperandSpec `json:"operand"`
Instance string `json:"instance"`
WorkerConfig ConfigMap `json:"workerConfig"`
}

Expand Down
1 change: 0 additions & 1 deletion build/assets/master/0400_master_daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,3 @@ spec:
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]

Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ spec:
spec:
description: NodeFeatureDiscoverySpec defines the desired state of NodeFeatureDiscovery
properties:
instance:
description: Instance name. Used to separate annotation namespaces for multiple parallel deployments.
type: string
operand:
description: OperandSpec describes configuration options for the operand
properties:
Expand All @@ -60,8 +63,7 @@ spec:
type: integer
type: object
workerConfig:
description: ConfigMap describes configuration options for the NFD
worker
description: WorkerConfig describes configuration options for the NFD worker
properties:
configData:
description: BinaryData holds the NFD configuration file
Expand Down
12 changes: 10 additions & 2 deletions controllers/nodefeaturediscovery_controls.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,12 +311,20 @@ func DaemonSet(n NFD) (ResourceStatus, error) {

// update nfd-master service port
if obj.ObjectMeta.Name == "nfd-master" {
var args []string
port := defaultServicePort
if n.ins.Spec.Operand.ServicePort != 0 {
port = n.ins.Spec.Operand.ServicePort
}
portFlag := fmt.Sprintf("--port=%d", port)
obj.Spec.Template.Spec.Containers[0].Args = []string{portFlag}
args = append(args, fmt.Sprintf("--port=%d", port))

// check if running as instance
// https://kubernetes-sigs.github.io/node-feature-discovery/v0.8/advanced/master-commandline-reference.html#-instance
if n.ins.Spec.Instance != "" {
args = append(args, fmt.Sprintf("--instance=%s", n.ins.Spec.Instance))
}

obj.Spec.Template.Spec.Containers[0].Args = args
}

obj.SetNamespace(n.ins.GetNamespace())
Expand Down

0 comments on commit 0d926be

Please sign in to comment.