Skip to content
Snippets Groups Projects
Commit cec045b1 authored by Guillermo Facundo Colunga's avatar Guillermo Facundo Colunga
Browse files

chart: add defaultNodeSelector for all components

Until now all the components that were not a daemonset and needed to be
deployed on a node contained a config option to indicate a node selector
for the allocation. This commits adds a new global option that allows to
set a node selector that will be applied to all the components that do
not declare one. If any component declares a node selector this last one
will have always more priority.

JIRA Refs:
- MONIT-4003
parent 920ae08f
No related branches found
No related tags found
1 merge request!24[MONIT-4003] Add default node selector for all components
Pipeline #8259417 passed
...@@ -37,6 +37,7 @@ At `docs/installation_guide.md` you will find the initial setup and installation ...@@ -37,6 +37,7 @@ At `docs/installation_guide.md` you will find the initial setup and installation
| logs.fluentbit.scrapeInterval | string | `"15s"` | interval used by the local prometheus (if installed) to scrape metrics from logs fluentbits | | logs.fluentbit.scrapeInterval | string | `"15s"` | interval used by the local prometheus (if installed) to scrape metrics from logs fluentbits |
| logs.fluentbit.service | string | Daemon mode off listening on port 2020. See `values.yaml`. | fluentbit service configuration options in a multiline string | | logs.fluentbit.service | string | Daemon mode off listening on port 2020. See `values.yaml`. | fluentbit service configuration options in a multiline string |
| metrics.enabled | bool | `true` | indicates if all metrics components should be enabled or not. If set to false no metrics component will be installed nor configured | | metrics.enabled | bool | `true` | indicates if all metrics components should be enabled or not. If set to false no metrics component will be installed nor configured |
| metrics.defaultNodeSelector | map | `{}` | if set will be used as `nodeSelector` for those components that allow one |
| metrics.fluentbit.enable | bool | `true` | if true fluentbit daemon set will be installed | | metrics.fluentbit.enable | bool | `true` | if true fluentbit daemon set will be installed |
| metrics.fluentbit.diskMaxCache | string | `5G` | max size for in-disk storage for fluent-bit | | metrics.fluentbit.diskMaxCache | string | `5G` | max size for in-disk storage for fluent-bit |
| metrics.fluentbit.nodeSelector | hash | `"nil"` | fluentbit statefulset node selectors | | metrics.fluentbit.nodeSelector | hash | `"nil"` | fluentbit statefulset node selectors |
......
...@@ -38,10 +38,10 @@ spec: ...@@ -38,10 +38,10 @@ spec:
{{- if .Values.metrics.fluentbit.extraVolumeMounts }} {{- if .Values.metrics.fluentbit.extraVolumeMounts }}
{{- toYaml .Values.metrics.fluentbit.extraVolumeMounts | nindent 6 }} {{- toYaml .Values.metrics.fluentbit.extraVolumeMounts | nindent 6 }}
{{- end }} {{- end }}
{{- with .Values.metrics.fluentbit.nodeSelector }} {{- if or (.Values.metrics.defaultNodeSelector) (.Values.metrics.fluentbit.nodeSelector) }}
nodeSelector: nodeSelector:
{{- toYaml . | nindent 8 }} {{- .Values.metrics.fluentbit.nodeSelector | default .Values.metrics.defaultNodeSelector | toYaml | nindent 8 }}
{{- end }} {{- end }}
volumes: volumes:
- name: config - name: config
configMap: configMap:
......
...@@ -49,8 +49,6 @@ spec: ...@@ -49,8 +49,6 @@ spec:
type: RuntimeDefault type: RuntimeDefault
nodeSelector: nodeSelector:
kubernetes.io/os: linux kubernetes.io/os: linux
{{- with .Values.metrics.kubeState.nodeSelector }} {{- .Values.metrics.kubeState.nodeSelector | default .Values.metrics.defaultNodeSelector | toYaml | nindent 8 }}
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: it-monit-metrics-collector-kubestate serviceAccountName: it-monit-metrics-collector-kubestate
{{- end -}} {{- end -}}
...@@ -11,10 +11,8 @@ spec: ...@@ -11,10 +11,8 @@ spec:
retention: {{ .Values.metrics.prometheus.server.retention }} retention: {{ .Values.metrics.prometheus.server.retention }}
externalLabels: externalLabels:
k8s_cluster_name: {{ .Values.kubernetes.clusterName }} k8s_cluster_name: {{ .Values.kubernetes.clusterName }}
{{- with .Values.metrics.prometheus.server.nodeSelector }}
nodeSelector: nodeSelector:
{{- toYaml . | nindent 6 }} {{- .Values.metrics.prometheus.server.nodeSelector | default .Values.metrics.defaultNodeSelector | toYaml | nindent 4 }}
{{- end }}
serviceAccountName: it-monit-metrics-collector-prometheus serviceAccountName: it-monit-metrics-collector-prometheus
resources: resources:
requests: requests:
......
...@@ -44,9 +44,7 @@ spec: ...@@ -44,9 +44,7 @@ spec:
readOnlyRootFilesystem: true readOnlyRootFilesystem: true
nodeSelector: nodeSelector:
kubernetes.io/os: linux kubernetes.io/os: linux
{{- with .Values.metrics.prometheus.operator.nodeSelector }} {{- .Values.metrics.prometheus.operator.nodeSelector | default .Values.metrics.defaultNodeSelector | toYaml | nindent 8 }}
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext: securityContext:
runAsNonRoot: true runAsNonRoot: true
runAsUser: 65534 runAsUser: 65534
......
...@@ -24,6 +24,9 @@ metrics: ...@@ -24,6 +24,9 @@ metrics:
# -- indicates if all metrics components should be enabled or not. If set to false no metrics component will be installed nor configured # -- indicates if all metrics components should be enabled or not. If set to false no metrics component will be installed nor configured
enabled: true enabled: true
# -- the default node selector will be applied when possible. In to the following components: metrics collectors (prometheus and fluentbit), metrics exporters (kube state).
defaultNodeSelector: {}
# Node exporter is used to scrape node resources metrics like cpu, memory # Node exporter is used to scrape node resources metrics like cpu, memory
# or network. # or network.
nodeExporter: nodeExporter:
...@@ -42,6 +45,7 @@ metrics: ...@@ -42,6 +45,7 @@ metrics:
# Kube state is used to scrape metrics from kubernetes api, like limits # Kube state is used to scrape metrics from kubernetes api, like limits
# and resources. # and resources.
kubeState: kubeState:
# If set it will override the metrics.defaultNodeSelector.
nodeSelector: {} nodeSelector: {}
# -- if true kube state will be installed together with a service monitor # -- if true kube state will be installed together with a service monitor
enabled: true enabled: true
...@@ -62,6 +66,7 @@ metrics: ...@@ -62,6 +66,7 @@ metrics:
enabled: true enabled: true
# -- specific configuration for the prometheus operator # -- specific configuration for the prometheus operator
operator: operator:
# If set it will override the metrics.defaultNodeSelector.
nodeSelector: {} nodeSelector: {}
resources: resources:
requests: requests:
...@@ -71,6 +76,7 @@ metrics: ...@@ -71,6 +76,7 @@ metrics:
cpu: "100m" cpu: "100m"
memory: "100Mi" memory: "100Mi"
server: server:
# If set it will override the metrics.defaultNodeSelector.
nodeSelector: {} nodeSelector: {}
# -- prometheus version to use by the local cluster prometheus # -- prometheus version to use by the local cluster prometheus
version: "v2.50.0" version: "v2.50.0"
...@@ -118,6 +124,7 @@ metrics: ...@@ -118,6 +124,7 @@ metrics:
fluentbit: fluentbit:
# -- if true fluentbit metrics forwarder will be installed # -- if true fluentbit metrics forwarder will be installed
enabled: true enabled: true
# If set it will override the metrics.defaultNodeSelector.
nodeSelector: {} nodeSelector: {}
resources: resources:
requests: requests:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment