feat: merge kubezero and module values by default

This commit is contained in:
Stefan Reimer 2025-06-01 17:27:13 +00:00
parent 49fa7b3c42
commit 9e87f92d45
10 changed files with 39 additions and 34 deletions

View File

@ -83,6 +83,9 @@ function get_kubezero_secret() {
function ensure_kubezero_secret_key() { function ensure_kubezero_secret_key() {
local ns=$1
local secret=$2
local secret="$(kubectl get secret -n $ns $secret -o yaml)" local secret="$(kubectl get secret -n $ns $secret -o yaml)"
local key local key
local val local val
@ -264,6 +267,11 @@ function _helm() {
crds crds
elif [ $action == "dryrun" ]; then
cat $WORKDIR/values.yaml
render
cat $WORKDIR/helm.yaml
elif [ $action == "apply" -o $action == "replace" ]; then elif [ $action == "apply" -o $action == "replace" ]; then
echo "using values to $action of module $module: " echo "using values to $action of module $module: "
cat $WORKDIR/values.yaml cat $WORKDIR/values.yaml

View File

@ -10,7 +10,14 @@ def migrate(values):
# 1.32 # 1.32
try: try:
values["istio-ingress"]["gateway"]["service"]["extraPorts"] = values["istio-ingress"]["gateway"]["service"]["ports"]
values["istio-ingress"]["gateway"]["service"].pop("ports")
except KeyError:
pass pass
try:
values["istio-private-ingress"]["gateway"]["service"]["extraPorts"] = values["istio-private-ingress"]["gateway"]["service"]["ports"]
values["istio-private-ingress"]["gateway"]["service"].pop("ports")
except KeyError: except KeyError:
pass pass

View File

@ -42,17 +42,3 @@ helm.sh/chart: {{ include "kubezero-lib.chart" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/part-of: kubezero app.kubernetes.io/part-of: kubezero
{{- end -}} {{- end -}}
{{- /*
kubezero-lib.util.merge will merge two YAML templates and output the result.
This takes an array of three values:
- the top context
- the template name of the overrides (destination)
- the template name of the base (source)
*/ -}}
{{- define "kubezero-lib.util.merge" -}}
{{- $top := first . -}}
{{- $overrides := fromYaml (include (index . 1) $top) | default (dict ) -}}
{{- $tpl := fromYaml (include (index . 2) $top) | default (dict ) -}}
{{- toYaml (merge $overrides $tpl) -}}
{{- end -}}

View File

@ -12,7 +12,7 @@ kube-prometheus-stack:
kubeStateMetrics: kubeStateMetrics:
enabled: true enabled: true
kubeProxy: kubeProxy:
enabled: true enabled: false
kubeEtcd: kubeEtcd:
enabled: true enabled: true

View File

@ -33,11 +33,11 @@ cilium:
resources: resources:
requests: requests:
cpu: 10m cpu: 50m
memory: 160Mi memory: 256Mi
limits: # limits:
memory: 1Gi # memory: 1Gi
# cpu: 4000m # cpu: 4000m
cni: cni:
binPath: "/usr/libexec/cni" binPath: "/usr/libexec/cni"
@ -68,6 +68,13 @@ cilium:
dnsProxy: dnsProxy:
enableTransparentMode: true enableTransparentMode: true
# For LB support via L2announcement or BGP - on-prem only
# l2announcements:
# enabled: true
# Not needed normally
# externalIPs:
# enabled: true
k8sServiceHost: "" k8sServiceHost: ""
k8sServicePort: 6443 k8sServicePort: 6443
# k8s: # k8s:
@ -80,8 +87,9 @@ cilium:
enabled: false enabled: false
hostRoot: "/sys/fs/cgroup" hostRoot: "/sys/fs/cgroup"
bpf:
preallocateMaps: true
# we need biDirectional so use helm init-container # we need biDirectional so use helm init-container
#bpf:
# autoMount: # autoMount:
# enabled: false # enabled: false

View File

@ -28,7 +28,7 @@ spec:
helm: helm:
skipTests: true skipTests: true
valuesObject: valuesObject:
{{- include (print $name "-values") $ | nindent 8 }} {{- toYaml (merge (omit (index .Values $name) "enabled" "namespace" "retain" "targetRevision") (fromYaml (include (print $name "-values") $ ))) | nindent 8 }}
destination: destination:
server: "https://kubernetes.default.svc" server: "https://kubernetes.default.svc"

View File

@ -67,7 +67,7 @@ gateway:
gatewayProtocol: HTTPS gatewayProtocol: HTTPS
tls: tls:
mode: SIMPLE mode: SIMPLE
{{- with index .Values "istio-ingress" "gateway" "service" "ports" }} {{- with index .Values "istio-ingress" "gateway" "service" "extraPorts" }}
{{- toYaml . | nindent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
@ -93,7 +93,6 @@ certificates:
{{- toYaml $cert.dnsNames | nindent 4 }} {{- toYaml $cert.dnsNames | nindent 4 }}
{{- end }} {{- end }}
{{- end }} {{- end }}
proxyProtocol: {{ default true (index .Values "istio-ingress" "proxyProtocol") }}
{{- with (index .Values "istio-ingress" "hardening") }} {{- with (index .Values "istio-ingress" "hardening") }}
hardening: hardening:
{{- toYaml . | nindent 2 }} {{- toYaml . | nindent 2 }}

View File

@ -64,7 +64,7 @@ gateway:
gatewayProtocol: HTTPS gatewayProtocol: HTTPS
tls: tls:
mode: SIMPLE mode: SIMPLE
{{- with index .Values "istio-private-ingress" "gateway" "service" "ports" }} {{- with index .Values "istio-private-ingress" "gateway" "service" "extraPorts" }}
{{- toYaml . | nindent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
@ -88,7 +88,6 @@ certificates:
dnsNames: dnsNames:
{{- toYaml $cert.dnsNames | nindent 4 }} {{- toYaml $cert.dnsNames | nindent 4 }}
{{- end }} {{- end }}
proxyProtocol: {{ default true (index .Values "istio-private-ingress" "proxyProtocol") }}
{{- with (index .Values "istio-private-ingress" "hardening") }} {{- with (index .Values "istio-private-ingress" "hardening") }}
hardening: hardening:
{{- toYaml . | nindent 2 }} {{- toYaml . | nindent 2 }}

View File

@ -9,25 +9,23 @@ multus:
# {{- end }} # {{- end }}
cilium: cilium:
enabled: true k8sServiceHost: {{ .Values.global.apiServerUrl }}
# {{- if eq .Values.global.platform "aws" }} # {{- if eq .Values.global.platform "aws" }}
# image: # image:
# pullPolicy: Never # pullPolicy: Never
# {{- end }} # {{- end }}
k8sServiceHost: {{ .Values.global.apiServerUrl }}
# k8s: # k8s:
# apiServerURLs: "https://{{ .Values.global.apiServerUrl }}" # apiServerURLs: "https://{{ .Values.global.apiServerUrl }}"
cluster: cluster:
name: {{ .Values.global.clusterName }} name: {{ .Values.global.clusterName }}
{{- with .Values.network.cilium.cluster.id }} {{- with .Values.network.cilium.cluster.id }}
id: {{ . }}
ipam: ipam:
operator: operator:
clusterPoolIPv4PodCIDRList: clusterPoolIPv4PodCIDRList:
- 10.{{ . }}.0.0/16 - 10.{{ . }}.0.0/16
{{- end }} {{- end }}
prometheus: prometheus:
enabled: {{ .Values.metrics.enabled }} enabled: {{ .Values.metrics.enabled }}

View File

@ -61,13 +61,13 @@ storage:
istio: istio:
enabled: false enabled: false
namespace: istio-system namespace: istio-system
targetRevision: 0.24.3 targetRevision: 0.24.6
istio-ingress: istio-ingress:
enabled: false enabled: false
chart: kubezero-istio-gateway chart: kubezero-istio-gateway
namespace: istio-ingress namespace: istio-ingress
targetRevision: 0.24.3 targetRevision: 0.24.6
gateway: gateway:
service: {} service: {}
@ -75,7 +75,7 @@ istio-private-ingress:
enabled: false enabled: false
chart: kubezero-istio-gateway chart: kubezero-istio-gateway
namespace: istio-ingress namespace: istio-ingress
targetRevision: 0.24.3 targetRevision: 0.24.6
gateway: gateway:
service: {} service: {}