Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

helm: enable prometheus autodiscovery #393

Merged
merged 2 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
3 changes: 2 additions & 1 deletion deployment/helm/balloons/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,18 @@ 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 |
| `nri.runtime.config.pluginRequestTimeout` | "" | set NRI plugin request timeout in NRI config of containerd or CRI-O |
| `nri.runtime.patchConfig` | false | patch NRI configuration in containerd or CRI-O |
| `nri.plugin.index` | 90 | NRI plugin index to register with
| `nri.plugin.annotations` | {} | extra annotations for the plugin's pod |
| `initImage.name` | [ghcr.io/containers/nri-plugins/config-manager](https://ghcr.io/containers/nri-plugins/config-manager) | init container image name |
| `initImage.tag` | unstable | init container image tag |
| `initImage.pullPolicy` | Always | init container image pull policy |
| `tolerations` | [] | specify taint toleration key, operator and effect |
| `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 |
21 changes: 17 additions & 4 deletions deployment/helm/balloons/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ spec:
metadata:
labels:
{{- include "nri-plugin.labels" . | nindent 8 }}
annotations:
prometheus.io/scrape: "true"
{{- if (ne .Values.config.instrumentation.httpEndpoint "") }}
prometheus.io/port: "{{ regexReplaceAll "[^:]*:([0-9][0-9]*)" .Values.config.instrumentation.httpEndpoint "${1}" }}"
{{- end }}
{{- range $name, $value := .Values.nri.plugin.annotations }}
{{ $name }}: "{{ $value }}"
{{- end }}
spec:
{{- with .Values.tolerations }}
tolerations:
Expand Down Expand Up @@ -67,11 +75,16 @@ spec:
- --config-group-label
- {{ .Values.configGroupLabel }}
{{- end }}
{{- if (ne .Values.ports nil) }}
ports:
- containerPort: 8891
protocol: TCP
hostPort: {{ .Values.hostPort }}
name: metrics
{{- range $port := .Values.ports }}
- name: {{ $port.name }}
containerPort: {{ $port.container }}
{{- if (ne $port.host nil) }}
hostPort: {{ $port.host }}
{{- end }}
{{- end }}
{{- end }}
env:
- name: NODE_NAME
valueFrom:
Expand Down
29 changes: 25 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,33 @@
}
}
},
"hostPort": {
"type": "integer"
},
"podPriorityClassNodeCritical": {
"type": "boolean"
},
"ports": {
"type": "array",
"items": {
"type": "object",
"required": [
"name",
"container"
],
"properties": {
"name": {
"type": "string"
},
"container": {
klihub marked this conversation as resolved.
Show resolved Hide resolved
"type": "integer",
"minimum": 1,
"maximum": 65535
},
"host": {
"type": "integer",
"minimum": 1,
"maximum": 65535
}
}
}
}
}
}
17 changes: 15 additions & 2 deletions deployment/helm/balloons/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ config:
log:
source: true
instrumentation:
httpEndpoint: ":8891"
prometheusExport: false
reportPeriod: 60s
samplingRatePerMillion: 0

Expand All @@ -54,15 +56,16 @@ config:
plugin-test:
enableAPIs: false

hostPort: 8891

resources:
klihub marked this conversation as resolved.
Show resolved Hide resolved
cpu: 500m
memory: 512Mi

nri:
plugin:
index: 90
annotations:
# key1: value1
# key2: value2
runtime:
patchConfig: false
# config:
Expand Down Expand Up @@ -112,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, and optionally to the host too
#ports: []
#
# Example
#
# ports:
# - name: lunch
# container: 61453
# #host: 61453 # if you want to expose this as a host-port, too
3 changes: 2 additions & 1 deletion deployment/helm/template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,16 @@ 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 |
| `nri.runtime.config.pluginRequestTimeout` | "" | set NRI plugin request timeout in NRI config of containerd or CRI-O |
| `nri.runtime.patchConfig` | false | patch NRI configuration in containerd or CRI-O |
| `nri.plugin.index` | 90 | NRI plugin index to register with
| `nri.plugin.annotations` | {} | extra annotations for the plugin's pod |
| `initImage.name` | [ghcr.io/containers/nri-plugins/config-manager](https://ghcr.io/containers/nri-plugins/config-manager) | init container image name |
| `initImage.tag` | unstable | init container image tag |
| `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 |
21 changes: 17 additions & 4 deletions deployment/helm/template/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ spec:
metadata:
labels:
{{- include "nri-plugin.labels" . | nindent 8 }}
annotations:
prometheus.io/scrape: "true"
{{- if (ne .Values.config.instrumentation.httpEndpoint "") }}
prometheus.io/port: "{{ regexReplaceAll "[^:]*:([0-9][0-9]*)" .Values.config.instrumentation.httpEndpoint "${1}" }}"
{{- end }}
{{- range $name, $value := .Values.nri.plugin.annotations }}
{{ $name }}: "{{ $value }}"
{{- end }}
spec:
{{- with .Values.tolerations }}
tolerations:
Expand Down Expand Up @@ -60,11 +68,16 @@ spec:
- --config-group-label
- {{ .Values.configGroupLabel }}
{{- end }}
{{- if (ne .Values.ports nil) }}
ports:
- containerPort: 8891
protocol: TCP
hostPort: {{ .Values.hostPort }}
name: metrics
{{- range $port := .Values.ports }}
- name: {{ $port.name }}
containerPort: {{ $port.container }}
{{- if (ne .Values.ports.host nil) }}
hostPort: {{ $port.host }}
{{- end }}
{{- end }}
{{- end }}
env:
- name: NODE_NAME
valueFrom:
Expand Down
29 changes: 25 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,33 @@
}
}
},
"hostPort": {
"type": "integer"
},
"podPriorityClassNodeCritical": {
"type": "boolean"
},
"ports": {
"type": "array",
"items": {
"type": "object",
"required": [
"name",
"container"
],
"properties": {
"name": {
"type": "string"
},
"container": {
"type": "integer",
"minimum": 1,
"maximum": 65535
},
"host": {
"type": "integer",
"minimum": 1,
"maximum": 65535
}
}
}
}
}
}
17 changes: 15 additions & 2 deletions deployment/helm/template/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ config:
klog:
skip_headers: true
instrumentation:
httpEndpoint: ":8891"
prometheusExport: false
reportPeriod: 60s
samplingRatePerMillion: 0

Expand All @@ -29,15 +31,16 @@ config:
plugin-test:
enableAPIs: false

hostPort: 8891

resources:
cpu: 500m
memory: 512Mi

nri:
plugin:
index: 90
annotations:
# key1: value1
# key2: value2
runtime:
patchConfig: false
# config:
Expand Down Expand Up @@ -66,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, and optionally to the host too
#ports: []
#
# Example
#
# ports:
# - name: lunch
# container: 61453
# #host: 61453 # if you want to expose this as a host-port, too
3 changes: 2 additions & 1 deletion deployment/helm/topology-aware/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,18 @@ 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 |
| `nri.runtime.config.pluginRequestTimeout` | "" | set NRI plugin request timeout in NRI config of containerd or CRI-O |
| `nri.runtime.patchConfig` | false | patch NRI configuration in containerd or CRI-O |
| `nri.plugin.index` | 90 | NRI plugin index to register with |
| `nri.plugin.annotations` | {} | extra annotations for the plugin's pod |
| `initImage.name` | [ghcr.io/containers/nri-plugins/config-manager](https://ghcr.io/containers/nri-plugins/config-manager) | init container image name |
| `initImage.tag` | unstable | init container image tag |
| `initImage.pullPolicy` | Always | init container image pull policy |
| `tolerations` | [] | specify taint toleration key, operator and effect |
| `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 |
Loading