diff --git a/Makefile b/Makefile index 1b0593d..9bcb827 100644 --- a/Makefile +++ b/Makefile @@ -46,8 +46,12 @@ ifeq ($(USE_IMAGE_DIGESTS), true) BUNDLE_GEN_FLAGS += --use-image-digests endif +IMAGE_REGISTRY ?= localhost +IMAGE_NAME ?= overlay-network-controller +IMAGE_TAG ?= devel # Image URL to use all building/pushing image targets -IMG ?= controller:latest +IMG ?= "${IMAGE_REGISTRY}/${IMAGE_NAME}:${IMAGE_TAG}" + # ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary. ENVTEST_K8S_VERSION = 1.25.0 @@ -145,17 +149,13 @@ docker-buildx: test ## Build and push docker image for the manager for cross-pla ##@ Deployment -ifndef ignore-not-found - ignore-not-found = false -endif - .PHONY: install install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config. $(KUSTOMIZE) build config/crd | kubectl apply -f - .PHONY: uninstall uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion. - $(KUSTOMIZE) build config/crd | kubectl delete --ignore-not-found=$(ignore-not-found) -f - + $(KUSTOMIZE) build config/crd | kubectl delete --ignore-not-found=true -f - .PHONY: deploy deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config. @@ -163,8 +163,8 @@ deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in $(KUSTOMIZE) build config/default | kubectl apply -f - .PHONY: undeploy -undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion. - $(KUSTOMIZE) build config/default | kubectl delete --ignore-not-found=$(ignore-not-found) -f - +undeploy: kustomize ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion. + $(KUSTOMIZE) build config/default | kubectl delete --ignore-not-found=true -f - ##@ Build Dependencies @@ -261,3 +261,14 @@ cluster-up: .PHONY: cluster-down cluster-down: ./automation/cluster.sh --down + +KIND_BIN ?= kind +CLUSTER_NAME ?= ovn +IMAGE_TAR = "./bin/img.tar" +.PHONY: kind-push +kind-push: + docker save ${IMG} -o ${IMAGE_TAR} + $(KIND_BIN) load image-archive --name=${CLUSTER_NAME} ${IMAGE_TAR} + +.PHONY: cluster-sync +cluster-sync: undeploy uninstall manifests generate fmt vet docker-build kind-push install deploy diff --git a/config/crd/kustomization.yaml b/config/crd/kustomization.yaml index c3ad78e..9a858b3 100644 --- a/config/crd/kustomization.yaml +++ b/config/crd/kustomization.yaml @@ -4,7 +4,3 @@ resources: - bases/self.service.ovn.org_overlaynetworks.yaml #+kubebuilder:scaffold:crdkustomizeresource - -# the following config is for teaching kustomize how to do kustomization for CRDs. -configurations: -- kustomizeconfig.yaml diff --git a/config/manager/kustomization.yaml b/config/manager/kustomization.yaml index 5c5f0b8..64f3cde 100644 --- a/config/manager/kustomization.yaml +++ b/config/manager/kustomization.yaml @@ -1,2 +1,8 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization resources: - manager.yaml +images: +- name: controller + newName: localhost/overlay-network-controller + newTag: devel