From 1ab7912a02d3bc99e329b1008feeb9af2c9c2dcc Mon Sep 17 00:00:00 2001 From: Moritz Wiesinger Date: Thu, 29 Sep 2022 10:55:10 +0200 Subject: [PATCH 1/5] remove helm chart Signed-off-by: Moritz Wiesinger --- .../charts/keptn-scheduler/.helmignore | 23 ----- .../install/charts/keptn-scheduler/Chart.yaml | 24 ----- .../install/charts/keptn-scheduler/README.md | 41 -------- .../keptn-scheduler/templates/_helpers.tpl | 52 ---------- .../keptn-scheduler/templates/configmap.yaml | 32 ------ .../keptn-scheduler/templates/deployment.yaml | 50 ---------- .../keptn-scheduler/templates/rbac.yaml | 98 ------------------- .../templates/serviceaccount.yaml | 7 -- .../charts/keptn-scheduler/values.yaml | 37 ------- 9 files changed, 364 deletions(-) delete mode 100644 lfc-scheduler/manifests/install/charts/keptn-scheduler/.helmignore delete mode 100644 lfc-scheduler/manifests/install/charts/keptn-scheduler/Chart.yaml delete mode 100644 lfc-scheduler/manifests/install/charts/keptn-scheduler/README.md delete mode 100644 lfc-scheduler/manifests/install/charts/keptn-scheduler/templates/_helpers.tpl delete mode 100644 lfc-scheduler/manifests/install/charts/keptn-scheduler/templates/configmap.yaml delete mode 100644 lfc-scheduler/manifests/install/charts/keptn-scheduler/templates/deployment.yaml delete mode 100644 lfc-scheduler/manifests/install/charts/keptn-scheduler/templates/rbac.yaml delete mode 100644 lfc-scheduler/manifests/install/charts/keptn-scheduler/templates/serviceaccount.yaml delete mode 100644 lfc-scheduler/manifests/install/charts/keptn-scheduler/values.yaml diff --git a/lfc-scheduler/manifests/install/charts/keptn-scheduler/.helmignore b/lfc-scheduler/manifests/install/charts/keptn-scheduler/.helmignore deleted file mode 100644 index 0e8a0eb36f..0000000000 --- a/lfc-scheduler/manifests/install/charts/keptn-scheduler/.helmignore +++ /dev/null @@ -1,23 +0,0 @@ -# Patterns to ignore when building packages. -# This supports shell glob matching, relative path matching, and -# negation (prefixed with !). Only one pattern per line. -.DS_Store -# Common VCS dirs -.git/ -.gitignore -.bzr/ -.bzrignore -.hg/ -.hgignore -.svn/ -# Common backup files -*.swp -*.bak -*.tmp -*.orig -*~ -# Various IDEs -.project -.idea/ -*.tmproj -.vscode/ diff --git a/lfc-scheduler/manifests/install/charts/keptn-scheduler/Chart.yaml b/lfc-scheduler/manifests/install/charts/keptn-scheduler/Chart.yaml deleted file mode 100644 index 841062bd01..0000000000 --- a/lfc-scheduler/manifests/install/charts/keptn-scheduler/Chart.yaml +++ /dev/null @@ -1,24 +0,0 @@ -apiVersion: v2 -name: keptn-scheduler -description: deploy scheduler plugin as a second scheduler in cluster - -# A chart can be either an 'application' or a 'library' chart. -# -# Application charts are a collection of templates that can be packaged into versioned archives -# to be deployed. -# -# Library charts provide useful utilities or functions for the chart developer. They're included as -# a dependency of application charts to inject those utilities and functions into the rendering -# pipeline. Library charts do not define any templates and therefore cannot be deployed. -type: application - -# 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.23.10 - -# 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 -# follow Semantic Versioning. They should reflect the version the application is using. -appVersion: 0.23.10 - diff --git a/lfc-scheduler/manifests/install/charts/keptn-scheduler/README.md b/lfc-scheduler/manifests/install/charts/keptn-scheduler/README.md deleted file mode 100644 index a74c5a7975..0000000000 --- a/lfc-scheduler/manifests/install/charts/keptn-scheduler/README.md +++ /dev/null @@ -1,41 +0,0 @@ -# Scheduler-plugins as a second scheduler in cluster - -## Installation - -Quick start instructions for the setup and configuration of as-a-second-scheduler using Helm. - -### Prerequisites - -- [Helm](https://helm.sh/docs/intro/quickstart/#install-helm) - -### Installing the chart - -#### Install chart using Helm v3.0+ - -```bash -$ git clone git@github.com::keptn-sandbox/lifecycle-controller.git -$ cd lifecycle-controller/lfc-scheduler/manifests/install/charts -$ helm install keptn-scheduler keptn-scheduler/ -``` - -#### Verify that scheduler and plugin-controller pod are running properly. - -```bash -$ kubectl get deploy -n scheduler-plugins -NAME READY UP-TO-DATE AVAILABLE AGE -keptn-scheduler 1/1 1 1 7s -``` - -### Configuration - -The following table lists the configurable parameters of the scheduler chart and their default values. - -| Parameter | Description | Default | -| --------------------------------------- |-------------------------------|---------------------------------------| -| `scheduler.name` | Scheduler name | `keptn-scheduler` | -| `scheduler.image` | Scheduler image | `` | -| `scheduler.namespace` | Scheduler namespace | `keptn-lifecycle-controller-system` | -| `scheduler.replicaCount` | Scheduler replicaCount | `1` | -| `plugins.enabled` | Plugins enabled by default | `["KLCPermit"]` | -| `plugins.enabled` | Plugins disabled by default | `[""]` | - diff --git a/lfc-scheduler/manifests/install/charts/keptn-scheduler/templates/_helpers.tpl b/lfc-scheduler/manifests/install/charts/keptn-scheduler/templates/_helpers.tpl deleted file mode 100644 index 0f8a475ae4..0000000000 --- a/lfc-scheduler/manifests/install/charts/keptn-scheduler/templates/_helpers.tpl +++ /dev/null @@ -1,52 +0,0 @@ -{{/* -Expand the name of the chart. -*/}} -{{- define "scheduler-plugins-as-a-second-scheduler.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Create a default fully qualified app name. -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). -If release name contains chart name it will be used as a full name. -*/}} -{{- define "scheduler-plugins-as-a-second-scheduler.fullname" -}} -{{- if .Values.fullnameOverride }} -{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} -{{- else }} -{{- $name := default .Chart.Name .Values.nameOverride }} -{{- if contains $name .Release.Name }} -{{- .Release.Name | trunc 63 | trimSuffix "-" }} -{{- else }} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} -{{- end }} -{{- end }} -{{- end }} - -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "scheduler-plugins-as-a-second-scheduler.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Common labels -*/}} -{{- define "scheduler-plugins-as-a-second-scheduler.labels" -}} -helm.sh/chart: {{ include "scheduler-plugins-as-a-second-scheduler.chart" . }} -{{ include "scheduler-plugins-as-a-second-scheduler.selectorLabels" . }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end }} - -{{/* -Selector labels -*/}} -{{- define "scheduler-plugins-as-a-second-scheduler.selectorLabels" -}} -app.kubernetes.io/name: {{ include "scheduler-plugins-as-a-second-scheduler.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} - diff --git a/lfc-scheduler/manifests/install/charts/keptn-scheduler/templates/configmap.yaml b/lfc-scheduler/manifests/install/charts/keptn-scheduler/templates/configmap.yaml deleted file mode 100644 index 07036a13a1..0000000000 --- a/lfc-scheduler/manifests/install/charts/keptn-scheduler/templates/configmap.yaml +++ /dev/null @@ -1,32 +0,0 @@ -{{- if .Values.plugins.enabled }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: scheduler-config - namespace: {{ .Values.scheduler.namespace }} -data: - scheduler-config.yaml: | - apiVersion: kubescheduler.config.k8s.io/v1beta3 - kind: KubeSchedulerConfiguration - leaderElection: - leaderElect: {{ .Values.scheduler.leaderElect }} - profiles: - # Compose all plugins in one profile - - schedulerName: {{ .Values.scheduler.name }} - plugins: - multiPoint: - enabled: - {{- range $.Values.plugins.enabled }} - - name: {{ title . }} - {{- end }} - disabled: - {{- range $.Values.plugins.disabled }} - - name: {{ title . }} - {{- end }} - {{- if $.Values.pluginConfig }} - pluginConfig: {{ toYaml $.Values.pluginConfig | nindent 6 }} - {{- end }} - - {{- /* TODO: wire CRD installation with enabled plugins. */}} -{{- end }} - diff --git a/lfc-scheduler/manifests/install/charts/keptn-scheduler/templates/deployment.yaml b/lfc-scheduler/manifests/install/charts/keptn-scheduler/templates/deployment.yaml deleted file mode 100644 index 288da88d5a..0000000000 --- a/lfc-scheduler/manifests/install/charts/keptn-scheduler/templates/deployment.yaml +++ /dev/null @@ -1,50 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - labels: - component: scheduler - name: {{ .Values.scheduler.name }} - namespace: {{ .Values.scheduler.namespace }} -spec: - selector: - matchLabels: - component: scheduler - replicas: {{ .Values.scheduler.replicaCount }} - template: - metadata: - labels: - component: scheduler - spec: - serviceAccountName: keptn-scheduler - containers: - - command: - - /bin/kube-scheduler - - --config=/etc/kubernetes/scheduler-config.yaml - image: {{ .Values.scheduler.image }} - livenessProbe: - httpGet: - path: /healthz - port: 10259 - scheme: HTTPS - initialDelaySeconds: 15 - name: keptn-scheduler - readinessProbe: - httpGet: - path: /healthz - port: 10259 - scheme: HTTPS - resources: - requests: - cpu: '0.1' - securityContext: - privileged: false - volumeMounts: - - name: scheduler-config - mountPath: /etc/kubernetes - readOnly: true - hostNetwork: false - hostPID: false - volumes: - - name: scheduler-config - configMap: - name: scheduler-config \ No newline at end of file diff --git a/lfc-scheduler/manifests/install/charts/keptn-scheduler/templates/rbac.yaml b/lfc-scheduler/manifests/install/charts/keptn-scheduler/templates/rbac.yaml deleted file mode 100644 index db9981284a..0000000000 --- a/lfc-scheduler/manifests/install/charts/keptn-scheduler/templates/rbac.yaml +++ /dev/null @@ -1,98 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: keptn-scheduler -rules: - - apiGroups: [""] - resources: ["namespaces"] - verbs: ["get", "list", "watch"] - - apiGroups: ["", "events.k8s.io"] - resources: ["events"] - verbs: ["create", "patch", "update"] - - apiGroups: ["coordination.k8s.io"] - resources: ["leases"] - verbs: ["create"] - - apiGroups: ["coordination.k8s.io"] - resourceNames: ["kube-scheduler"] - resources: ["leases"] - verbs: ["get", "update"] - - apiGroups: [""] - resources: ["endpoints"] - verbs: ["create"] - - apiGroups: [""] - resourceNames: ["kube-scheduler"] - resources: ["endpoints"] - verbs: ["get", "update"] - - apiGroups: [""] - resources: ["nodes"] - verbs: ["get", "list", "watch", "patch"] - - apiGroups: [""] - resources: ["pods"] - verbs: ["delete", "get", "list", "watch", "update"] - - apiGroups: [""] - resources: ["bindings", "pods/binding"] - verbs: ["create"] - - apiGroups: [""] - resources: ["pods/status"] - verbs: ["patch", "update"] - - 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: ["get", "list", "watch", "patch", "update"] - - apiGroups: ["authentication.k8s.io"] - resources: ["tokenreviews"] - verbs: ["create"] - - apiGroups: ["authorization.k8s.io"] - resources: ["subjectaccessreviews"] - verbs: ["create"] - - apiGroups: ["storage.k8s.io"] - resources: ["csinodes", "storageclasses" , "csidrivers" , "csistoragecapacities"] - verbs: ["get", "list", "watch"] - - apiGroups: ["topology.node.k8s.io"] - resources: ["noderesourcetopologies"] - verbs: ["*"] - # resources need to be updated with the scheduler plugins used - - apiGroups: ["scheduling.sigs.k8s.io"] - resources: ["podgroups", "elasticquotas"] - verbs: ["get", "list", "watch", "create", "delete", "update", "patch"] - - apiGroups: ["lifecycle.keptn.sh"] - resources: ["keptnworkloadinstances"] - verbs: ["get", "list", "watch"] ---- -kind: ClusterRoleBinding -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: keptn-scheduler -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: keptn-scheduler -subjects: - - kind: ServiceAccount - name: {{ .Values.scheduler.name }} - namespace: {{ .Values.scheduler.namespace }} ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: sched-plugins::extension-apiserver-authentication-reader - namespace: kube-system -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: extension-apiserver-authentication-reader -subjects: - - kind: ServiceAccount - name: {{ .Values.scheduler.name }} - namespace: {{ .Values.scheduler.namespace }} diff --git a/lfc-scheduler/manifests/install/charts/keptn-scheduler/templates/serviceaccount.yaml b/lfc-scheduler/manifests/install/charts/keptn-scheduler/templates/serviceaccount.yaml deleted file mode 100644 index 6c6678bd61..0000000000 --- a/lfc-scheduler/manifests/install/charts/keptn-scheduler/templates/serviceaccount.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ .Values.scheduler.name }} - namespace: {{ .Values.scheduler.namespace }} - - diff --git a/lfc-scheduler/manifests/install/charts/keptn-scheduler/values.yaml b/lfc-scheduler/manifests/install/charts/keptn-scheduler/values.yaml deleted file mode 100644 index a87d4f1f80..0000000000 --- a/lfc-scheduler/manifests/install/charts/keptn-scheduler/values.yaml +++ /dev/null @@ -1,37 +0,0 @@ - -# Default values for scheduler-plugins-as-a-second-scheduler. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. - -scheduler: - name: keptn-scheduler - image: docker.io/odubajdt/kube-scheduler:202209261664175687-v0.24.3 #we still do not have a register setup, edit the Makefile to point to your own register, run 'make push-release-images' copy the resulting image here - namespace: keptn-lifecycle-controller-system - replicaCount: 1 - leaderElect: false - -#controller: -# name: scheduler-plugins-controller -# image: k8s.gcr.io/scheduler-plugins/controller:v0.23.10 -# namespace: keptn-scheduler -# replicaCount: 1 - -# LoadVariationRiskBalancing and TargetLoadPacking are not enabled by default -# as they need extra RBAC privileges on metrics.k8s.io. - -plugins: - enabled: ["KLCPermit"] - disabled: [] # only in-tree plugins need to be defined here - -# Customize the enabled plugins' config. -# Refer to the "pluginConfig" section of manifests//scheduler-config.yaml. -# For example, for Coscheduling plugin, you want to customize the permit waiting timeout to 10 seconds: -#pluginConfig: -#- name: Coscheduling -# args: -# permitWaitingTimeSeconds: 10 # default is 60 -# Or, customize the other plugins -# - name: NodeResourceTopologyMatch -# args: -# scoringStrategy: -# type: MostAllocated # default is LeastAllocated From 37c67a75d256b699e78c74c3b0b4a7b8c02c5ef7 Mon Sep 17 00:00:00 2001 From: Moritz Wiesinger Date: Thu, 29 Sep 2022 10:57:18 +0200 Subject: [PATCH 2/5] add kustomize files Signed-off-by: Moritz Wiesinger --- lfc-scheduler/manifests/install/base/deployment.yaml | 0 lfc-scheduler/manifests/install/base/rbac.yaml | 0 lfc-scheduler/manifests/install/base/scheduler-config.yaml | 0 lfc-scheduler/manifests/install/base/serviceaccount.yaml | 0 lfc-scheduler/manifests/install/kustomization.yaml | 0 5 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 lfc-scheduler/manifests/install/base/deployment.yaml create mode 100644 lfc-scheduler/manifests/install/base/rbac.yaml create mode 100644 lfc-scheduler/manifests/install/base/scheduler-config.yaml create mode 100644 lfc-scheduler/manifests/install/base/serviceaccount.yaml create mode 100644 lfc-scheduler/manifests/install/kustomization.yaml diff --git a/lfc-scheduler/manifests/install/base/deployment.yaml b/lfc-scheduler/manifests/install/base/deployment.yaml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/lfc-scheduler/manifests/install/base/rbac.yaml b/lfc-scheduler/manifests/install/base/rbac.yaml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/lfc-scheduler/manifests/install/base/scheduler-config.yaml b/lfc-scheduler/manifests/install/base/scheduler-config.yaml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/lfc-scheduler/manifests/install/base/serviceaccount.yaml b/lfc-scheduler/manifests/install/base/serviceaccount.yaml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/lfc-scheduler/manifests/install/kustomization.yaml b/lfc-scheduler/manifests/install/kustomization.yaml new file mode 100644 index 0000000000..e69de29bb2 From 2ed8919f2353ef2418d3feffb5703976307f0ca2 Mon Sep 17 00:00:00 2001 From: Moritz Wiesinger Date: Thu, 29 Sep 2022 10:57:22 +0200 Subject: [PATCH 3/5] add content Signed-off-by: Moritz Wiesinger --- .../manifests/install/base/deployment.yaml | 50 ++++++++++ .../manifests/install/base/rbac.yaml | 98 +++++++++++++++++++ .../install/base/scheduler-config.yaml | 13 +++ .../install/base/serviceaccount.yaml | 6 ++ .../manifests/install/kustomization.yaml | 19 ++++ 5 files changed, 186 insertions(+) diff --git a/lfc-scheduler/manifests/install/base/deployment.yaml b/lfc-scheduler/manifests/install/base/deployment.yaml index e69de29bb2..74826b8e73 100644 --- a/lfc-scheduler/manifests/install/base/deployment.yaml +++ b/lfc-scheduler/manifests/install/base/deployment.yaml @@ -0,0 +1,50 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + component: scheduler + name: keptn-scheduler + namespace: keptn-lifecycle-controller-system +spec: + selector: + matchLabels: + component: scheduler + replicas: 1 + template: + metadata: + labels: + component: scheduler + spec: + serviceAccountName: keptn-scheduler + containers: + - command: + - /bin/kube-scheduler + - --config=/etc/kubernetes/scheduler-config.yaml + image: klfc-scheduler:latest + livenessProbe: + httpGet: + path: /healthz + port: 10259 + scheme: HTTPS + initialDelaySeconds: 15 + name: keptn-scheduler + readinessProbe: + httpGet: + path: /healthz + port: 10259 + scheme: HTTPS + resources: + requests: + cpu: '100m' + securityContext: + privileged: false + volumeMounts: + - name: scheduler-config + mountPath: /etc/kubernetes + readOnly: true + hostNetwork: false + hostPID: false + volumes: + - name: scheduler-config + configMap: + name: scheduler-config diff --git a/lfc-scheduler/manifests/install/base/rbac.yaml b/lfc-scheduler/manifests/install/base/rbac.yaml index e69de29bb2..7f5a098004 100644 --- a/lfc-scheduler/manifests/install/base/rbac.yaml +++ b/lfc-scheduler/manifests/install/base/rbac.yaml @@ -0,0 +1,98 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: keptn-scheduler +rules: + - apiGroups: [""] + resources: ["namespaces"] + verbs: ["get", "list", "watch"] + - apiGroups: ["", "events.k8s.io"] + resources: ["events"] + verbs: ["create", "patch", "update"] + - apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["create"] + - apiGroups: ["coordination.k8s.io"] + resourceNames: ["kube-scheduler"] + resources: ["leases"] + verbs: ["get", "update"] + - apiGroups: [""] + resources: ["endpoints"] + verbs: ["create"] + - apiGroups: [""] + resourceNames: ["kube-scheduler"] + resources: ["endpoints"] + verbs: ["get", "update"] + - apiGroups: [""] + resources: ["nodes"] + verbs: ["get", "list", "watch", "patch"] + - apiGroups: [""] + resources: ["pods"] + verbs: ["delete", "get", "list", "watch", "update"] + - apiGroups: [""] + resources: ["bindings", "pods/binding"] + verbs: ["create"] + - apiGroups: [""] + resources: ["pods/status"] + verbs: ["patch", "update"] + - 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: ["get", "list", "watch", "patch", "update"] + - apiGroups: ["authentication.k8s.io"] + resources: ["tokenreviews"] + verbs: ["create"] + - apiGroups: ["authorization.k8s.io"] + resources: ["subjectaccessreviews"] + verbs: ["create"] + - apiGroups: ["storage.k8s.io"] + resources: ["csinodes", "storageclasses" , "csidrivers" , "csistoragecapacities"] + verbs: ["get", "list", "watch"] + - apiGroups: ["topology.node.k8s.io"] + resources: ["noderesourcetopologies"] + verbs: ["*"] + # resources need to be updated with the scheduler plugins used + - apiGroups: ["scheduling.sigs.k8s.io"] + resources: ["podgroups", "elasticquotas"] + verbs: ["get", "list", "watch", "create", "delete", "update", "patch"] + - apiGroups: ["lifecycle.keptn.sh"] + resources: ["keptnworkloadinstances"] + verbs: ["get", "list", "watch"] +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: keptn-scheduler +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: keptn-scheduler +subjects: + - kind: ServiceAccount + name: keptn-scheduler + namespace: keptn-lifecycle-controller-system +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: sched-plugins::extension-apiserver-authentication-reader + namespace: kube-system +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: extension-apiserver-authentication-reader +subjects: + - kind: ServiceAccount + name: keptn-scheduler + namespace: keptn-lifecycle-controller-system diff --git a/lfc-scheduler/manifests/install/base/scheduler-config.yaml b/lfc-scheduler/manifests/install/base/scheduler-config.yaml index e69de29bb2..61b9269d5c 100644 --- a/lfc-scheduler/manifests/install/base/scheduler-config.yaml +++ b/lfc-scheduler/manifests/install/base/scheduler-config.yaml @@ -0,0 +1,13 @@ +apiVersion: kubescheduler.config.k8s.io/v1beta3 +kind: KubeSchedulerConfiguration +leaderElection: + leaderElect: false +profiles: + # Compose all plugins in one profile + - schedulerName: keptn-scheduler + plugins: + multiPoint: + enabled: + - name: "KLCPermit" + disabled: [] + pluginConfig: {} diff --git a/lfc-scheduler/manifests/install/base/serviceaccount.yaml b/lfc-scheduler/manifests/install/base/serviceaccount.yaml index e69de29bb2..887aa5ecdf 100644 --- a/lfc-scheduler/manifests/install/base/serviceaccount.yaml +++ b/lfc-scheduler/manifests/install/base/serviceaccount.yaml @@ -0,0 +1,6 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: keptn-scheduler + namespace: keptn-lifecycle-controller-system + diff --git a/lfc-scheduler/manifests/install/kustomization.yaml b/lfc-scheduler/manifests/install/kustomization.yaml index e69de29bb2..cd8709c249 100644 --- a/lfc-scheduler/manifests/install/kustomization.yaml +++ b/lfc-scheduler/manifests/install/kustomization.yaml @@ -0,0 +1,19 @@ +resources: + - base/deployment.yaml + - base/rbac.yaml + - base/serviceaccount.yaml + +generatorOptions: + disableNameSuffixHash: true + +configMapGenerator: + - files: + - base/scheduler-config.yaml + name: scheduler-config + +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +images: + - name: klfc-scheduler + newName: ghcr.io/keptn-sandbox/lfc-scheduler + newTag: latest From 497c3e70ce715260a3963caad58ef7df523e8f37 Mon Sep 17 00:00:00 2001 From: Moritz Wiesinger Date: Thu, 29 Sep 2022 10:57:48 +0200 Subject: [PATCH 4/5] adjust makefile for kustomize Signed-off-by: Moritz Wiesinger --- lfc-scheduler/Makefile | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/lfc-scheduler/Makefile b/lfc-scheduler/Makefile index ed68152e67..47965bf730 100644 --- a/lfc-scheduler/Makefile +++ b/lfc-scheduler/Makefile @@ -35,6 +35,19 @@ RELEASE_CONTROLLER_IMAGE:=controller:$(RELEASE_VERSION) # v20200521-v0.18.800 - automated build for a tag VERSION=$(shell echo $(RELEASE_VERSION) | awk -F - '{print $$2}') + +## Location to install dependencies to +LOCALBIN ?= $(shell pwd)/bin +$(LOCALBIN): + mkdir -p $(LOCALBIN) + +## Tool Versions +KUSTOMIZE_VERSION ?= v3.8.7 + +## Tool Binaries +KUSTOMIZE ?= $(LOCALBIN)/kustomize +KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" + .PHONY: all all: build @@ -84,6 +97,16 @@ vet: ## Run go vet against code. test: fmt vet ## Run tests. go test ./... -coverprofile cover.out +.PHONY: kustomize +kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. +$(KUSTOMIZE): $(LOCALBIN) + test -s $(LOCALBIN)/kustomize || { curl -s $(KUSTOMIZE_INSTALL_SCRIPT) | bash -s -- $(subst v,,$(KUSTOMIZE_VERSION)) $(LOCALBIN); } + +.PHONY: release-manifests +release-manifests: kustomize + cd manifests/install && $(KUSTOMIZE) edit set image klfc-scheduler=$(RELEASE_REGISTRY)/$(RELEASE_IMAGE) + $(KUSTOMIZE) build manifests/install > config/rendered/release.yaml + .PHONY: local-image local-image: clean docker build --build-arg ARCH="amd64" --build-arg RELEASE_VERSION="$(RELEASE_VERSION)" -t $(LOCAL_REGISTRY)/$(LOCAL_IMAGE) . From 7761f4684fdbb9c21c39f2de40d8031a00e707e2 Mon Sep 17 00:00:00 2001 From: Moritz Wiesinger Date: Thu, 29 Sep 2022 10:58:22 +0200 Subject: [PATCH 5/5] add release dir Signed-off-by: Moritz Wiesinger --- lfc-scheduler/config/rendered/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 lfc-scheduler/config/rendered/.gitkeep diff --git a/lfc-scheduler/config/rendered/.gitkeep b/lfc-scheduler/config/rendered/.gitkeep new file mode 100644 index 0000000000..e69de29bb2