Skip to content
Open
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
34 changes: 34 additions & 0 deletions helm/robusta/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,40 @@ If release name contains chart name it will be used as a full name.
{{- end }}
{{- end }}

{{/*
Render dnsPolicy (+ optional dnsConfig) for a component.
Pass the component's dnsConfig dict as the context, e.g.:
{{- include "robusta.dnsConfig" .Values.runner.dnsConfig | nindent 6 }}
When disabled (or unset) it falls back to dnsPolicy: ClusterFirst.
*/}}
{{- define "robusta.dnsConfig" -}}
{{- if and . .enabled -}}
{{- $policy := default "ClusterFirst" .policy -}}
{{- $hasConfig := or .nameservers .searches .options -}}
{{- if and (eq $policy "None") (not .nameservers) -}}
{{- fail "dnsConfig: when dnsPolicy is 'None', you must provide at least one nameserver (Kubernetes requires it)" -}}
{{- end -}}
dnsPolicy: {{ $policy | quote }}
{{- if $hasConfig }}
dnsConfig:
{{- with .nameservers }}
nameservers:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .searches }}
searches:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .options }}
options:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
{{- else -}}
dnsPolicy: ClusterFirst
{{- end -}}
{{- end -}}

{{ define "robusta.configfile" -}}
playbook_repos:
{{ toYaml .Values.playbookRepos | indent 2 }}
Expand Down
1 change: 1 addition & 0 deletions helm/robusta/templates/forwarder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ spec:
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- include "robusta.dnsConfig" .Values.kubewatch.dnsConfig | nindent 6 }}
containers:
- name: kubewatch
# this is a custom version of kubewatch built from https://github.com/aantn/kubewatch
Expand Down
27 changes: 1 addition & 26 deletions helm/robusta/templates/runner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,32 +43,7 @@ spec:
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.runner.dnsConfig.enabled }}
{{- $policy := .Values.runner.dnsConfig.policy }}
{{- $hasConfig := or .Values.runner.dnsConfig.nameservers .Values.runner.dnsConfig.searches .Values.runner.dnsConfig.options }}

{{- if and (eq $policy "None") (not $hasConfig) }}
{{- fail "dnsConfig: when dnsPolicy is 'None', you must set at least one of nameservers, searches, or options" }}
{{- end }}
dnsPolicy: {{ $policy | quote }}
{{- if $hasConfig }}
dnsConfig:
{{- with .Values.runner.dnsConfig.nameservers }}
nameservers:
{{- toYaml . | nindent 10 }}
{{- end }}
{{- with .Values.runner.dnsConfig.searches }}
searches:
{{- toYaml . | nindent 10 }}
{{- end }}
{{- with .Values.runner.dnsConfig.options }}
options:
{{- toYaml . | nindent 10 }}
{{- end }}
{{- end }}
{{ else }}
dnsPolicy: ClusterFirst
{{- end }}
{{- include "robusta.dnsConfig" .Values.runner.dnsConfig | nindent 6 }}
{{- if .Values.runner.hardenedFs }}
initContainers:
- name: setup-venv
Expand Down
6 changes: 6 additions & 0 deletions helm/robusta/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,12 @@ kubewatch:
tolerations: []
annotations: {}
nodeSelector: ~
dnsConfig:
enabled: false
policy: ClusterFirst
nameservers: []
searches: []
options: []
# set to override global.imagePullSecrets for kubewatch; leave empty to inherit the global
imagePullSecrets: []
config:
Expand Down
Loading