Skip to content

Commit

Permalink
deployment/helm,config/crd: remove unnecessary hostPort value.
Browse files Browse the repository at this point in the history
Since it's now uneccessary to expose our custom metrics port
on the host side, remove the required and dedicated hostPort
Helm value. Add instead an optional generic 'ports' array to
allow exposing arbitrary ports to the host. Similarly remove
hostPort from the nriplugindeployments CRD.

Signed-off-by: Krisztian Litkey <[email protected]>
  • Loading branch information
klihub committed Nov 4, 2024
1 parent 977710f commit 5092c00
Show file tree
Hide file tree
Showing 13 changed files with 132 additions and 35 deletions.
2 changes: 0 additions & 2 deletions config/crd/bases/config.nri_nriplugindeployments.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ spec:
type: string
description: Define which Nodes the Pods are scheduled on.
type: object
hostPort:
type: integer
nri:
type: object
properties:
Expand Down
2 changes: 1 addition & 1 deletion deployment/helm/balloons/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ customize with their own values, along with the default values.
| `resources.cpu` | 500m | cpu resources for the Pod |
| `resources.memory` | 512Mi | memory qouta for the Pod |
| `extraEnv` | {} | extra environment variables to inject (string map) |
| `hostPort` | 8891 | metrics port to expose on the host |
| `config` | see [helm chart values](tree:/deployment/helm/balloons/values.yaml) for the default configuration | plugin configuration data |
| `configGroupLabel` | config.nri/group | node label for grouping configuration |
| `nri.runtime.config.pluginRegistrationTimeout` | "" | set NRI plugin registration timeout in NRI config of containerd or CRI-O |
Expand All @@ -114,3 +113,4 @@ customize with their own values, along with the default values.
| `affinity` | [] | specify node affinity |
| `nodeSelector` | [] | specify node selector labels |
| `podPriorityClassNodeCritical` | true | enable [marking Pod as node critical](https://kubernetes.io/docs/tasks/administer-cluster/guaranteed-scheduling-critical-addon-pods/#marking-pod-as-critical) |
| `ports` | [] | extra ports to expose to the host |
11 changes: 7 additions & 4 deletions deployment/helm/balloons/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,14 @@ spec:
- --config-group-label
- {{ .Values.configGroupLabel }}
{{- end }}
{{- if (not (eq .Values.ports nil)) }}
ports:
- containerPort: 8891
protocol: TCP
hostPort: {{ .Values.hostPort }}
name: metrics
{{- range $port := .Values.ports }}
- name: {{ $port.name }}
containerPort: {{ $port.container }}
hostPort: {{ $port.host }}
{{- end }}
{{- end }}
env:
- name: NODE_NAME
valueFrom:
Expand Down
30 changes: 26 additions & 4 deletions deployment/helm/balloons/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"$schema": "http://json-schema.org/schema#",
"required": [
"image",
"hostPort",
"resources"
],
"properties": {
Expand Down Expand Up @@ -114,11 +113,34 @@
}
}
},
"hostPort": {
"type": "integer"
},
"podPriorityClassNodeCritical": {
"type": "boolean"
},
"ports": {
"type": "array",
"items": {
"type": "object",
"required": [
"name",
"container",
"host"
],
"properties": {
"name": {
"type": "string"
},
"container": {
"type": "integer",
"minimum": 1,
"maximum": 65535
},
"host": {
"type": "integer",
"minimum": 1,
"maximum": 65535
}
}
}
}
}
}
12 changes: 10 additions & 2 deletions deployment/helm/balloons/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ config:
plugin-test:
enableAPIs: false

hostPort: 8891

resources:
cpu: 500m
memory: 512Mi
Expand Down Expand Up @@ -117,3 +115,13 @@ nodeSelector: []
# autoscaling enough new nodes are brought up to leave room for the
# plugin on each new node.
podPriorityClassNodeCritical: true

# extra ports to expose to the host
#
# Example
#
# # Note: This is not necessary for collecting metrics.
# ports:
# - name: metrics
# container: 8891
# host: 8891
2 changes: 1 addition & 1 deletion deployment/helm/template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ customize with their own values, along with the default values.
| `resources.cpu` | 500m | cpu resources for the Pod |
| `resources.memory` | 512Mi | memory qouta for the Pod |
| `extraEnv` | {} | extra environment variables to inject (string map) |
| `hostPort` | 8891 | metrics port to expose on the host |
| `config` | see [helm chart values](tree:/deployment/helm/template/values.yaml) for the default configuration | plugin configuration data |
| `configGroupLabel` | config.nri/group | node label for grouping configuration |
| `nri.runtime.config.pluginRegistrationTimeout` | "" | set NRI plugin registration timeout in NRI config of containerd or CRI-O |
Expand All @@ -112,3 +111,4 @@ customize with their own values, along with the default values.
| `initImage.pullPolicy` | Always | init container image pull policy |
| `tolerations` | [] | specify taint toleration key, operator and effect |
| `podPriorityClassNodeCritical` | true | enable [marking Pod as node critical](https://kubernetes.io/docs/tasks/administer-cluster/guaranteed-scheduling-critical-addon-pods/#marking-pod-as-critical) |
| `ports` | [] | extra ports to expose to the host |
11 changes: 7 additions & 4 deletions deployment/helm/template/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,14 @@ spec:
- --config-group-label
- {{ .Values.configGroupLabel }}
{{- end }}
{{- if (not (eq .Values.ports nil)) }}
ports:
- containerPort: 8891
protocol: TCP
hostPort: {{ .Values.hostPort }}
name: metrics
{{- range $port := .Values.ports }}
- name: {{ $port.name }}
containerPort: {{ $port.container }}
hostPort: {{ $port.host }}
{{- end }}
{{- end }}
env:
- name: NODE_NAME
valueFrom:
Expand Down
30 changes: 26 additions & 4 deletions deployment/helm/template/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"$schema": "http://json-schema.org/schema#",
"required": [
"image",
"hostPort",
"resources"
],
"properties": {
Expand Down Expand Up @@ -114,11 +113,34 @@
}
}
},
"hostPort": {
"type": "integer"
},
"podPriorityClassNodeCritical": {
"type": "boolean"
},
"ports": {
"type": "array",
"items": {
"type": "object",
"required": [
"name",
"container",
"host"
],
"properties": {
"name": {
"type": "string"
},
"container": {
"type": "integer",
"minimum": 1,
"maximum": 65535
},
"host": {
"type": "integer",
"minimum": 1,
"maximum": 65535
}
}
}
}
}
}
12 changes: 10 additions & 2 deletions deployment/helm/template/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ config:
plugin-test:
enableAPIs: false

hostPort: 8891

resources:
cpu: 500m
memory: 512Mi
Expand Down Expand Up @@ -71,3 +69,13 @@ tolerations: []
# autoscaling enough new nodes are brought up to leave room for the
# plugin on each new node.
podPriorityClassNodeCritical: true

# extra ports to expose to the host
#
# Example
#
# # Note: This is not necessary for collecting metrics.
# ports:
# - name: metrics
# container: 8891
# host: 8891
2 changes: 1 addition & 1 deletion deployment/helm/topology-aware/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ customize with their own values, along with the default values.
| `resources.cpu` | 500m | cpu resources for the Pod |
| `resources.memory` | 512Mi | memory qouta for the Pod |
| `extraEnv` | {} | extra environment variables to inject (string map) |
| `hostPort` | 8891 | metrics port to expose on the host |
| `config` | see [helm chart values](tree:/deployment/helm/topology-aware/values.yaml) for the default configuration | plugin configuration data |
| `configGroupLabel` | config.nri/group | node label for grouping configuration |
| `nri.runtime.config.pluginRegistrationTimeout` | "" | set NRI plugin registration timeout in NRI config of containerd or CRI-O |
Expand All @@ -115,3 +114,4 @@ customize with their own values, along with the default values.
| `affinity` | [] | specify node affinity |
| `nodeSelector` | [] | specify node selector labels |
| `podPriorityClassNodeCritical` | true | enable [marking Pod as node critical](https://kubernetes.io/docs/tasks/administer-cluster/guaranteed-scheduling-critical-addon-pods/#marking-pod-as-critical) |
| `ports` | [] | extra ports to expose to the host |
11 changes: 7 additions & 4 deletions deployment/helm/topology-aware/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,14 @@ spec:
- --config-group-label
- {{ .Values.configGroupLabel }}
{{- end }}
{{- if (not (eq .Values.ports nil)) }}
ports:
- containerPort: 8891
protocol: TCP
hostPort: {{ .Values.hostPort }}
name: metrics
{{- range $port := .Values.ports }}
- name: {{ $port.name }}
containerPort: {{ $port.container }}
hostPort: {{ $port.host }}
{{- end }}
{{- end }}
env:
- name: NODE_NAME
valueFrom:
Expand Down
30 changes: 26 additions & 4 deletions deployment/helm/topology-aware/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"$schema": "http://json-schema.org/schema#",
"required": [
"image",
"hostPort",
"resources"
],
"properties": {
Expand Down Expand Up @@ -114,11 +113,34 @@
}
}
},
"hostPort": {
"type": "integer"
},
"podPriorityClassNodeCritical": {
"type": "boolean"
},
"ports": {
"type": "array",
"items": {
"type": "object",
"required": [
"name",
"container",
"host"
],
"properties": {
"name": {
"type": "string"
},
"container": {
"type": "integer",
"minimum": 1,
"maximum": 65535
},
"host": {
"type": "integer",
"minimum": 1,
"maximum": 65535
}
}
}
}
}
}
12 changes: 10 additions & 2 deletions deployment/helm/topology-aware/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ config:
plugin-test:
enableAPIs: false

hostPort: 8891

resources:
cpu: 500m
memory: 512Mi
Expand Down Expand Up @@ -92,3 +90,13 @@ nodeSelector: []
# autoscaling enough new nodes are brought up to leave room for the
# plugin on each new node.
podPriorityClassNodeCritical: true

# extra ports to expose to the host
#
# Example
#
# # Note: This is not necessary for collecting metrics.
# ports:
# - name: metrics
# container: 8891
# host: 8891

0 comments on commit 5092c00

Please sign in to comment.