Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(lfc-scheduler): Move from Helm to Kustomize #53

Merged
merged 5 commits into from
Sep 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions lfc-scheduler/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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) .
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ kind: Deployment
metadata:
labels:
component: scheduler
name: {{ .Values.scheduler.name }}
namespace: {{ .Values.scheduler.namespace }}
name: keptn-scheduler
namespace: keptn-lifecycle-controller-system
spec:
selector:
matchLabels:
component: scheduler
replicas: {{ .Values.scheduler.replicaCount }}
replicas: 1
template:
metadata:
labels:
Expand All @@ -20,7 +20,7 @@ spec:
- command:
- /bin/kube-scheduler
- --config=/etc/kubernetes/scheduler-config.yaml
image: {{ .Values.scheduler.image }}
image: klfc-scheduler:latest
livenessProbe:
httpGet:
path: /healthz
Expand All @@ -35,7 +35,7 @@ spec:
scheme: HTTPS
resources:
requests:
cpu: '0.1'
cpu: '100m'
securityContext:
privileged: false
volumeMounts:
Expand All @@ -47,4 +47,4 @@ spec:
volumes:
- name: scheduler-config
configMap:
name: scheduler-config
name: scheduler-config
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ roleRef:
name: keptn-scheduler
subjects:
- kind: ServiceAccount
name: {{ .Values.scheduler.name }}
namespace: {{ .Values.scheduler.namespace }}
name: keptn-scheduler
namespace: keptn-lifecycle-controller-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
Expand All @@ -94,5 +94,5 @@ roleRef:
name: extension-apiserver-authentication-reader
subjects:
- kind: ServiceAccount
name: {{ .Values.scheduler.name }}
namespace: {{ .Values.scheduler.namespace }}
name: keptn-scheduler
namespace: keptn-lifecycle-controller-system
13 changes: 13 additions & 0 deletions lfc-scheduler/manifests/install/base/scheduler-config.yaml
Original file line number Diff line number Diff line change
@@ -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: {}
6 changes: 6 additions & 0 deletions lfc-scheduler/manifests/install/base/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: keptn-scheduler
namespace: keptn-lifecycle-controller-system

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

19 changes: 19 additions & 0 deletions lfc-scheduler/manifests/install/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -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