feat: kubesphere 4.0 (#6115)

* feat: kubesphere 4.0

Signed-off-by: ci-bot <ci-bot@kubesphere.io>

* feat: kubesphere 4.0

Signed-off-by: ci-bot <ci-bot@kubesphere.io>

---------

Signed-off-by: ci-bot <ci-bot@kubesphere.io>
Co-authored-by: ks-ci-bot <ks-ci-bot@example.com>
Co-authored-by: joyceliu <joyceliu@yunify.com>
This commit is contained in:
KubeSphere CI Bot
2024-09-06 11:05:52 +08:00
committed by GitHub
parent b5015ec7b9
commit 447a51f08b
8557 changed files with 546695 additions and 1146174 deletions

View File

@@ -55,21 +55,116 @@ app.kubernetes.io/instance: {{ .Release.Name }}
Create the name of the service account to use
*/}}
{{- define "ks-core.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "ks-core.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- default "kubesphere" (.Values.serviceAccount).name }}
{{- end }}
{{/*
Create the name of the secret of sa token.
*/}}
{{- define "ks-core.serviceAccountTokenName" -}}
{{- printf "%s-%s" ( include "ks-core.serviceAccountName" . ) "sa-token" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- define "portal.url" -}}
{{- if and .Values.portal.https (.Values.portal.https).port }}
{{- if eq (int .Values.portal.https.port) 443 }}
{{- printf "https://%s" .Values.portal.hostname }}
{{- else }}
{{- printf "https://%s:%d" .Values.portal.hostname (int .Values.portal.https.port) }}
{{- end }}
{{- else }}
{{- if eq (int .Values.portal.http.port) 80 }}
{{- printf "http://%s" .Values.portal.hostname }}
{{- else }}
{{- printf "http://%s:%d" .Values.portal.hostname (int .Values.portal.http.port) }}
{{- end }}
{{- end }}
{{- end }}
{{- define "jwtSecret" -}}
{{- if eq .Values.authentication.issuer.jwtSecret "" }}
{{- with lookup "v1" "ConfigMap" (printf "%s" .Release.Namespace) "kubesphere-config" }}
{{- with (fromYaml (index .data "kubesphere.yaml")) }}
{{- if and .authentication (.authentication).jwtSecret }}
{{- .authentication.jwtSecret }}
{{- else if and .authentication (.authentication).issuer ((.authentication).issuer).jwtSecret }}
{{- .authentication.issuer.jwtSecret }}
{{- else }}
{{- $.Values.authentication.issuer.jwtSecret | default (randAlphaNum 32 ) }}
{{- end }}
{{- else }}
{{- $.Values.authentication.issuer.jwtSecret | default (randAlphaNum 32 ) }}
{{- end }}
{{- else }}
{{- $.Values.authentication.issuer.jwtSecret | default (randAlphaNum 32 ) }}
{{- end }}
{{- else }}
{{- .Values.authentication.issuer.jwtSecret }}
{{- end }}
{{- end }}
{{- define "role" -}}
{{- if eq .Values.role "" }}
{{- with lookup "v1" "ConfigMap" (printf "%s" .Release.Namespace) "kubesphere-config" }}
{{- with (fromYaml (index .data "kubesphere.yaml")) }}
{{- if and .multicluster (.multicluster).clusterRole }}
{{- if eq .multicluster.clusterRole "none" }}
{{- "host" }}
{{- else }}
{{- .multicluster.clusterRole }}
{{- end }}
{{- else }}
{{- $.Values.role | default "host" }}
{{- end }}
{{- else }}
{{- $.Values.role | default "host" }}
{{- end }}
{{- else }}
{{- $.Values.role | default "host" }}
{{- end }}
{{- else }}
{{- .Values.role }}
{{- end }}
{{- end }}
{{- define "hostClusterName" -}}
{{- if eq .Values.hostClusterName "" }}
{{- with lookup "v1" "ConfigMap" (printf "%s" .Release.Namespace) "kubesphere-config" }}
{{- with (fromYaml (index .data "kubesphere.yaml")) }}
{{- if and .multicluster (.multicluster).hostClusterName }}
{{- .multicluster.hostClusterName }}
{{- else }}
{{- $.Values.hostClusterName | default "host" }}
{{- end }}
{{- else }}
{{- $.Values.hostClusterName | default "host" }}
{{- end }}
{{- else }}
{{- $.Values.hostClusterName | default "host" }}
{{- end }}
{{- else }}
{{- .Values.hostClusterName }}
{{- end }}
{{- end }}
{{- define "validateHostClusterName" -}}
{{- $name := . -}}
{{- $pattern := "^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$" -}}
{{- if not (regexMatch $pattern $name) -}}
{{- fail (printf "Invalid hostClusterName '%s': a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character." $name) -}}
{{- else -}}
{{- $name -}}
{{- end -}}
{{- end }}
{{/*
Returns user's password or use default
*/}}
{{- define "getOrDefaultPass" }}
{{- if not .Values.adminPassword -}}
{{- if not .Values.authentication.adminPassword -}}
{{- printf "$2a$10$zcHepmzfKPoxCVCYZr5K7ORPZZ/ySe9p/7IUb/8u./xHrnSX2LOCO" -}}
{{- else -}}
{{- printf "%s" .Values.adminPassword -}}
{{- printf "%s" .Values.authentication.adminPassword -}}
{{- end -}}
{{- end }}
@@ -77,25 +172,28 @@ Returns user's password or use default
Returns user's password or use default. Used by NOTES.txt
*/}}
{{- define "printOrDefaultPass" }}
{{- if not .Values.adminPassword -}}
{{- if not .Values.authentication.adminPassword -}}
{{- printf "P@88w0rd" -}}
{{- else -}}
{{- printf "%s" .Values.adminPassword -}}
{{- printf "%s" .Values.authentication.adminPassword -}}
{{- end -}}
{{- end }}
{{- define "getNodeAddress" -}}
{{- $address := "127.0.0.1"}}
{{- range $index, $node := (lookup "v1" "Node" "" "").items -}}
{{- range $k, $v := $node.status.addresses }}
{{- if (eq $v.type "InternalIP") }}
{{- $address = $v.address }}
{{- break }}
{{- end }}
{{- end }}
{{- if (ne $address "127.0.0.1") }}
{{- break }}
{{- end }}
{{- $found := false }}
{{- with $nodes := lookup "v1" "Node" "" "" }}
{{- range $nodeKey, $node := $nodes.items }}
{{- if (hasKey $node.metadata.labels "node-role.kubernetes.io/control-plane") }}
{{- range $k, $v := $node.status.addresses }}
{{- if and (eq $v.type "InternalIP") (not $found) }}
{{- $address = $v.address }}
{{- $found = true }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- else }}
{{- end }}
{{- printf "%s" $address }}
{{- end }}
{{- end }}