Skip to content

Commit

Permalink
chore(t8s-cluster): formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
cwrau committed Sep 26, 2024
1 parent 5bc93b8 commit 464405a
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ openstack

{{- define "t8s-cluster.clusterClass.tlsCipherSuites" -}}
{{- $cipherSuites := list "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256" "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256" "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305" "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384" "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305" "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384" "TLS_RSA_WITH_AES_256_GCM_SHA384" "TLS_RSA_WITH_AES_128_GCM_SHA256" -}}
{{- $cipherSuites | toYaml -}}
{{- toYaml $cipherSuites -}}
{{- end -}}

{{- define "t8s-cluster.clusterClass.preKubeadmCommands" -}}
Expand Down Expand Up @@ -82,7 +82,7 @@ server = {{ printf "https://%s" .registry | quote }}
{{- $featureGates = set $featureGates $featureGate true -}}
{{- end -}}
{{- end -}}
{{- $featureGates | toYaml -}}
{{- toYaml $featureGates -}}
{{- end -}}

{{- define "t8s-cluster.clusterClass.containerdConfig.containerRegistryMirrorConfigs" -}}
Expand All @@ -97,14 +97,14 @@ server = {{ printf "https://%s" .registry | quote }}
"registry.k8s.io"
"registry.opensource.zalan.do"
"registry.teuto.io"
-}}
-}}
{{- $mirroredRegistries := concat $defaultMirroredRegistries (.Values.containerRegistryMirror.additionallyMirroredRegistries | default list) | sortAlpha | uniq -}}
{{- $files := list -}}
{{- range $registry := $mirroredRegistries }}
{{- $files = append $files (dict "content" (include "t8s-cluster.clusterClass.containerdConfig.containerRegistryMirrorConfigs.content" (dict "registry" $registry "endpoint" $.Values.containerRegistryMirror.mirrorEndpoint)) "path" (printf `/etc/containerd/registries.conf.d/%s/hosts.toml` $registry)) -}}
{{- end }}
{{- $files = append $files (dict "content" (include "t8s-cluster.clusterClass.containerdConfig.containerRegistryMirrorConfigs.content" (dict "registry" "registry-1.docker.io" "endpoint" $.Values.containerRegistryMirror.mirrorEndpoint)) "path" "/etc/containerd/registries.conf.d/docker.io/hosts.toml") -}}
{{- $files | toYaml -}}
{{- toYaml $files -}}
{{- end -}}

{{- define "t8s-cluster.clusterClass.configTemplate.files" -}}
Expand All @@ -120,7 +120,7 @@ server = {{ printf "https://%s" .registry | quote }}
{{- if .Values.global.injectedCertificateAuthorities }}
{{- $files = append $files (dict "content" .Values.global.injectedCertificateAuthorities "path" "/usr/local/share/ca-certificates/injected-ca-certs.crt" ) -}}
{{- end }}
{{- $files | toYaml -}}
{{- toYaml $files -}}
{{- end -}}

{{- define "t8s-cluster.clusterClass.args.base" -}}
Expand All @@ -130,10 +130,12 @@ server = {{ printf "https://%s" .registry | quote }}
{{- define "t8s-cluster.clusterClass.args.shared" -}}
{{- $args := include "t8s-cluster.clusterClass.args.base" (dict) | fromYaml -}}
{{- $args = mustMerge (dict
"authorization-always-allow-paths" (list "/healthz" "/readyz" "/livez" "/metrics" | join ",")
"bind-address" "0.0.0.0"
) $args -}}
{{- $args | toYaml -}}
"authorization-always-allow-paths" (list "/healthz" "/readyz" "/livez" "/metrics" | join ",")
"bind-address" "0.0.0.0"
)
$args
-}}
{{- toYaml $args -}}
{{- end -}}

{{- define "t8s-cluster.clusterClass.args.scheduler" -}}
Expand All @@ -149,15 +151,15 @@ server = {{ printf "https://%s" .registry | quote }}
{{- $args := include "t8s-cluster.clusterClass.args.shared" (dict) | fromYaml -}}
{{- $args = mustMerge (include "t8s-cluster.clusterClass.args.sharedController" (dict "context" .context) | fromYaml) $args -}}
{{- $args = set $args "terminated-pod-gc-threshold" "100" -}}
{{- $args | toYaml -}}
{{- toYaml $args -}}
{{- end }}

{{- define "t8s-cluster.clusterClass.apiServer.admissionPlugins" -}}
{{- $admissionPlugins := list "AlwaysPullImages" "NodeRestriction" -}}
{{- if not .excludePatches -}}
{{- $admissionPlugins = concat $admissionPlugins (list "EventRateLimit") -}}
{{- end -}}
{{- $admissionPlugins | toYaml -}}
{{- toYaml $admissionPlugins -}}
{{- end -}}

{{- define "t8s-cluster.clusterClass.args.apiServer" -}}
Expand All @@ -166,5 +168,5 @@ server = {{ printf "https://%s" .registry | quote }}
{{- $args = set $args "enable-admission-plugins" (include "t8s-cluster.clusterClass.apiServer.admissionPlugins" (dict "excludePatches" .excludePatches) | fromYamlArray | join ",") -}}
{{- $args = set $args "event-ttl" "4h" -}}
{{- $args = set $args "tls-cipher-suites" (include "t8s-cluster.clusterClass.tlsCipherSuites" (dict) | fromYamlArray | join ",") -}}
{{- $args | toYaml -}}
{{- toYaml $args -}}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{{- define "t8s-cluster.clusterClass.k0smotronControlPlaneTemplate.specHash" -}}
{{/* the full context is needed for .Files.Get */}}
{{- $inputs := (dict
"spec" (include "t8s-cluster.clusterClass.k0smotronControlPlaneTemplate.spec" $)
) -}}
{{- $inputs := dict "spec" (include "t8s-cluster.clusterClass.k0smotronControlPlaneTemplate.spec" $) -}}
{{- mustToJson $inputs | toString | quote | sha1sum | trunc 8 -}}
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ k0sConfig:
{{- $values := dict "cgroupDriver" "systemd" }}
{{ $values = mustMerge $values (include "t8s-cluster.kubelet.options" (dict) | fromYaml) }}
{{ $values = mustMerge $values (include "t8s-cluster.patches.kubelet.imagePulls" (dict "context" .) | fromYaml) }}
values: {{- $values | toYaml | nindent 10 }}
values: {{- toYaml $values | nindent 10 }}
featureGates: {{- range $featureGate, $components := include "t8s-cluster.featureGates" (dict) | fromYaml }}
- name: {{ $featureGate }}
enabled: true
components: {{- $components | toYaml | nindent 10 }}
components: {{- toYaml $components | nindent 10 }}
{{- end }}
etcd:
persistence:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{{- define "t8s-cluster.clusterClass.kubeadmControlPlaneTemplate.specHash" -}}
{{/* the full context is needed for .Files.Get */}}
{{- $inputs := (dict
"spec" (include "t8s-cluster.clusterClass.kubeadmControlPlaneTemplate.spec" $)
) -}}
{{- $inputs := dict "spec" (include "t8s-cluster.clusterClass.kubeadmControlPlaneTemplate.spec" $) -}}
{{- mustToJson $inputs | toString | quote | sha1sum | trunc 8 -}}
{{- end -}}

Expand All @@ -23,7 +21,7 @@
"admission-control-config.yaml" (required "Missing" .admissionControlConfigFilePath)
"event-rate-limit-config.yaml" (required "Missing" .eventRateLimitConfigFilePath)
"kube-proxy.config.yaml" "/etc/kube-proxy-config.yaml"
-}}
-}}
{{- range $file, $path := $configs -}}
{{- $files = append $files (dict "content" ($.Files.Get (printf "files/%s" $file)) "path" $path) -}}
{{- end -}}
Expand All @@ -33,5 +31,5 @@
{{- end -}}
{{- $apiserverPatch := dict "spec" (dict "containers" (list (dict "name" "kube-apiserver" "resources" (dict "requests" (dict "memory" "2Gi") "limits" (dict "memory" "4Gi"))))) -}}
{{- $files = append $files (include "t8s-cluster.patches.patchFile" (dict "values" $apiserverPatch "target" "kube-apiserver" "component" "memory") | fromYaml) -}}
{{- $files | toYaml -}}
{{- toYaml $files -}}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{- define "t8s-cluster.clusterClass.openStackClusterTemplate.specHash" -}}
{{- $inputs := (dict
{{- $inputs := dict
"spec" (include "t8s-cluster.clusterClass.openStackClusterTemplate.spec" (dict "context" .context))
"infrastructureApiVersion" (include "t8s-cluster.clusterClass.infrastructureApiVersion" (dict))
) -}}
-}}
{{- mustToJson $inputs | toString | quote | sha1sum | trunc 8 -}}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{{- define "t8s-cluster.clusterClass.openStackMachineTemplate.specHash" -}}
{{- $inputs := (dict
{{- $inputs := dict
"spec" (include "t8s-cluster.clusterClass.openStackMachineTemplate.spec" (dict "name" .name "context" .context))
"infrastructureApiVersion" (include "t8s-cluster.clusterClass.infrastructureApiVersion" (dict))
) -}}
-}}
{{- mustToJson $inputs | toString | quote | sha1sum | trunc 8 -}}
{{- end -}}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{{- if and (or (gt (.Values.version.major | int) 1) (ge (.Values.version.minor | int) 27)) (gt (int .Values.global.kubeletExtraConfig.maxParallelImagePulls) 1) -}}
{{- $values = mustMerge $values (dict "serializeImagePulls" false "maxParallelImagePulls" .Values.global.kubeletExtraConfig.maxParallelImagePulls) -}}
{{- end -}}
{{- $values | toYaml -}}
{{- toYaml $values -}}
{{- end -}}

{{- define "t8s-cluster.kubelet.featureGates"}}
Expand All @@ -17,7 +17,7 @@
{{- $options = set $options "protectKernelDefaults" true -}}
{{- $options = set $options "tlsCipherSuites" (include "t8s-cluster.clusterClass.tlsCipherSuites" (dict) | fromYamlArray) -}}
{{- $options = set $options "seccompDefault" true -}}
{{- $options | toYaml -}}
{{- toYaml $options -}}
{{- end -}}

{{- define "t8s-cluster.patches.kubelet.default" -}}
Expand All @@ -35,7 +35,7 @@
{{- end -}}
{{- $patches = append $patches (include "t8s-cluster.patches.patchFile" (dict "values" $cleanupJsonPatch "target" "kubeletconfiguration" "suffix" 0 "patchType" "json") | fromYaml) -}}
{{- $patches = append $patches (include "t8s-cluster.patches.patchFile" (dict "values" $values "target" "kubeletconfiguration" "component" "default") | fromYaml) -}}
{{- $patches | toYaml -}}
{{- toYaml $patches -}}
{{- end -}}

{{- define "t8s-cluster.patches.kubelet.patches" -}}
Expand Down

0 comments on commit 464405a

Please sign in to comment.