diff --git a/charts/Chart.yaml b/charts/Chart.yaml index 172ba8594..bf3d1e04e 100644 --- a/charts/Chart.yaml +++ b/charts/Chart.yaml @@ -20,7 +20,7 @@ kubeVersion: ">=1.16.0" # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.0.1 +version: 0.0.2 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/README.md b/charts/README.md index cb6b133d8..250cc5c55 100644 --- a/charts/README.md +++ b/charts/README.md @@ -41,11 +41,71 @@ $ helm uninstall karmada -n karmada-system ``` The command removes all the Kubernetes components associated with the chart and deletes the release. + +## Example +### 1. Install agent +Edited values.yaml +```YAML +installMode: "agent" +agent: + clusterName: "member" + ## kubeconfig of the karmada + kubeconfig: + caCrt: | + -----BEGIN CERTIFICATE----- + XXXXXXXXXXXXXXXXXXXXXXXXXXX + -----END CERTIFICATE----- + crt: | + -----BEGIN CERTIFICATE----- + XXXXXXXXXXXXXXXXXXXXXXXXXXX + -----END CERTIFICATE----- + key: | + -----BEGIN RSA PRIVATE KEY----- + XXXXXXXXXXXXXXXXXXXXXXXXXXX + -----END RSA PRIVATE KEY----- + server: "https://apiserver.karmada" +``` +Execute command (switch to the `root` directory of the repo, and sets the `current-context` in a kubeconfig file) +```console +$ kubectl config use-context member +$ helm install karmada-agent -n karmada-system --create-namespace ./charts +``` +### 2. Install component +Edited values.yaml +```YAML +installMode: "component" +components: [ + "schedulerEstimator" +] +schedulerEstimator: + clusterName: "member" + ## kubeconfig of the member cluster + kubeconfig: + caCrt: | + -----BEGIN CERTIFICATE----- + XXXXXXXXXXXXXXXXXXXXXXXXXXX + -----END CERTIFICATE----- + crt: | + -----BEGIN CERTIFICATE----- + XXXXXXXXXXXXXXXXXXXXXXXXXXX + -----END CERTIFICATE----- + key: | + -----BEGIN RSA PRIVATE KEY----- + XXXXXXXXXXXXXXXXXXXXXXXXXXX + -----END RSA PRIVATE KEY----- + server: "https://apiserver.member" +``` +Execute command (switch to the `root` directory of the repo, and sets the `current-context` in a kubeconfig file) +```console +$ kubectl config use-context host +$ helm install karmada-scheduler-estimator -n karmada-system ./charts +``` ## Configuration | Name | Description | Value | | ------------------------- | ----------------------------------------------- | ----- | -| `installMode` | InstallMode "host" and "agent" are provided, "host" means install karmada in the control-cluster, "agent" means install agent client in the member cluster | `"host"`| +| `installMode` | InstallMode "host", "agent" and "component" 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 | `"host"`| | `clusterDomain` | Default cluster domain for karmada | `"cluster.local"` | +| `components` | Selected components list, selectable values: "schedulerEstimator" | `[]` | |`certs.mode`| Mode "auto" and "custom" are provided, "auto" means auto generate certificate, "custom" means use user certificate |`"auto"`| |`certs.auto.expiry`| Expiry of the certificate |`"43800h"`| |`certs.auto.hosts`| Hosts of the certificate |`["kubernetes.default.svc","*.etcd.karmada-system.svc.cluster.local","*.karmada-system.svc.cluster.local","*.karmada-system.svc","localhost","127.0.0.1"]`| @@ -139,3 +199,20 @@ The command removes all the Kubernetes components associated with the chart and |`kubeControllerManager.nodeSelector`| Node selector of the kube-controller-manager |`{}`| |`kubeControllerManager.affinity`| Affinity of the kube-controller-manager |`{}`| |`kubeControllerManager.tolerations`| Tolerations of the kube-controller-manager |`[]`| +|`schedulerEstimator.clusterName`| Name of the member cluster |`""`| +|`schedulerEstimator.kubeconfig.caCrt`| CA CRT of the certificate |`""`| +|`schedulerEstimator.kubeconfig.crt`| CRT of the certificate |`""`| +|`schedulerEstimator.kubeconfig.key`| KEY of the certificate |`""`| +|`schedulerEstimator.kubeconfig.server`| API-server of the member cluster |`""`| +|`schedulerEstimator.labels`| Labels of the scheduler-estimator deployment |`{}`| +|`schedulerEstimator.replicaCount`| Target replicas of the scheduler-estimator |`1`| +|`schedulerEstimator.podLabels`| Labels of the scheduler-estimator pods |`{}`| +|`schedulerEstimator.podAnnotations`| Annotaions of the scheduler-estimator pods |`{}`| +|`schedulerEstimator.imagePullSecrets`| Image pull secret of the scheduler-estimator |`[]`| +|`schedulerEstimator.image.repository`| Image of the scheduler-estimator |`"swr.ap-southeast-1.myhuaweicloud.com/karmada/karmada-scheduler-estimator"`| +|`schedulerEstimator.image.tag`| Image tag of the scheduler-estimator |`"latest"`| +|`schedulerEstimator.image.pullPolicy`| Image pull policy of the scheduler-estimator |`"IfNotPresent"`| +|`schedulerEstimator.resources`| Resource quota of the scheduler-estimator |`{}`| +|`schedulerEstimator.nodeSelector`| Node selector of the scheduler-estimator |`{}`| +|`schedulerEstimator.affinity`| Affinity of the scheduler-estimator |`{}`| +|`schedulerEstimator.tolerations`| Tolerations of the scheduler-estimator |`[]`| diff --git a/charts/templates/_helpers.tpl b/charts/templates/_helpers.tpl index a76c35763..4b9714a11 100644 --- a/charts/templates/_helpers.tpl +++ b/charts/templates/_helpers.tpl @@ -149,3 +149,19 @@ caBundle: {{ print "{{ ca_crt }}" }} caBundle: {{ b64enc .Values.certs.custom.caCrt }} {{- end }} {{- end -}} + +{{- define "karmada.schedulerEstimator.podLabels" -}} +{{- if .Values.schedulerEstimator.podLabels }} +{{- range $key, $value := .Values.schedulerEstimator.podLabels}} +{{ $key }}: {{ $value }} +{{- end}} +{{- end }} +{{- end -}} + +{{- define "karmada.schedulerEstimator.labels" -}} +{{- if .Values.schedulerEstimator.labels }} +{{- range $key, $value := .Values.schedulerEstimator.labels}} +{{ $key }}: {{ $value }} +{{- end}} +{{- end }} +{{- end -}} diff --git a/charts/templates/karmada_scheduler_estimator.yaml b/charts/templates/karmada_scheduler_estimator.yaml new file mode 100644 index 000000000..a2352e8b1 --- /dev/null +++ b/charts/templates/karmada_scheduler_estimator.yaml @@ -0,0 +1,93 @@ +{{- if and (eq .Values.installMode "component") (has "schedulerEstimator" .Values.components) }} +{{ $namespace := include "karmada.namespace" .}} +{{ $clusterName := .Values.schedulerEstimator.clusterName }} +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: karmada-scheduler-estimator-{{ $clusterName }} + namespace: {{ $namespace }} + labels: + cluster: {{ $clusterName }} + {{- include "karmada.schedulerEstimator.labels" . | nindent 4}} +spec: + replicas: {{ .Values.schedulerEstimator.replicaCount }} + selector: + matchLabels: + app: karmada-scheduler-estimator-{{ $clusterName }} + {{- include "karmada.schedulerEstimator.labels" . | nindent 6}} + template: + metadata: + {{- with .Values.schedulerEstimator.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + app: karmada-scheduler-estimator-{{ $clusterName }} + {{- include "karmada.schedulerEstimator.labels" . | nindent 8}} + {{- include "karmada.schedulerEstimator.podLabels" . | nindent 8}} + spec: + {{- with .Values.schedulerEstimator.tolerations}} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: karmada-scheduler-estimator + image: "{{ .Values.schedulerEstimator.image.repository }}:{{ .Values.schedulerEstimator.image.tag | default "latest" }}" + imagePullPolicy: {{ .Values.schedulerEstimator.image.pullPolicy }} + command: + - /bin/karmada-scheduler-estimator + - --kubeconfig=/etc/{{ $clusterName }}-kubeconfig + - --cluster-name={{ $clusterName }} + volumeMounts: + - name: member-kubeconfig + subPath: {{ $clusterName }}-kubeconfig + mountPath: /etc/{{ $clusterName }}-kubeconfig + volumes: + - name: member-kubeconfig + secret: + secretName: {{ $clusterName }}-kubeconfig +--- +apiVersion: v1 +kind: Service +metadata: + name: karmada-scheduler-estimator-{{ $clusterName }} + namespace: {{ $namespace }} + labels: + cluster: {{ $clusterName }} +spec: + selector: + app: karmada-scheduler-estimator-{{ $clusterName }} + {{- include "karmada.schedulerEstimator.labels" . | nindent 4}} + ports: + - protocol: TCP + port: 10352 + targetPort: 10352 +--- +apiVersion: v1 +kind: Secret +metadata: + name: {{ $clusterName }}-kubeconfig + namespace: {{ $namespace }} +stringData: + {{ $clusterName }}-kubeconfig: |- + apiVersion: v1 + kind: Config + clusters: + - cluster: + certificate-authority-data: {{ b64enc .Values.schedulerEstimator.kubeconfig.caCrt }} + insecure-skip-tls-verify: false + server: {{ .Values.schedulerEstimator.kubeconfig.server }} + name: {{ $clusterName }}-apiserver + users: + - user: + client-certificate-data: {{ b64enc .Values.schedulerEstimator.kubeconfig.crt }} + client-key-data: {{ b64enc .Values.schedulerEstimator.kubeconfig.key }} + name: {{ $clusterName }}-apiserver + contexts: + - context: + cluster: {{ $clusterName }}-apiserver + user: {{ $clusterName }}-apiserver + name: {{ $clusterName }}-apiserver + current-context: {{ $clusterName }}-apiserver +{{- end }} diff --git a/charts/values.yaml b/charts/values.yaml index 884a53e30..811e45831 100644 --- a/charts/values.yaml +++ b/charts/values.yaml @@ -5,11 +5,18 @@ ## @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" ## @param clusterDomain default domain for karmada clusterDomain: "cluster.local" +## @param components component list +components: [] + # components: [ + # "schedulerEstimator" + # ] + ## karmada certificate config certs: ## @param certs.mode "auto" and "custom" are provided @@ -63,7 +70,7 @@ scheduler: repository: swr.ap-southeast-1.myhuaweicloud.com/karmada/karmada-scheduler ## @param scheduler.image.pullPolicy pull policy of image pullPolicy: IfNotPresent - ## @param scheduler.image.tag verrides the image tag whose default is the latest + ## @param scheduler.image.tag overrides the image tag whose default is the latest tag: latest ## @param scheduler.resources resources: { } @@ -102,7 +109,7 @@ webhook: repository: swr.ap-southeast-1.myhuaweicloud.com/karmada/karmada-webhook ## @param webhook.image.pullPolicy pull policy of image pullPolicy: IfNotPresent - ## @param webhook.image.tag verrides the image tag whose default is the latest + ## @param webhook.image.tag overrides the image tag whose default is the latest tag: latest ## @param webhook.resources resources: { } @@ -141,7 +148,7 @@ controllerManager: repository: swr.ap-southeast-1.myhuaweicloud.com/karmada/karmada-controller-manager ## @param controllerManager.image.pullPolicy pull policy of image pullPolicy: IfNotPresent - ## @param controllerManager.image.tag verrides the image tag whose default is the latest + ## @param controllerManager.image.tag overrides the image tag whose default is the latest tag: latest ## @param controllerManager.resources resources: { } @@ -180,7 +187,7 @@ apiServer: repository: k8s.gcr.io/kube-apiserver ## @param apiServer.image.pullPolicy pull policy of image pullPolicy: IfNotPresent - ## @param apiServer.image.tag verrides the image tag whose default is the latest + ## @param apiServer.image.tag overrides the image tag whose default is the latest tag: "v1.19.1" ## @param apiServer.resources resources: { } @@ -219,7 +226,7 @@ kubeControllerManager: repository: k8s.gcr.io/kube-controller-manager ## @param kubeControllerManager.image.pullPolicy pull policy of image pullPolicy: IfNotPresent - ## @param kubeControllerManager.image.tag verrides the image tag whose default is the latest + ## @param kubeControllerManager.image.tag overrides the image tag whose default is the latest tag: "v1.19.1" ## @param kubeControllerManager.resources resources: @@ -276,13 +283,14 @@ etcd: repository: k8s.gcr.io/etcd ## @param etcd.internal.image.pullPolicy pull policy of image pullPolicy: IfNotPresent - ## @param etcd.internal.image.tag verrides the image tag whose default is the latest + ## @param etcd.internal.image.tag overrides the image tag whose default is the latest tag: "3.4.13-0" ## agent client config agent: ## @param agent.clusterName name of the member cluster clusterName: "" + ## kubeconfig of the karmada kubeconfig: ## @param agent.kubeconfig.caCrt ca of the certificate caCrt: | @@ -317,7 +325,7 @@ agent: repository: swr.ap-southeast-1.myhuaweicloud.com/karmada/karmada-agent ## @param agent.image.pullPolicy pull policy of image pullPolicy: IfNotPresent - ## @param agent.image.tag verrides the image tag whose default is the latest + ## @param agent.image.tag overrides the image tag whose default is the latest tag: latest ## @param agent.resources resources: { } @@ -337,3 +345,62 @@ agent: tolerations: { } # - key: node-role.kubernetes.io/master # operator: Exists + +## karmada scheduler estimator +schedulerEstimator: + ## schedulerEstimator.clusterName the name of the member cluster + clusterName: "" + ## kubeconfig of the member cluster + kubeconfig: + ## @param schedulerEstimator.kubeconfig.caCrt ca of the certificate + caCrt: | + -----BEGIN CERTIFICATE----- + XXXXXXXXXXXXXXXXXXXXXXXXXXX + -----END CERTIFICATE----- + ## @param schedulerEstimator.kubeconfig.crt crt of the certificate + crt: | + -----BEGIN CERTIFICATE----- + XXXXXXXXXXXXXXXXXXXXXXXXXXX + -----END CERTIFICATE----- + ## @param schedulerEstimator.kubeconfig.key key of the certificate + key: | + -----BEGIN RSA PRIVATE KEY----- + XXXXXXXXXXXXXXXXXXXXXXXXXXX + -----END RSA PRIVATE KEY----- + ## @param schedulerEstimator.kubeconfig.server apiserver of the member cluster + server: "" + ## @param schedulerEstimator.labels + labels: {} + ## @param schedulerEstimator.replicaCount target replicas + replicaCount: 1 + ## @param schedulerEstimator.podAnnotations + podAnnotations: { } + ## @param schedulerEstimator.podLabels + podLabels: { } + ## @param schedulerEstimator.imagePullSecrets + imagePullSecrets: [ ] + image: + ## @param schedulerEstimator.image.repository image of the apiserver + repository: swr.ap-southeast-1.myhuaweicloud.com/karmada/karmada-scheduler-estimator + ## @param schedulerEstimator.image.pullPolicy pull policy of image + pullPolicy: IfNotPresent + ## @param schedulerEstimator.image.tag overrides the image tag whose default is the latest + tag: "latest" + ## @param schedulerEstimator.resources + resources: { } + # If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + ## @param schedulerEstimator.nodeSelector + nodeSelector: { } + ## @param schedulerEstimator.affinity + affinity: { } + ## @param schedulerEstimator.tolerations + tolerations: [ ] + # - key: node-role.kubernetes.io/master + # operator: Exists