Skip to content
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
9 changes: 3 additions & 6 deletions helm/kaap/templates/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,10 @@ spec:
{{- include "kaap.selectorLabels" . | nindent 8 }}
namespace: {{ .Release.Namespace }}
spec:
{{- if and (.Values.nodeSelector) (not .Values.operator.nodeSelector) }}
{{- $nodeSelector := coalesce .Values.operator.nodeSelector .Values.nodeSelector -}}
{{- if $nodeSelector }}
nodeSelector:
{{ toYaml .Values.nodeSelector | indent 8 }}
{{- end }}
{{- if .Values.operator.nodeSelector }}
nodeSelector:
{{ toYaml .Values.operator.nodeSelector | indent 8 }}
{{ toYaml $nodeSelector | indent 8 }}
{{- end }}
{{- if .Values.operator.tolerations }}
tolerations:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,7 @@ private String simulateHelmRendering(List<String> allRbac) {
vars.put(".Values.operator.readinessProbe.periodSeconds", "30");
vars.put(".Values.operator.readinessProbe.successThreshold", "1");
vars.put(".Values.operator.readinessProbe.timeoutSeconds", "10");
vars.put(".Values.nodeSelector", " {}");
vars.put(".Values.operator.nodeSelector", " {}");
vars.put("$nodeSelector", " {}");
vars.put(".Values.operator.tolerations", " []");
vars.put("include \"kaap.name\" .", "kaap");
vars.put("include \"kaap.roleName\" .", "kaap");
Expand All @@ -249,9 +248,9 @@ private String simulateHelmRendering(List<String> allRbac) {
vars.put("include \"kaap.selectorLabels\" . | nindent 8", "{app.kubernetes.io/name: kaap}");
vars.put("include (print $.Template.BasePath \"/configmap.yaml\") . | sha256sum", "sha");
String result = "";
// simulate go templating
// simulate Helm templating
for (String l : allRbac) {
if (l.contains("nodeSelector") || l.contains(".nodeSelector")) { // nodeselector is empty anyway. This resolves duplicate nodeselectors
if (l.contains("{{- $")) { // ignore variable definitions
continue;
}
if (l.contains("{{- if")) { // assume always true and no content other than the if
Expand All @@ -268,7 +267,7 @@ private String simulateHelmRendering(List<String> allRbac) {
result += l + System.lineSeparator();
}
if (result.contains("{{")) {
throw new RuntimeException("Failed to replace all go templating vars, template: " + result);
throw new RuntimeException("Failed to replace all Helm templating vars, template: " + result);
}
return result;
}
Expand Down