Skip to content

Commit

Permalink
feat(main): Make LFC development environment installable with one com…
Browse files Browse the repository at this point in the history
…mand (#138)

Signed-off-by: Thomas Schuetz <[email protected]>
  • Loading branch information
thschue authored Oct 10, 2022
1 parent 0baf7a9 commit 832ca37
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@
.idea

.dccache*

manifests/
/scheduler/config/rendered/release.yaml
/operator/config/rendered/release.yaml
31 changes: 31 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Image URL to use all building/pushing image targets
CERT_MANAGER_VERSION ?= v1.8.0
TAG ?= "$(shell date +%Y%m%d%s)"
TAG := $(TAG)

# RELEASE_REGISTRY is the container registry to push
# into.
RELEASE_REGISTRY?=ghcr.io/keptn-sandbox
ARCH?=amd64

.PHONY: build-and-push-dev-images
build-and-push-dev-images:
RELEASE_TAG=$(TAG)
$(MAKE) -C operator release-local.$(ARCH) TAG=$(TAG)
$(MAKE) -C scheduler release-local.$(ARCH) TAG=$(TAG)
$(MAKE) -C operator push-local TAG=$(TAG)
$(MAKE) -C scheduler push-local TAG=$(TAG)

.PHONY: build-dev-manifests
build-dev-manifests:
$(MAKE) -C operator release-manifests TAG=$(TAG) ARCH=$(ARCH)
$(MAKE) -C scheduler release-manifests TAG=$(TAG) ARCH=$(ARCH)
if [[ ! -d manifests ]]; then mkdir manifests; fi
cat operator/config/rendered/release.yaml > manifests/dev.yaml
echo "---" >> manifests/dev.yaml
cat scheduler/config/rendered/release.yaml >> manifests/dev.yaml

.PHONY: build-deploy-dev-environment
build-deploy-dev-environment: build-and-push-dev-images build-dev-manifests
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/$(CERT_MANAGER_VERSION)/cert-manager.yaml
kubectl apply -f manifests/dev.yaml
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,13 +268,13 @@ kubectl apply -f ./scheduler-manifest/release.yaml # install the scheduler
Instead, if you want to build and deploy the operator into your cluster directly from the code, you can type:

```bash
DOCKER_REGISTRY=<YOUR_DOCKER_REGISTRY>
DOCKER_TAG=<YOUR_DOCKER_TAG>
RELEASE_REGISTRY=<YOUR_DOCKER_REGISTRY>
# (optional)ARCH=<amd64(default)|arm64v8>
# (optional)TAG=<YOUR_PREFERRED_TAG (defaulting to current time)>
cd operator
# Build and deploy the dev images to the current kubernetes cluster
make build-deploy-dev-environment
make docker-build docker-push IMG=${DOCKER_REGISTRY}/${DOCKER_TAG}:latest
make deploy IMG=${DOCKER_REGISTRY}/${DOCKER_TAG}:latest
```


Expand Down
13 changes: 12 additions & 1 deletion operator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
ENVTEST ?= $(LOCALBIN)/setup-envtest

## Tool Versions
KUSTOMIZE_VERSION ?= v3.8.7
KUSTOMIZE_VERSION ?= v4.2.0
CONTROLLER_TOOLS_VERSION ?= v0.9.2

KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
Expand Down Expand Up @@ -209,7 +209,18 @@ release-local: release-local.amd64 release-local.arm64v8
.PHONY: release-local.amd64
release-local.amd64: clean
docker build --build-arg ARCH="amd64" --build-arg GIT_HASH="$(HASH)" --build-arg RELEASE_VERSION="$(TAG)" -t $(RELEASE_REGISTRY)/$(RELEASE_IMAGE)-amd64 .
docker tag $(RELEASE_REGISTRY)/$(RELEASE_IMAGE)-amd64 $(RELEASE_REGISTRY)/$(RELEASE_IMAGE)

.PHONY: release-local.arm64v8
release-local.arm64v8: clean
docker build --build-arg ARCH="arm64v8" --build-arg GIT_HASH="$(HASH)" --build-arg RELEASE_VERSION="$(TAG)" -t $(RELEASE_REGISTRY)/$(RELEASE_IMAGE)-arm64 .
docker tag $(RELEASE_REGISTRY)/$(RELEASE_IMAGE)-arm64 $(RELEASE_REGISTRY)/$(RELEASE_IMAGE)

.PHONY: push-local
push-local:
if [[ "${ARCH}" == "amd64" ]]; then \
docker push $(RELEASE_REGISTRY)/$(RELEASE_IMAGE)-amd64 ;\
elif [[ "${ARCH}" == "arm64v8" ]]; then \
docker push $(RELEASE_REGISTRY)/$(RELEASE_IMAGE)-arm64 ;\
fi
docker push $(RELEASE_REGISTRY)/$(RELEASE_IMAGE)
13 changes: 12 additions & 1 deletion scheduler/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ $(LOCALBIN):
mkdir -p $(LOCALBIN)

## Tool Versions
KUSTOMIZE_VERSION ?= v3.8.7
KUSTOMIZE_VERSION ?= v4.2.0

## Tool Binaries
KUSTOMIZE ?= $(LOCALBIN)/kustomize
Expand Down Expand Up @@ -159,7 +159,18 @@ release-local: release-local.amd64 release-local.arm64v8
.PHONY: release-local.amd64
release-local.amd64: clean
docker build --build-arg ARCH="amd64" --build-arg RELEASE_VERSION="$(RELEASE_VERSION)" -t $(RELEASE_REGISTRY)/$(RELEASE_IMAGE)-amd64 .
docker tag $(RELEASE_REGISTRY)/$(RELEASE_IMAGE)-amd64 $(RELEASE_REGISTRY)/$(RELEASE_IMAGE)

.PHONY: release-local.arm64v8
release-local.arm64v8: clean
docker build --build-arg ARCH="arm64v8" --build-arg RELEASE_VERSION="$(RELEASE_VERSION)" -t $(RELEASE_REGISTRY)/$(RELEASE_IMAGE)-arm64 .
docker tag $(RELEASE_REGISTRY)/$(RELEASE_IMAGE)-arm64 $(RELEASE_REGISTRY)/$(RELEASE_IMAGE)

.PHONY: push-local
push-local:
if [[ "${ARCH}" == "amd64" ]]; then \
docker push $(RELEASE_REGISTRY)/$(RELEASE_IMAGE)-amd64; \
elif [[ "${ARCH}" == "arm64v8" ]]; then \
docker push $(RELEASE_REGISTRY)/$(RELEASE_IMAGE)-arm64 ;\
fi
docker push $(RELEASE_REGISTRY)/$(RELEASE_IMAGE)

0 comments on commit 832ca37

Please sign in to comment.