-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add Makefile cluster sync target #8
Conversation
3e7b578
to
0eef43b
Compare
Since config/crd/kustomizeconfig.yaml not exist it should be removed from config/crd/kustomization.yaml manifest. Without this change 'make manifests' fails. Signed-off-by: Or Mergi <[email protected]>
790322b
to
0bb3b61
Compare
Makefile
Outdated
@@ -46,8 +46,13 @@ ifeq ($(USE_IMAGE_DIGESTS), true) | |||
BUNDLE_GEN_FLAGS += --use-image-digests | |||
endif | |||
|
|||
IMAGE_REGISTRY ?= quay.io | |||
IMAGE_ORG ?= omergi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMAGE_ORG ?= slefserviceoverlay
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the image org for now and set the registry to localhost to make kind load work as expected (leaving the image with no org cause the node to fetch image from docker.io).
Let set the image org name and a remote regeistry once we setup local/remote registry.
@@ -261,3 +262,14 @@ cluster-up: | |||
.PHONY: cluster-down | |||
cluster-down: | |||
./automation/cluster.sh --down | |||
|
|||
KIND_BIN ?= kind | |||
CLUSTER_NAME ?= ovn |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where do we specify it is the name of the cluster?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cluster-up target uses ovn-org/ovn-kubernetes scripts to create cluster for tests, default name is "ovn".
I will post a follow up PR to make it visible in the Makefile.
Makefile
Outdated
docker save ${IMG} -o ${IMAGE_TAR} | ||
$(KIND_BIN) load image-archive --name=${CLUSTER_NAME} ${IMAGE_TAR} | ||
|
||
.PHONY: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.PHONY: cluster-sync
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Makefile
Outdated
$(KIND_BIN) load image-archive --name=${CLUSTER_NAME} ${IMAGE_TAR} | ||
|
||
.PHONY: | ||
cluster-sync: undeploy uninstall test install docker-build kind-push deploy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why unit tests have to run on cluster-sync?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make the build work with any oci bin.
OCI_BIN ?= $(shell if podman ps >/dev/null 2>&1; then echo podman; elif docker ps >/dev/null 2>&1; then echo docker; fi)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why unit tests have to run on cluster-sync?
My bad, no need to run unit tests as part of cluster-sync.
Changed to use generate
fmt
and vet
instead on test
.
We could use build
target, but since docker-build
already build the go binary we avoid building it twice by calling docker-build
only.
Also, I had to change 'undelpoy' target to have `kustomize' target as a prerequisite to avoid failures when Kustomize is not installed yet.
Please make the build work with any oci bin.
OCI_BIN ?= $(shell if podman ps >/dev/null 2>&1; then echo podman; elif docker ps >/dev/null 2>&1; then echo docker; fi)
I have posted another PR that introduce OCI_BIN #7
config/manager/kustomization.yaml
Outdated
resources: | ||
- manager.yaml | ||
images: | ||
- name: controller | ||
newName: quay.io/omergi/overlay-network-controller |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change according to the new proposed image name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Cluster sync build the controller and deploy it to the local cluster enabling faster iterations. Introduce 'kind-push' target, it enables pushing the controller image to cluster nodes container runtime local registry using KinD. cluster-sync flow: - Remove the installed CRDs, Deployment and all related object (namesapce, sa, rbac, etc..) - Generate manifest (CRD, RBAC, etc..). - Generates code (DeepCopy, etc..). - go fmt, go vet - Build controller the image. - Push the image to cluster nodes container runtime local registry (using kind). - Deploy the controller CRDs. - Generate manifests (Namespace, SA, Deployment, etc.., using Kustomize) - Deploy controller and all related objects. The default container image tag, represented by IMG, is changed as follows to make kind load work as expected: 'localhost/overlay-network-controller:devel' Add 'kustomize' target as a prerequisite of 'undelpoy' target to avoid failures when Kustomize is not installed. Signed-off-by: Or Mergi <[email protected]>
This commit change introduced by 'make deploy'. It replaces the default image name ("controller") with the image name spesified in Makefile by $IMG. Signed-off-by: Or Mergi <[email protected]>
0bb3b61
to
88afbd6
Compare
Please update the image. |
Cluster sync build the controller and deploy it to the local cluster
enabling faster iterations.
Introduce 'kind-push' target, it enables pushing the controller image
to cluster nodes container runtime local registry using KinD.
cluster-sync flow:
The default container image tag, represented by $IMG, is changed as follows to
make kind load work as expected:
'localhost/overlay-network-controller:devel'