diff --git a/charts/karmada-dashboard/templates/_helpers.tpl b/charts/karmada-dashboard/templates/_helpers.tpl index 5cdfe08..dc350ee 100644 --- a/charts/karmada-dashboard/templates/_helpers.tpl +++ b/charts/karmada-dashboard/templates/_helpers.tpl @@ -73,19 +73,6 @@ Return the proper karmada search image name {{ include "common.images.image" (dict "imageRoot" .Values.api.image "global" .Values.global) }} {{- end -}} -{{- define "karmada-dashboard.api.kubeconfig.volume" -}} -{{ $name := include "karmada-dashboard.name" . }} -{{- if eq .Values.installMode "host" -}} -- name: kubeconfig-secret - secret: - secretName: {{ $name }}-kubeconfig -{{- else -}} -- name: kubeconfig-secret - secret: - secretName: {{ .Values.api.kubeconfig }} -{{- end -}} -{{- end -}} - {{/* Return the proper karmada search image name @@ -113,4 +100,4 @@ Return the proper Docker Image Registry Secret Names */}} {{- define "karmada-dashboard.imagePullSecrets" -}} {{ include "common.images.pullSecrets" (dict "images" (list .Values.api.image .Values.web.image) "global" .Values.global) }} -{{- end -}} \ No newline at end of file +{{- end -}} diff --git a/charts/karmada-dashboard/templates/karmada-dashboard-api.yaml b/charts/karmada-dashboard/templates/karmada-dashboard-api.yaml index 2bd5aa5..b0a664d 100644 --- a/charts/karmada-dashboard/templates/karmada-dashboard-api.yaml +++ b/charts/karmada-dashboard/templates/karmada-dashboard-api.yaml @@ -27,6 +27,7 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} spec: + serviceAccountName: karmada-dashboard {{- include "karmada-dashboard.imagePullSecrets" . | nindent 6 }} securityContext: {{- toYaml .Values.api.podSecurityContext | nindent 8 }} @@ -68,13 +69,15 @@ spec: command: - karmada-dashboard-api - --karmada-kubeconfig=/etc/kubeconfig - - --karmada-context=karmada + - --karmada-context={{ .Values.api.kubeconfigContext }} - --kubeconfig=/etc/kubeconfig - - --context=karmada + - --context={{ .Values.api.kubeconfigContext }} - --insecure-bind-address=0.0.0.0 - --bind-address=0.0.0.0 volumes: - {{- include "karmada-dashboard.api.kubeconfig.volume" . | nindent 8 }} + - name: kubeconfig-secret + secret: + secretName: {{ .Values.api.kubeconfigName }} {{- with .Values.api.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/charts/karmada-dashboard/templates/karmada-dashboard-sa.yaml b/charts/karmada-dashboard/templates/karmada-dashboard-sa.yaml new file mode 100644 index 0000000..4b8230a --- /dev/null +++ b/charts/karmada-dashboard/templates/karmada-dashboard-sa.yaml @@ -0,0 +1,34 @@ +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: karmada-dashboard + annotations: + rbac.authorization.kubernetes.io/autoupdate: "true" +roleRef: + kind: ClusterRole + name: cluster-admin + apiGroup: rbac.authorization.k8s.io +subjects: + - kind: ServiceAccount + name: karmada-dashboard + namespace: {{ include "karmada-dashboard.namespace" . }} + +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: karmada-dashboard + namespace: {{ include "karmada-dashboard.namespace" . }} + labels: + kubernetes.io/cluster-service: "true" + addonmanager.kubernetes.io/mode: Reconcile + +--- +apiVersion: v1 +kind: Secret +metadata: + name: karmada-dashboard-secret + namespace: {{ include "karmada-dashboard.namespace" . }} + annotations: + kubernetes.io/service-account.name: karmada-dashboard +type: kubernetes.io/service-account-token diff --git a/charts/karmada-dashboard/templates/karmada-dashboard-web-service.yaml b/charts/karmada-dashboard/templates/karmada-dashboard-web-service.yaml index 75cd8b5..258099d 100644 --- a/charts/karmada-dashboard/templates/karmada-dashboard-web-service.yaml +++ b/charts/karmada-dashboard/templates/karmada-dashboard-web-service.yaml @@ -8,7 +8,7 @@ metadata: spec: type: {{ .Values.web.service.type }} ports: - - port: {{ .Values.api.service.port }} + - port: {{ .Values.web.service.port }} targetPort: http protocol: TCP name: http diff --git a/charts/karmada-dashboard/values.yaml b/charts/karmada-dashboard/values.yaml index d189f90..46bd9f8 100644 --- a/charts/karmada-dashboard/values.yaml +++ b/charts/karmada-dashboard/values.yaml @@ -19,7 +19,7 @@ global: ## See https://yaml.org/spec/1.2/spec.html#id2765878 and ## https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_advanced_syntax.html#yaml-anchors-and-aliases-sharing-variable-values ## for more details about yaml anchors and aliases. -karmadaDashboardImageVersion: &karmadaDashboardImageVersion latest +karmadaDashboardImageVersion: &karmadaDashboardImageVersion main ## Specify the imagePullPolicy of karmada-dashboard images ## Defaults to 'IfNotPresent', you can set to 'Always' in cases of special needs @@ -27,12 +27,6 @@ karmadaDashboardImagePullPolicy: &karmadaDashboardImagePullPolicy IfNotPresent podDisruptionBudget: &podDisruptionBudget { } -## @param installMode "host" and "agent" are provided -## "host" means install karmada in the control-cluster -## "agent" means install agent client in the member cluster -## "component" means install selected components in the control-cluster -installMode: "host" - ingress: enabled: false className: "" @@ -99,8 +93,10 @@ api: rollingUpdate: maxUnavailable: 0 maxSurge: 50% - ## @param apikubeconfig kubeconfig of the api - kubeconfig: karmada-kubeconfig + ## @param api.kubeconfigName secret name of the Karmada kubeconfig + kubeconfigName: karmada-kubeconfig + ## @param api.kubeconfigContext context name used in the Karmada kubeconfig + kubeconfigContext: karmada-apiserver ## @param api.podDisruptionBudget podDisruptionBudget: *podDisruptionBudget podSecurityContext: { } @@ -179,4 +175,4 @@ web: # runAsUser: 1000 service: type: ClusterIP - port: 8000 \ No newline at end of file + port: 8000