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

Add parameter to configure health endpoint port

Signed-off-by: Tobias Giese <tgiese@nvidia.com>
This commit is contained in:
Tobias Giese 2024-09-23 10:37:56 +02:00
parent d858501a9f
commit 53ddf081da
No known key found for this signature in database
GPG key ID: 9BBE28558D698365
8 changed files with 31 additions and 22 deletions

View file

@ -34,7 +34,6 @@ import (
const ( const (
// ProgramName is the canonical name of this program // ProgramName is the canonical name of this program
ProgramName = "nfd-master" ProgramName = "nfd-master"
GrpcHealthPort = 8082
) )
func main() { func main() {
@ -108,7 +107,6 @@ func main() {
utils.ConfigureGrpcKlog() utils.ConfigureGrpcKlog()
// Get new NfdMaster instance // Get new NfdMaster instance
args.GrpcHealthPort = GrpcHealthPort
instance, err := master.NewNfdMaster(master.WithArgs(args)) instance, err := master.NewNfdMaster(master.WithArgs(args))
if err != nil { if err != nil {
klog.ErrorS(err, "failed to initialize NfdMaster instance") klog.ErrorS(err, "failed to initialize NfdMaster instance")
@ -149,6 +147,8 @@ func initFlags(flagset *flag.FlagSet) (*master.Args, *master.ConfigOverrideArgs)
" DEPRECATED: will be removed in a future release along with the deprecated gRPC API.") " DEPRECATED: will be removed in a future release along with the deprecated gRPC API.")
flagset.IntVar(&args.MetricsPort, "metrics", 8081, flagset.IntVar(&args.MetricsPort, "metrics", 8081,
"Port on which to expose metrics.") "Port on which to expose metrics.")
flagset.IntVar(&args.GrpcHealthPort, "grpc-health", 8082,
"Port on which to expose the grpc health endpoint.")
flagset.BoolVar(&args.Prune, "prune", false, flagset.BoolVar(&args.Prune, "prune", false,
"Prune all NFD related attributes from all nodes of the cluster and exit.") "Prune all NFD related attributes from all nodes of the cluster and exit.")
flagset.BoolVar(&args.VerifyNodeName, "verify-node-name", false, flagset.BoolVar(&args.VerifyNodeName, "verify-node-name", false,

View file

@ -38,7 +38,6 @@ const (
// ProgramName is the canonical name of this program // ProgramName is the canonical name of this program
ProgramName = "nfd-topology-updater" ProgramName = "nfd-topology-updater"
kubeletSecurePort = 10250 kubeletSecurePort = 10250
GrpcHealthPort = 8082
) )
var DefaultKubeletStateDir = path.Join(string(hostpath.VarDir), "lib", "kubelet") var DefaultKubeletStateDir = path.Join(string(hostpath.VarDir), "lib", "kubelet")
@ -57,7 +56,6 @@ func main() {
utils.ConfigureGrpcKlog() utils.ConfigureGrpcKlog()
// Get new TopologyUpdater instance // Get new TopologyUpdater instance
args.GrpcHealthPort = GrpcHealthPort
instance, err := topology.NewTopologyUpdater(*args, *resourcemonitorArgs) instance, err := topology.NewTopologyUpdater(*args, *resourcemonitorArgs)
if err != nil { if err != nil {
klog.ErrorS(err, "failed to initialize topology updater instance") klog.ErrorS(err, "failed to initialize topology updater instance")
@ -115,6 +113,8 @@ func initFlags(flagset *flag.FlagSet) (*topology.Args, *resourcemonitor.Args) {
"Kube config file.") "Kube config file.")
flagset.IntVar(&args.MetricsPort, "metrics", 8081, flagset.IntVar(&args.MetricsPort, "metrics", 8081,
"Port on which to expose metrics.") "Port on which to expose metrics.")
flagset.IntVar(&args.GrpcHealthPort, "grpc-health", 8082,
"Port on which to expose the grpc health endpoint.")
flagset.DurationVar(&resourcemonitorArgs.SleepInterval, "sleep-interval", time.Duration(60)*time.Second, flagset.DurationVar(&resourcemonitorArgs.SleepInterval, "sleep-interval", time.Duration(60)*time.Second,
"Time to sleep between CR updates. zero means no CR updates on interval basis. [Default: 60s]") "Time to sleep between CR updates. zero means no CR updates on interval basis. [Default: 60s]")
flagset.StringVar(&resourcemonitorArgs.Namespace, "watch-namespace", "*", flagset.StringVar(&resourcemonitorArgs.Namespace, "watch-namespace", "*",

View file

@ -33,7 +33,6 @@ import (
const ( const (
// ProgramName is the canonical name of this program // ProgramName is the canonical name of this program
ProgramName = "nfd-worker" ProgramName = "nfd-worker"
GrpcHealthPort = 8082
) )
func main() { func main() {
@ -80,7 +79,6 @@ func main() {
utils.ConfigureGrpcKlog() utils.ConfigureGrpcKlog()
// Get new NfdWorker instance // Get new NfdWorker instance
args.GrpcHealthPort = GrpcHealthPort
instance, err := worker.NewNfdWorker(worker.WithArgs(args)) instance, err := worker.NewNfdWorker(worker.WithArgs(args))
if err != nil { if err != nil {
klog.ErrorS(err, "failed to initialize NfdWorker instance") klog.ErrorS(err, "failed to initialize NfdWorker instance")
@ -138,6 +136,8 @@ func initFlags(flagset *flag.FlagSet) (*worker.Args, *worker.ConfigOverrideArgs)
"Do not publish feature labels") "Do not publish feature labels")
flagset.IntVar(&args.MetricsPort, "metrics", 8081, flagset.IntVar(&args.MetricsPort, "metrics", 8081,
"Port on which to expose metrics.") "Port on which to expose metrics.")
flagset.IntVar(&args.GrpcHealthPort, "grpc-health", 8082,
"Port on which to expose the grpc health endpoint.")
flagset.StringVar(&args.Options, "options", "", flagset.StringVar(&args.Options, "options", "",
"Specify config options from command line. Config options are specified "+ "Specify config options from command line. Config options are specified "+
"in the same format as in the config file (i.e. json or yaml). These options") "in the same format as in the config file (i.e. json or yaml). These options")

View file

@ -116,6 +116,7 @@ spec:
- "-feature-gates={{ $key }}={{ $value }}" - "-feature-gates={{ $key }}={{ $value }}"
{{- end }} {{- end }}
- "-metrics={{ .Values.master.metricsPort | default "8081" }}" - "-metrics={{ .Values.master.metricsPort | default "8081" }}"
- "-grpc-health={{ .Values.master.healthPort | default "8082" }}"
{{- with .Values.master.extraArgs }} {{- with .Values.master.extraArgs }}
{{- toYaml . | nindent 12 }} {{- toYaml . | nindent 12 }}
{{- end }} {{- end }}

View file

@ -89,7 +89,8 @@ spec:
# Disable kubelet state tracking by giving an empty path # Disable kubelet state tracking by giving an empty path
- "-kubelet-state-dir=" - "-kubelet-state-dir="
{{- end }} {{- end }}
- -metrics={{ .Values.topologyUpdater.metricsPort | default "8081"}} - "-metrics={{ .Values.topologyUpdater.metricsPort | default "8081"}}"
- "-grpc-health={{ .Values.topologyUpdater.healthPort | default "8082" }}"
{{- with .Values.topologyUpdater.extraArgs }} {{- with .Values.topologyUpdater.extraArgs }}
{{- toYaml . | nindent 10 }} {{- toYaml . | nindent 10 }}
{{- end }} {{- end }}

View file

@ -71,19 +71,20 @@ spec:
command: command:
- "nfd-worker" - "nfd-worker"
args: args:
{{- if not .Values.featureGates.NodeFeatureAPI }} {{- if not .Values.featureGates.NodeFeatureAPI }}
- "-server={{ include "node-feature-discovery.fullname" . }}-master:{{ .Values.master.service.port }}" - "-server={{ include "node-feature-discovery.fullname" . }}-master:{{ .Values.master.service.port }}"
{{- 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"
- "-key-file=/etc/kubernetes/node-feature-discovery/certs/tls.key" - "-key-file=/etc/kubernetes/node-feature-discovery/certs/tls.key"
- "-cert-file=/etc/kubernetes/node-feature-discovery/certs/tls.crt" - "-cert-file=/etc/kubernetes/node-feature-discovery/certs/tls.crt"
{{- end }} {{- end }}
# Go over featureGate and add the feature-gate flag # Go over featureGate and add the feature-gate flag
{{- range $key, $value := .Values.featureGates }} {{- range $key, $value := .Values.featureGates }}
- "-feature-gates={{ $key }}={{ $value }}" - "-feature-gates={{ $key }}={{ $value }}"
{{- end }} {{- end }}
- "-metrics={{ .Values.worker.metricsPort | default "8081"}}" - "-metrics={{ .Values.worker.metricsPort | default "8081"}}"
- "-grpc-health={{ .Values.worker.healthPort | default "8082" }}"
{{- with .Values.gc.extraArgs }} {{- with .Values.gc.extraArgs }}
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
@ -125,11 +126,11 @@ spec:
- name: nfd-worker-conf - name: nfd-worker-conf
mountPath: "/etc/kubernetes/node-feature-discovery" mountPath: "/etc/kubernetes/node-feature-discovery"
readOnly: true readOnly: true
{{- if .Values.tls.enable }} {{- if .Values.tls.enable }}
- name: nfd-worker-cert - name: nfd-worker-cert
mountPath: "/etc/kubernetes/node-feature-discovery/certs" mountPath: "/etc/kubernetes/node-feature-discovery/certs"
readOnly: true readOnly: true
{{- end }} {{- end }}
volumes: volumes:
- name: host-boot - name: host-boot
hostPath: hostPath:
@ -166,11 +167,11 @@ spec:
items: items:
- key: nfd-worker.conf - key: nfd-worker.conf
path: nfd-worker.conf path: nfd-worker.conf
{{- if .Values.tls.enable }} {{- if .Values.tls.enable }}
- name: nfd-worker-cert - name: nfd-worker-cert
secret: secret:
secretName: nfd-worker-cert secretName: nfd-worker-cert
{{- end }} {{- end }}
{{- with .Values.worker.nodeSelector }} {{- with .Values.worker.nodeSelector }}
nodeSelector: nodeSelector:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}

View file

@ -58,6 +58,7 @@ master:
# be removed with it in a future release # be removed with it in a future release
port: 8080 port: 8080
metricsPort: 8081 metricsPort: 8081
healthPort: 8082
instance: instance:
featureApi: featureApi:
resyncPeriod: resyncPeriod:
@ -406,6 +407,7 @@ worker:
### <NFD-WORKER-CONF-END-DO-NOT-REMOVE> ### <NFD-WORKER-CONF-END-DO-NOT-REMOVE>
metricsPort: 8081 metricsPort: 8081
healthPort: 8082
daemonsetAnnotations: {} daemonsetAnnotations: {}
podSecurityContext: {} podSecurityContext: {}
# fsGroup: 2000 # fsGroup: 2000
@ -497,6 +499,7 @@ topologyUpdater:
create: true create: true
metricsPort: 8081 metricsPort: 8081
healthPort: 8082
kubeletConfigPath: kubeletConfigPath:
kubeletPodResourcesSockPath: kubeletPodResourcesSockPath:
updateInterval: 60s updateInterval: 60s

View file

@ -180,6 +180,7 @@ API's you need to install the prometheus operator in your cluster.
| `master.hostNetwork` | bool | false | Specifies whether to enable or disable running the container in the host's network namespace | | `master.hostNetwork` | bool | false | Specifies whether to enable or disable running the container in the host's network namespace |
| `master.port` | integer | | Specifies the TCP port that nfd-master listens for incoming requests. **NOTE**: this parameter is related to the deprecated gRPC API and will be removed with it in a future release | | `master.port` | integer | | Specifies the TCP port that nfd-master listens for incoming requests. **NOTE**: this parameter is related to the deprecated gRPC API and will be removed with it in a future release |
| `master.metricsPort` | integer | 8081 | Port on which to expose metrics from components to prometheus operator | | `master.metricsPort` | integer | 8081 | Port on which to expose metrics from components to prometheus operator |
| `master.healthPort` | integer | 8082 | Port on which to expose the grpc health endpoint |
| `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.resyncPeriod` | string | | NFD API controller resync period. | | `master.resyncPeriod` | string | | NFD API controller resync period. |
| `master.extraLabelNs` | array | [] | List of allowed extra label namespaces | | `master.extraLabelNs` | array | [] | List of allowed extra label namespaces |
@ -217,7 +218,8 @@ API's you need to install the prometheus operator in your cluster.
| `worker.*` | dict | | NFD worker daemonset configuration | | `worker.*` | dict | | NFD worker daemonset configuration |
| `worker.enable` | bool | true | Specifies whether nfd-worker should be deployed | | `worker.enable` | bool | true | Specifies whether nfd-worker should be deployed |
| `worker.hostNetwork` | bool | false | Specifies whether to enable or disable running the container in the host's network namespace | | `worker.hostNetwork` | bool | false | Specifies whether to enable or disable running the container in the host's network namespace |
| `worker.metricsPort*` | int | 8081 | Port on which to expose metrics from components to prometheus operator | | `worker.metricsPort` | int | 8081 | Port on which to expose metrics from components to prometheus operator |
| `worker.healthPort` | int | 8082 | Port on which to expose the grpc health endpoint |
| `worker.config` | dict | | NFD worker [configuration](../reference/worker-configuration-reference) | | `worker.config` | dict | | NFD worker [configuration](../reference/worker-configuration-reference) |
| `worker.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 settins | | `worker.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 settins |
| `worker.securityContext` | dict | {} | Container [security settings](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container) | | `worker.securityContext` | dict | {} | Container [security settings](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container) |
@ -252,6 +254,7 @@ API's you need to install the prometheus operator in your cluster.
| `topologyUpdater.serviceAccount.name` | string | | The name of the service account for topology updater to use. If not set and create is true, a name is generated using the fullname template and `-topology-updater` suffix | | `topologyUpdater.serviceAccount.name` | string | | The name of the service account for topology updater to use. If not set and create is true, a name is generated using the fullname template and `-topology-updater` suffix |
| `topologyUpdater.rbac.create` | bool | true | Specifies whether to create [RBAC][rbac] configuration for topology updater | | `topologyUpdater.rbac.create` | bool | true | Specifies whether to create [RBAC][rbac] configuration for topology updater |
| `topologyUpdater.metricsPort` | integer | 8081 | Port on which to expose prometheus metrics | | `topologyUpdater.metricsPort` | integer | 8081 | Port on which to expose prometheus metrics |
| `topologyUpdater.healthPort` | integer | 8082 | Port on which to expose the grpc health endpoint |
| `topologyUpdater.kubeletConfigPath` | string | "" | Specifies the kubelet config host path | | `topologyUpdater.kubeletConfigPath` | string | "" | Specifies the kubelet config host path |
| `topologyUpdater.kubeletPodResourcesSockPath` | string | "" | Specifies the kubelet sock path to read pod resources | | `topologyUpdater.kubeletPodResourcesSockPath` | string | "" | Specifies the kubelet sock path to read pod resources |
| `topologyUpdater.updateInterval` | string | 60s | Time to sleep between CR updates. Non-positive value implies no CR update. | | `topologyUpdater.updateInterval` | string | 60s | Time to sleep between CR updates. Non-positive value implies no CR update. |