diff --git a/.gitignore b/.gitignore index e5b0e6724a..81f9543840 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,7 @@ .idea .dccache* + +manifests/ +/scheduler/config/rendered/release.yaml +/operator/config/rendered/release.yaml diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000..b3297ba08b --- /dev/null +++ b/Makefile @@ -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 \ No newline at end of file diff --git a/README.md b/README.md index 1955fec0b8..e426350296 100644 --- a/README.md +++ b/README.md @@ -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= -DOCKER_TAG= +RELEASE_REGISTRY= +# (optional)ARCH= +# (optional)TAG= -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 ``` diff --git a/operator/Makefile b/operator/Makefile index 99055628cb..129afb7534 100644 --- a/operator/Makefile +++ b/operator/Makefile @@ -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" @@ -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) diff --git a/scheduler/Makefile b/scheduler/Makefile index 0d269b94fb..db28fbf6ee 100644 --- a/scheduler/Makefile +++ b/scheduler/Makefile @@ -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 @@ -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) \ No newline at end of file