Skip to content

Commit

Permalink
Merge pull request karmada-io#4358 from chaosi-zju/feat-estimitor
Browse files Browse the repository at this point in the history
make estimator config in helm values as a list
  • Loading branch information
karmada-bot authored Dec 11, 2023
2 parents e2c6ece + 69a3ced commit 3482ee8
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 62 deletions.
34 changes: 18 additions & 16 deletions charts/karmada/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,22 +159,24 @@ 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"
memberClusters:
- clusterName: "member"
replicaCount: 1
## 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)
Expand Down
51 changes: 28 additions & 23 deletions charts/karmada/templates/karmada-scheduler-estimator.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{{- if and (or (eq .Values.installMode "component") (eq .Values.installMode "host")) (has "schedulerEstimator" .Values.components) }}

{{ $namespace := include "karmada.namespace" .}}
{{ $clusterName := .Values.schedulerEstimator.clusterName }}
{{- range $index, $member := .Values.schedulerEstimator.memberClusters }}

{{ $clusterName := $member.clusterName }}
---
apiVersion: apps/v1
kind: Deployment
Expand All @@ -9,38 +12,38 @@ metadata:
namespace: {{ $namespace }}
labels:
cluster: {{ $clusterName }}
{{- include "karmada.schedulerEstimator.labels" . | nindent 4 }}
{{- include "karmada.schedulerEstimator.labels" $ | nindent 4 }}
spec:
replicas: {{ .Values.schedulerEstimator.replicaCount }}
replicas: {{ $member.replicaCount }}
selector:
matchLabels:
app: karmada-scheduler-estimator-{{ $clusterName }}
{{- include "karmada.schedulerEstimator.labels" . | nindent 6 }}
{{- with .Values.schedulerEstimator.strategy }}
{{- include "karmada.schedulerEstimator.labels" $ | nindent 6 }}
{{- with $.Values.schedulerEstimator.strategy }}
strategy:
{{- toYaml . | nindent 4 }}
{{- end }}
template:
metadata:
{{- with .Values.schedulerEstimator.podAnnotations }}
{{- 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 }}
{{- include "karmada.schedulerEstimator.labels" $ | nindent 8 }}
{{- include "karmada.schedulerEstimator.podLabels" $ | nindent 8 }}
spec:
{{- include "karmada.schedulerEstimator.imagePullSecrets" . | nindent 6 }}
{{- with .Values.schedulerEstimator.tolerations }}
{{- include "karmada.schedulerEstimator.imagePullSecrets" $ | nindent 6 }}
{{- with $.Values.schedulerEstimator.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
automountServiceAccountToken: false
containers:
- name: karmada-scheduler-estimator
image: {{ template "karmada.schedulerEstimator.image" . }}
imagePullPolicy: {{ .Values.schedulerEstimator.image.pullPolicy }}
image: {{ template "karmada.schedulerEstimator.image" $ }}
imagePullPolicy: {{ $.Values.schedulerEstimator.image.pullPolicy }}
command:
- /bin/karmada-scheduler-estimator
- --kubeconfig=/etc/{{ $clusterName }}-kubeconfig
Expand All @@ -59,7 +62,7 @@ spec:
subPath: {{ $clusterName }}-kubeconfig
mountPath: /etc/{{ $clusterName }}-kubeconfig
resources:
{{- toYaml .Values.schedulerEstimator.resources | nindent 12 }}
{{- toYaml $.Values.schedulerEstimator.resources | nindent 12 }}
volumes:
- name: member-kubeconfig
secret:
Expand All @@ -75,7 +78,7 @@ metadata:
spec:
selector:
app: karmada-scheduler-estimator-{{ $clusterName }}
{{- include "karmada.schedulerEstimator.labels" . | nindent 4 }}
{{- include "karmada.schedulerEstimator.labels" $ | nindent 4 }}
ports:
- protocol: TCP
port: 10352
Expand All @@ -92,14 +95,14 @@ stringData:
kind: Config
clusters:
- cluster:
certificate-authority-data: {{ b64enc .Values.schedulerEstimator.kubeconfig.caCrt }}
certificate-authority-data: {{ b64enc $member.kubeconfig.caCrt }}
insecure-skip-tls-verify: false
server: {{ .Values.schedulerEstimator.kubeconfig.server }}
server: {{ $member.kubeconfig.server }}
name: {{ $clusterName }}-apiserver
users:
- user:
client-certificate-data: {{ b64enc .Values.schedulerEstimator.kubeconfig.crt }}
client-key-data: {{ b64enc .Values.schedulerEstimator.kubeconfig.key }}
client-certificate-data: {{ b64enc $member.kubeconfig.crt }}
client-key-data: {{ b64enc $member.kubeconfig.key }}
name: {{ $clusterName }}-apiserver
contexts:
- context:
Expand All @@ -108,22 +111,24 @@ stringData:
name: {{ $clusterName }}-apiserver
current-context: {{ $clusterName }}-apiserver
{{ if .Values.schedulerEstimator.podDisruptionBudget }}
{{ if $.Values.schedulerEstimator.podDisruptionBudget }}
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: karmada-scheduler-estimator-{{ $clusterName }}
namespace: {{ include "karmada.namespace" . }}
namespace: {{ include "karmada.namespace" $ }}
labels:
cluster: {{ $clusterName }}
{{- include "karmada.schedulerEstimator.labels" . | nindent 4 }}
{{- include "karmada.schedulerEstimator.labels" $ | nindent 4 }}
spec:
selector:
matchLabels:
app: karmada-scheduler-estimator-{{ $clusterName }}
{{- include "karmada.schedulerEstimator.labels" . | nindent 6 }}
{{ toYaml .Values.schedulerEstimator.podDisruptionBudget | nindent 2 }}
{{- include "karmada.schedulerEstimator.labels" $ | nindent 6 }}
{{ toYaml $.Values.schedulerEstimator.podDisruptionBudget | nindent 2 }}
{{- end -}}

{{- end }}

{{- end }}
48 changes: 25 additions & 23 deletions charts/karmada/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -746,32 +746,34 @@ agent:

## 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.memberClusters each cluster requires an estimator component, fill in the information for each cluster
memberClusters:
## @param schedulerEstimator.memberClusterInfo[0].clusterName the name of the member cluster
- clusterName: ""
## @param schedulerEstimator.memberClusterInfo[0].replicaCount target replicas
replicaCount: 1
## kubeconfig of the member cluster
kubeconfig:
## @param schedulerEstimator.memberClusterInfo[0].kubeconfig.server apiserver of the member cluster
server: ""
## @param schedulerEstimator.memberClusterInfo[0].kubeconfig.caCrt ca of the certificate
caCrt: |
-----BEGIN CERTIFICATE-----
XXXXXXXXXXXXXXXXXXXXXXXXXXX
-----END CERTIFICATE-----
## @param schedulerEstimator.memberClusterInfo[0].kubeconfig.crt crt of the certificate
crt: |
-----BEGIN CERTIFICATE-----
XXXXXXXXXXXXXXXXXXXXXXXXXXX
-----END CERTIFICATE-----
## @param schedulerEstimator.memberClusterInfo[0].kubeconfig.key key of the certificate
key: |
-----BEGIN RSA PRIVATE KEY-----
XXXXXXXXXXXXXXXXXXXXXXXXXXX
-----END RSA PRIVATE KEY-----
## @param schedulerEstimator.labels labels of the scheduler-estimator deployment
labels:
app: karmada-scheduler-estimator
## @param schedulerEstimator.replicaCount target replicas
replicaCount: 1
## @param schedulerEstimator.podAnnotations annotations of the scheduler-estimator pods
podAnnotations: {}
## @param schedulerEstimator.podLabels labels of the scheduler-estimator pods
Expand Down

0 comments on commit 3482ee8

Please sign in to comment.