Skip to content

Commit

Permalink
Update the Helm chart with metrics settings
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Wall <richard.wall@venafi.com>
  • Loading branch information
wallrj committed Jun 27, 2024
1 parent 990886f commit a824729
Show file tree
Hide file tree
Showing 5 changed files with 273 additions and 4 deletions.
82 changes: 82 additions & 0 deletions deploy/charts/csi-driver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,88 @@

<!-- AUTO-GENERATED -->

#### **metrics.enabled** ~ `bool`
> Default value:
> ```yaml
> true
> ```
Enable the metrics server on csi-driver pods.
If false, then the other metrics fields below will be ignored.
#### **metrics.podmonitor.enabled** ~ `bool`
> Default value:
> ```yaml
> false
> ```
Create a PodMonitor to add csi-driver to Prometheus.
#### **metrics.podmonitor.namespace** ~ `string`
The namespace that the pod monitor should live in, defaults to the cert-manager-csi-driver namespace.
#### **metrics.podmonitor.prometheusInstance** ~ `string`
> Default value:
> ```yaml
> default
> ```
Specifies the `prometheus` label on the created PodMonitor. This is used when different Prometheus instances have label selectors matching different PodMonitors.
#### **metrics.podmonitor.interval** ~ `string`
> Default value:
> ```yaml
> 60s
> ```
The interval to scrape metrics.
#### **metrics.podmonitor.scrapeTimeout** ~ `string`
> Default value:
> ```yaml
> 30s
> ```
The timeout before a metrics scrape fails.
#### **metrics.podmonitor.labels** ~ `object`
> Default value:
> ```yaml
> {}
> ```
Additional labels to add to the PodMonitor.
#### **metrics.podmonitor.annotations** ~ `object`
> Default value:
> ```yaml
> {}
> ```
Additional annotations to add to the PodMonitor.
#### **metrics.podmonitor.honorLabels** ~ `bool`
> Default value:
> ```yaml
> false
> ```
Keep labels from scraped data, overriding server-side labels.
#### **metrics.podmonitor.endpointAdditionalProperties** ~ `object`
> Default value:
> ```yaml
> {}
> ```
EndpointAdditionalProperties allows setting additional properties on the endpoint such as relabelings, metricRelabelings etc.
For example:
```yaml
endpointAdditionalProperties:
relabelings:
- action: replace
sourceLabels:
- __meta_kubernetes_pod_node_name
targetLabel: instance
```
#### **image.registry** ~ `string`
Target image registry. This value is prepended to the target image repository, if set.
Expand Down
2 changes: 2 additions & 0 deletions deploy/charts/csi-driver/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ spec:
ports:
- containerPort: {{.Values.app.livenessProbe.port}}
name: healthz
- containerPort: 9402
name: http-metrics
livenessProbe:
httpGet:
path: /healthz
Expand Down
41 changes: 41 additions & 0 deletions deploy/charts/csi-driver/templates/podmonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{{- if and .Values.metrics.enabled .Values.metrics.podmonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: {{ include "cert-manager-csi-driver.name" . }}
{{- if .Values.metrics.podmonitor.namespace }}
namespace: {{ .Values.metrics.podmonitor.namespace }}
{{- else }}
namespace: {{ .Release.Namespace | quote }}
{{- end }}
labels:
{{- include "cert-manager-csi-driver.labels" . | nindent 4 }}
prometheus: {{ .Values.metrics.podmonitor.prometheusInstance }}
{{- with .Values.metrics.podmonitor.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.metrics.podmonitor.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
jobLabel: {{ include "cert-manager-csi-driver.name" . }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "cert-manager-csi-driver.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Values.metrics.podmonitor.namespace }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace | quote }}
{{- end }}
podMetricsEndpoints:
- port: http-metrics
path: /metrics
interval: {{ .Values.metrics.podmonitor.interval }}
scrapeTimeout: {{ .Values.metrics.podmonitor.scrapeTimeout }}
honorLabels: {{ .Values.metrics.podmonitor.honorLabels }}
{{- with .Values.metrics.podmonitor.endpointAdditionalProperties }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
97 changes: 97 additions & 0 deletions deploy/charts/csi-driver/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
"livenessProbeImage": {
"$ref": "#/$defs/helm-values.livenessProbeImage"
},
"metrics": {
"$ref": "#/$defs/helm-values.metrics"
},
"nodeDriverRegistrarImage": {
"$ref": "#/$defs/helm-values.nodeDriverRegistrarImage"
},
Expand Down Expand Up @@ -237,6 +240,100 @@
"description": "Override the image tag to deploy by setting this variable. If no value is set, the chart's appVersion is used.",
"type": "string"
},
"helm-values.metrics": {
"additionalProperties": false,
"properties": {
"enabled": {
"$ref": "#/$defs/helm-values.metrics.enabled"
},
"podmonitor": {
"$ref": "#/$defs/helm-values.metrics.podmonitor"
}
},
"type": "object"
},
"helm-values.metrics.enabled": {
"default": true,
"description": "Enable the metrics server on csi-driver pods.\nIf false, then the other metrics fields below will be ignored.",
"type": "boolean"
},
"helm-values.metrics.podmonitor": {
"additionalProperties": false,
"properties": {
"annotations": {
"$ref": "#/$defs/helm-values.metrics.podmonitor.annotations"
},
"enabled": {
"$ref": "#/$defs/helm-values.metrics.podmonitor.enabled"
},
"endpointAdditionalProperties": {
"$ref": "#/$defs/helm-values.metrics.podmonitor.endpointAdditionalProperties"
},
"honorLabels": {
"$ref": "#/$defs/helm-values.metrics.podmonitor.honorLabels"
},
"interval": {
"$ref": "#/$defs/helm-values.metrics.podmonitor.interval"
},
"labels": {
"$ref": "#/$defs/helm-values.metrics.podmonitor.labels"
},
"namespace": {
"$ref": "#/$defs/helm-values.metrics.podmonitor.namespace"
},
"prometheusInstance": {
"$ref": "#/$defs/helm-values.metrics.podmonitor.prometheusInstance"
},
"scrapeTimeout": {
"$ref": "#/$defs/helm-values.metrics.podmonitor.scrapeTimeout"
}
},
"type": "object"
},
"helm-values.metrics.podmonitor.annotations": {
"default": {},
"description": "Additional annotations to add to the PodMonitor.",
"type": "object"
},
"helm-values.metrics.podmonitor.enabled": {
"default": false,
"description": "Create a PodMonitor to add csi-driver to Prometheus.",
"type": "boolean"
},
"helm-values.metrics.podmonitor.endpointAdditionalProperties": {
"default": {},
"description": "EndpointAdditionalProperties allows setting additional properties on the endpoint such as relabelings, metricRelabelings etc.\n\nFor example:\nendpointAdditionalProperties:\n relabelings:\n - action: replace\n sourceLabels:\n - __meta_kubernetes_pod_node_name\n targetLabel: instance",
"type": "object"
},
"helm-values.metrics.podmonitor.honorLabels": {
"default": false,
"description": "Keep labels from scraped data, overriding server-side labels.",
"type": "boolean"
},
"helm-values.metrics.podmonitor.interval": {
"default": "60s",
"description": "The interval to scrape metrics.",
"type": "string"
},
"helm-values.metrics.podmonitor.labels": {
"default": {},
"description": "Additional labels to add to the PodMonitor.",
"type": "object"
},
"helm-values.metrics.podmonitor.namespace": {
"description": "The namespace that the pod monitor should live in, defaults to the cert-manager-csi-driver namespace.",
"type": "string"
},
"helm-values.metrics.podmonitor.prometheusInstance": {
"default": "default",
"description": "Specifies the `prometheus` label on the created PodMonitor. This is used when different Prometheus instances have label selectors matching different PodMonitors.",
"type": "string"
},
"helm-values.metrics.podmonitor.scrapeTimeout": {
"default": "30s",
"description": "The timeout before a metrics scrape fails.",
"type": "string"
},
"helm-values.nodeDriverRegistrarImage": {
"additionalProperties": false,
"properties": {
Expand Down
55 changes: 51 additions & 4 deletions deploy/charts/csi-driver/values.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,50 @@
metrics:
# Enable the metrics server on csi-driver pods.
# If false, then the other metrics fields below will be ignored.
enabled: true
podmonitor:
# Create a PodMonitor to add csi-driver to Prometheus.
enabled: false

# The namespace that the pod monitor should live in, defaults
# to the cert-manager-csi-driver namespace.
# +docs:property
# namespace: cert-manager

# Specifies the `prometheus` label on the created PodMonitor. This is
# used when different Prometheus instances have label selectors matching
# different PodMonitors.
prometheusInstance: default

# The interval to scrape metrics.
interval: 60s

# The timeout before a metrics scrape fails.
scrapeTimeout: 30s

# Additional labels to add to the PodMonitor.
labels: {}

# Additional annotations to add to the PodMonitor.
annotations: {}

# Keep labels from scraped data, overriding server-side labels.
honorLabels: false

# EndpointAdditionalProperties allows setting additional properties on the
# endpoint such as relabelings, metricRelabelings etc.
#
# For example:
# endpointAdditionalProperties:
# relabelings:
# - action: replace
# sourceLabels:
# - __meta_kubernetes_pod_node_name
# targetLabel: instance
#
# +docs:property
endpointAdditionalProperties: {}

image:
# Target image registry. This value is prepended to the target image repository, if set.
# For example:
Expand Down Expand Up @@ -130,7 +177,7 @@ nodeSelector:
kubernetes.io/os: linux

# Kubernetes affinity: constraints for pod assignment.
#
#
# For example:
# affinity:
# nodeAffinity:
Expand All @@ -154,15 +201,15 @@ tolerations: []
priorityClassName: ""

openshift:
securityContextConstraint:
securityContextConstraint:
# Include RBAC to allow the DaemonSet to "use" the specified
# SecurityContextConstraints.
#
# This value can either be a boolean true or false, or the string "detect".
# If set to "detect" then the securityContextConstraint is automatically
# If set to "detect" then the securityContextConstraint is automatically
# enabled for openshift installs.
#
# +docs:type=boolean,string,null
enabled: detect
# Name of the SecurityContextConstraints to create RBAC for.
name: privileged
name: privileged

0 comments on commit a824729

Please sign in to comment.