-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 make commands for CAPI operator #4126
🌱 Add make commands for CAPI operator #4126
Conversation
/hold |
/area api |
@wfernandes: The label(s) In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
f065618
to
c0c586f
Compare
/retest |
c0c586f
to
bb76b00
Compare
What do you think about having a separate Makefile for the operator in the relative folder and use We should probably do the same for the bootstrap, control plane providers, etc |
Sure. I was just being consistent with what we have now. I don't mind breaking it up into several Makefiles but can we do that as part of a separate issue. I'm happy to create the issue describing Makefiles for each CAPI component that makes sense. |
/retest |
/hold |
8c83fac
to
7c6fb49
Compare
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
4f9d781
to
4dfe263
Compare
4dfe263
to
391bd29
Compare
Makefile
Outdated
@@ -237,7 +230,7 @@ generate-go: $(GOBINDATA) ## Runs Go related generate targets | |||
$(MAKE) generate-go-core | |||
$(MAKE) generate-go-kubeadm-bootstrap | |||
$(MAKE) generate-go-kubeadm-control-plane | |||
$(MAKE) generate-go-operator | |||
$(MAKE) -C $(OPERATOR_DIR) generate-go-operator |
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 think we should not call the operator targets by default.
Let's call them explicitly, like we are doing for CAPD
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 thought the operator is a bit different, don't we plan to ship it the same way as kubeadm
stuff?
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.
This makes sense IMO, and it will help identify early issues during manifest generation, when generated resources will overlap between CAPI and CAPIO. CI should handle this part and prevent from PRs being merged if this task fails.
Makefile
Outdated
DOCKER_BUILDKIT=1 docker build --build-arg goproxy=$(GOPROXY) --build-arg ARCH=$(ARCH) --build-arg package=./exp/operator --build-arg ldflags="$(LDFLAGS)" . -t $(OPERATOR_CONTROLLER_IMG)-$(ARCH):$(TAG) | ||
$(MAKE) set-manifest-image MANIFEST_IMG=$(OPERATOR_CONTROLLER_IMG)-$(ARCH) MANIFEST_TAG=$(TAG) TARGET_RESOURCE="./exp/operator/config/default/manager_image_patch.yaml" | ||
$(MAKE) set-manifest-pull-policy TARGET_RESOURCE="./exp/operator/config/default/manager_pull_policy.yaml" | ||
$(MAKE) -C $(OPERATOR_DIR) docker-build-operator |
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.
this target should go away from the main docker file
Makefile
Outdated
@for arch in $(ALL_ARCH); do docker manifest annotate --arch $${arch} ${OPERATOR_CONTROLLER_IMG}:${TAG} ${OPERATOR_CONTROLLER_IMG}-$${arch}:${TAG}; done | ||
docker manifest push --purge $(OPERATOR_CONTROLLER_IMG):$(TAG) | ||
$(MAKE) set-manifest-image MANIFEST_IMG=$(OPERATOR_CONTROLLER_IMG) MANIFEST_TAG=$(TAG) TARGET_RESOURCE="./exp/operator/config/default/manager_image_patch.yaml" | ||
$(MAKE) -C "./$(OPERATOR_DIR)/" docker-push-operator-manifest |
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.
this target should go away from the main docker file
Makefile
Outdated
@@ -315,7 +302,7 @@ generate-manifests: ## Generate manifests e.g. CRD, RBAC etc. | |||
$(MAKE) generate-core-manifests | |||
$(MAKE) generate-kubeadm-bootstrap-manifests | |||
$(MAKE) generate-kubeadm-control-plane-manifests | |||
$(MAKE) generate-operator-manifests | |||
$(MAKE) -C $(OPERATOR_DIR) generate-operator-manifests |
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.
same
Makefile
Outdated
@@ -546,7 +518,7 @@ release-manifests: $(RELEASE_DIR) $(KUSTOMIZE) ## Builds the manifests to publis | |||
# Build control-plane-components. | |||
$(KUSTOMIZE) build controlplane/kubeadm/config/default > $(RELEASE_DIR)/control-plane-components.yaml | |||
# Build operator components. | |||
$(KUSTOMIZE) build exp/operator/config/default > $(RELEASE_DIR)/operator-components.yaml | |||
$(KUSTOMIZE) build $(OPERATOR_DIR)/config/default > $(RELEASE_DIR)/operator-components.yaml |
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.
This should go in the operator make file
Makefile
Outdated
$(MAKE) set-manifest-pull-policy PULL_POLICY=IfNotPresent TARGET_RESOURCE="./config/default/manager_pull_policy.yaml" | ||
$(MAKE) set-manifest-pull-policy PULL_POLICY=IfNotPresent TARGET_RESOURCE="./bootstrap/kubeadm/config/default/manager_pull_policy.yaml" | ||
$(MAKE) set-manifest-pull-policy PULL_POLICY=IfNotPresent TARGET_RESOURCE="./controlplane/kubeadm/config/default/manager_pull_policy.yaml" | ||
$(MAKE) set-manifest-pull-policy PULL_POLICY=IfNotPresent TARGET_RESOURCE="./exp/operator/config/default/manager_pull_policy.yaml" | ||
$(MAKE) set-manifest-pull-policy PULL_POLICY=IfNotPresent TARGET_RESOURCE="./$(OPERATOR_DIR)/config/default/manager_pull_policy.yaml" |
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.
This should go in the operator make file
Makefile
Outdated
@@ -531,11 +503,11 @@ manifest-modification: # Set the manifest images to the staging/production bucke | |||
TARGET_RESOURCE="./controlplane/kubeadm/config/default/manager_image_patch.yaml" | |||
$(MAKE) set-manifest-image \ | |||
MANIFEST_IMG=$(PROD_REGISTRY)/$(OPERATOR_IMAGE_NAME) MANIFEST_TAG=$(RELEASE_TAG) \ | |||
TARGET_RESOURCE="./exp/operator/config/default/manager_image_patch.yaml" | |||
TARGET_RESOURCE="./$(OPERATOR_DIR)/config/default/manager_image_patch.yaml" |
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.
This should go in the operator make file
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.
My idea was to reuse targets like set-manifest-image
instead of duplicating them across Makefiles. Another approach might be a Makefile that has all common targets and this Makefile is then included in all others.
a7cd7eb
to
9972a59
Compare
Makefile
Outdated
@@ -237,7 +230,7 @@ generate-go: $(GOBINDATA) ## Runs Go related generate targets | |||
$(MAKE) generate-go-core | |||
$(MAKE) generate-go-kubeadm-bootstrap | |||
$(MAKE) generate-go-kubeadm-control-plane | |||
$(MAKE) generate-go-operator | |||
$(MAKE) -C $(OPERATOR_DIR) generate-go-operator |
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.
This makes sense IMO, and it will help identify early issues during manifest generation, when generated resources will overlap between CAPI and CAPIO. CI should handle this part and prevent from PRs being merged if this task fails.
Makefile
Outdated
@@ -405,6 +415,7 @@ docker-push-all: $(addprefix docker-push-,$(ALL_ARCH)) | |||
$(MAKE) docker-push-core-manifest | |||
$(MAKE) docker-push-kubeadm-bootstrap-manifest | |||
$(MAKE) docker-push-kubeadm-control-plane-manifest | |||
$(MAKE) docker-push-operator-manifest |
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 would argue that this task should be independent from core Makefile. Until the operator is experimental, default push command should accidentally create new images in release.
9972a59
to
3ace910
Compare
3ace910
to
a5367e2
Compare
A small recap:
|
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 would like to go forward with this for now. We will have an easier time iterating then.
+1 to get this moving. |
a5367e2
to
4724d32
Compare
Rebased and fix version pkg path Remove zap logger Remove .gitignore, Dockerfile and modules files Add context to reconciler arguments Add test tasks for operator Add binary building tasks for operator Add linting tasks for operator Add generate tasks for operator Add Docker tasks for operator Add release command for operator Add cleanup tasks for operator Make operator more consistent with other projects
4724d32
to
f481922
Compare
Good to go from my side /LGTM |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: CecileRobertMichon The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What this PR does / why we need it:
This PR adds a bunch of make commands for the CAPI operator. It is built on top of the PR #4117.
This PR should be merged after #4117.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #4122
Ref #3833