Skip to content

Commit

Permalink
Merge pull request #126 from iawia002/re-chart
Browse files Browse the repository at this point in the history
charts: fix several bugs, make the default config work
  • Loading branch information
karmada-bot authored Sep 20, 2024
2 parents efa7448 + 2c37610 commit cfc7af3
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 28 deletions.
15 changes: 1 addition & 14 deletions charts/karmada-dashboard/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 -}}
{{- end -}}
9 changes: 6 additions & 3 deletions charts/karmada-dashboard/templates/karmada-dashboard-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand Down
34 changes: 34 additions & 0 deletions charts/karmada-dashboard/templates/karmada-dashboard-sa.yaml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 6 additions & 10 deletions charts/karmada-dashboard/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,14 @@ 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
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: ""
Expand Down Expand Up @@ -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: { }
Expand Down Expand Up @@ -179,4 +175,4 @@ web:
# runAsUser: 1000
service:
type: ClusterIP
port: 8000
port: 8000

0 comments on commit cfc7af3

Please sign in to comment.