From 153554dd2f4a28d95121028e7dd109acc4bcdc23 Mon Sep 17 00:00:00 2001 From: yuleichun Date: Mon, 29 May 2023 17:49:51 +0800 Subject: [PATCH 1/5] modify codes for an English spelling error --- cmd/controller/app/options/options.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/controller/app/options/options.go b/cmd/controller/app/options/options.go index f5b680c..02e125a 100644 --- a/cmd/controller/app/options/options.go +++ b/cmd/controller/app/options/options.go @@ -63,7 +63,7 @@ func (o *Options) Flags(flag *pflag.FlagSet) error { return fmt.Errorf("nil pointer") } - flag.StringVar(&o.PolicyConfigPath, "policy-config-path", o.PolicyConfigPath, "Path to annotator policy cofig") + flag.StringVar(&o.PolicyConfigPath, "policy-config-path", o.PolicyConfigPath, "Path to annotator policy config") flag.StringVar(&o.PrometheusAddr, "prometheus-address", o.PrometheusAddr, "The address of prometheus, from which we can pull metrics data.") flag.Int32Var(&o.BindingHeapSize, "binding-heap-size", o.BindingHeapSize, "Max size of binding heap size, used to store hot value data.") flag.Int32Var(&o.ConcurrentSyncs, "concurrent-syncs", o.ConcurrentSyncs, "The number of annotator controller workers that are allowed to sync concurrently.") From b97768f3dbd0a26a66bdbf786fdd040af33ece18 Mon Sep 17 00:00:00 2001 From: yuleichun Date: Tue, 6 Jun 2023 14:04:58 +0800 Subject: [PATCH 2/5] add yaml deployment implementation for the crane-scheduler module --- deploy/scheduler/deployment.yaml | 100 ++++++++++++++++++ deploy/scheduler/rbac.yaml | 169 +++++++++++++++++++++++++++++++ 2 files changed, 269 insertions(+) create mode 100644 deploy/scheduler/deployment.yaml create mode 100644 deploy/scheduler/rbac.yaml diff --git a/deploy/scheduler/deployment.yaml b/deploy/scheduler/deployment.yaml new file mode 100644 index 0000000..44c2ff5 --- /dev/null +++ b/deploy/scheduler/deployment.yaml @@ -0,0 +1,100 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: crane-scheduler + namespace: crane-system + labels: + component: scheduler +spec: + replicas: 1 + selector: + matchLabels: + component: scheduler + template: + metadata: + labels: + component: scheduler + spec: + volumes: + - name: scheduler-config + configMap: + name: scheduler-config + defaultMode: 420 + - name: dynamic-scheduler-policy + configMap: + name: dynamic-scheduler-policy + defaultMode: 420 + containers: + - name: crane-scheduler + image: docker.io/gocrane/crane-scheduler:0.0.23 + command: + - /scheduler + - --leader-elect=true + - --config=/etc/kubernetes/kube-scheduler/scheduler-config.yaml + resources: + requests: + cpu: 200m + volumeMounts: + - name: scheduler-config + readOnly: true + mountPath: /etc/kubernetes/kube-scheduler + - name: dynamic-scheduler-policy + readOnly: true + mountPath: /etc/kubernetes + livenessProbe: + httpGet: + path: /healthz + port: 10259 + scheme: HTTPS + initialDelaySeconds: 15 + timeoutSeconds: 1 + periodSeconds: 10 + successThreshold: 1 + failureThreshold: 3 + readinessProbe: + httpGet: + path: /healthz + port: 10259 + scheme: HTTPS + timeoutSeconds: 1 + periodSeconds: 10 + successThreshold: 1 + failureThreshold: 3 + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + imagePullPolicy: IfNotPresent + securityContext: + privileged: false + restartPolicy: Always + terminationGracePeriodSeconds: 30 + dnsPolicy: ClusterFirst + serviceAccountName: scheduler + serviceAccount: scheduler + +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: scheduler-config + namespace: crane-system +data: + scheduler-config.yaml: | + apiVersion: kubescheduler.config.k8s.io/v1beta2 + kind: KubeSchedulerConfiguration + leaderElection: + leaderElect: true + profiles: + - schedulerName: default-scheduler + plugins: + filter: + enabled: + - name: Dynamic + score: + enabled: + - name: Dynamic + weight: 3 + pluginConfig: + - name: Dynamic + args: + policyConfigPath: /etc/kubernetes/policy.yaml \ No newline at end of file diff --git a/deploy/scheduler/rbac.yaml b/deploy/scheduler/rbac.yaml new file mode 100644 index 0000000..97a2a04 --- /dev/null +++ b/deploy/scheduler/rbac.yaml @@ -0,0 +1,169 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: scheduler + namespace: crane-system + +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: scheduler +subjects: + - kind: ServiceAccount + name: scheduler + namespace: crane-system +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: scheduler + +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: scheduler +rules: + - verbs: + - create + - patch + - update + apiGroups: + - '' + - events.k8s.io + resources: + - events + - verbs: + - create + apiGroups: + - coordination.k8s.io + resources: + - leases + - verbs: + - get + - update + apiGroups: + - coordination.k8s.io + resources: + - leases + resourceNames: + - kube-scheduler + - verbs: + - create + apiGroups: + - '' + resources: + - endpoints + - verbs: + - get + - update + apiGroups: + - '' + resources: + - endpoints + resourceNames: + - kube-scheduler + - verbs: + - get + - list + - watch + apiGroups: + - '' + resources: + - nodes + - verbs: + - delete + - get + - list + - watch + apiGroups: + - '' + resources: + - pods + - verbs: + - create + apiGroups: + - '' + resources: + - bindings + - pods/binding + - verbs: + - patch + - update + apiGroups: + - '' + resources: + - pods/status + - verbs: + - get + - list + - watch + apiGroups: + - '' + resources: + - replicationcontrollers + - services + - verbs: + - get + - list + - watch + apiGroups: + - apps + - extensions + resources: + - replicasets + - verbs: + - get + - list + - watch + apiGroups: + - apps + resources: + - statefulsets + - verbs: + - get + - list + - watch + apiGroups: + - policy + resources: + - poddisruptionbudgets + - verbs: + - get + - list + - watch + apiGroups: + - '' + resources: + - persistentvolumeclaims + - persistentvolumes + - verbs: + - create + apiGroups: + - authentication.k8s.io + resources: + - tokenreviews + - verbs: + - create + apiGroups: + - authorization.k8s.io + resources: + - subjectaccessreviews + - verbs: + - get + - list + - watch + apiGroups: + - storage.k8s.io + resources: + - '*' + - verbs: + - get + - list + - watch + apiGroups: + - '' + resources: + - configmaps + - namespaces \ No newline at end of file From b30835dda66ac8dd85b289591e510d81d9a7a2b6 Mon Sep 17 00:00:00 2001 From: yuleichun Date: Wed, 7 Jun 2023 09:19:26 +0800 Subject: [PATCH 3/5] feat: add blank line --- deploy/scheduler/deployment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/scheduler/deployment.yaml b/deploy/scheduler/deployment.yaml index 44c2ff5..b25813f 100644 --- a/deploy/scheduler/deployment.yaml +++ b/deploy/scheduler/deployment.yaml @@ -97,4 +97,4 @@ data: pluginConfig: - name: Dynamic args: - policyConfigPath: /etc/kubernetes/policy.yaml \ No newline at end of file + policyConfigPath: /etc/kubernetes/policy.yaml From df84e31efa264f0220855b416b676322906e47d0 Mon Sep 17 00:00:00 2001 From: yuleichun Date: Wed, 7 Jun 2023 15:53:44 +0800 Subject: [PATCH 4/5] modify: optimize yaml code (remove unnecessary configurations) --- deploy/scheduler/deployment.yaml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/deploy/scheduler/deployment.yaml b/deploy/scheduler/deployment.yaml index b25813f..9eace46 100644 --- a/deploy/scheduler/deployment.yaml +++ b/deploy/scheduler/deployment.yaml @@ -48,26 +48,14 @@ spec: port: 10259 scheme: HTTPS initialDelaySeconds: 15 - timeoutSeconds: 1 periodSeconds: 10 - successThreshold: 1 failureThreshold: 3 readinessProbe: httpGet: path: /healthz port: 10259 scheme: HTTPS - timeoutSeconds: 1 - periodSeconds: 10 - successThreshold: 1 - failureThreshold: 3 - terminationMessagePath: /dev/termination-log - terminationMessagePolicy: File - imagePullPolicy: IfNotPresent - securityContext: - privileged: false restartPolicy: Always - terminationGracePeriodSeconds: 30 dnsPolicy: ClusterFirst serviceAccountName: scheduler serviceAccount: scheduler From 13b9f3c7f1f37c0a9f6d21cba446baf49d8eb86d Mon Sep 17 00:00:00 2001 From: yuleichun Date: Wed, 21 Jun 2023 18:03:17 +0800 Subject: [PATCH 5/5] improve: add yaml content for scheduler --- deploy/scheduler/rbac.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/deploy/scheduler/rbac.yaml b/deploy/scheduler/rbac.yaml index 97a2a04..7480e5e 100644 --- a/deploy/scheduler/rbac.yaml +++ b/deploy/scheduler/rbac.yaml @@ -133,6 +133,7 @@ rules: - get - list - watch + - update apiGroups: - '' resources: