-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
🐛 (go/v4) Fix makefile target build-installer to discarding the previous content #3766
🐛 (go/v4) Fix makefile target build-installer to discarding the previous content #3766
Conversation
Hi @lukas016. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
@camilamacedo86 it is probably your code, could you pls do review too. Thx |
fi | ||
echo "---" >> dist/install.yaml # Add a document separator before appending |
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.
Thank you for your contribution 🥇
/ok-to-test
Can you please run make generate
?
The changes here will change what is outputted; therefore, we must run ' make generate`. (please also ensure that we have all in one commit) It is also tested via e2e tests, so passing on that is ALL fine.
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.
It is either failing in teh ew tests
mkdir -p dist
echo "---" > dist/install.yaml # Clean previous content
bash: -c: line 4: syntax error: unexpected end of file
make: *** [Makefile:122: build-installer] Error 2
{
s: "make build-installer IMG=e2e-test/controller-manager:nfca failed with error: (exit status 2) /home/prow/go/src/sigs.k8s.io/kubebuilder/test/e2e/v4/e2e-nfca/bin/controller-gen-v0.14.0 rbac:roleName=manager-role crd webhook paths=\"./...\" output:crd:artifacts:config=config/crd/bases\n/home/prow/go/src/sigs.k8s.io/kubebuilder/test/e2e/v4/e2e-nfca/bin/controller-gen-v0.14.0 object:headerFile=\"hack/boilerplate.go.txt\" paths=\"./...\"\nDownloading sigs.k8s.io/kustomize/kustomize/v5@v5.3.0\nmkdir -p dist\necho \"---\" > dist/install.yaml # Clean previous content\nbash: -c: line 4: syntax error: unexpected end of file\nmake: *** [Makefile:122: build-installer] Error 2\n",
Can you please let me know the scenario that is not working for you?
Can you describe the steps to create a POC and reproduce the issue?
It would be great if we ensure that we also test it out in the tests.
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.
Hi, i am working on fix.
Problematic scenario is:
- Remove config/crd
- Call make build-installer 2 or more times
- Check dist/install.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.
Note that when you scaffold any API the tool in uncomment config/default/kustomization.yaml
You probably would solve it by commenting again on the
Resources:
- ../crd
In config/default/kustomization.yaml
So, that is not a really issue because
You break the scaffold if you manually remove the config/crd directory.
Are you able to face any issues without deleting things scaffold manually?
Nevertheless, if you want to change it to address it, it is OK, assuming it is still working as it should for the other scenarios.
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.
do we need if statement in makefile in this case? We can completely remove if statement and we won't need this fix.
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 this is better or why crd was generated independent?
build-installer: manifests generate kustomize ## Generate a consolidated YAML with CRDs and deployment.
mkdir -p dist
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
$(KUSTOMIZE) build config/default > dist/install.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.
The above will not work:
- a) Because you can create a project without CRD ( the problem is when you create the API, the scaffold change, so if you delete the config/crd manually, you also need to fix the scaffold manually accordingly )
Can you do the following to see if your problem is not fixed?
Remove config/crd
Comment `Resources:
- ../crd`
Call make build-installer 2 or more times
Check dist/install.yaml
OR
If you create a project and do not call kb create API, can you see any issue?
Furthermore, if you can face ANY issue using only the tool and without creating things within and then deleting staff manually or customizations, please let us know so that is an issue.
- b) My 2 cents is that it will fail because it will be missing
echo "---" >> dist/install.yaml # Add a document separator before appending
f2e7c2c
to
21554f2
Compare
21554f2
to
3582cd3
Compare
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.
/lgtm
/approved
It is passing now, So all fine.
If you see any scenario that does not work please feel free to propose changes.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: camilamacedo86, lukas016 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 |
Description:
current implementation of makefile target build-installer cannot work properly without crd. Root cause of problem is missing discard of content, if crd isn't used.
Result of problem is appending new content behind previous into dist/install.yaml and file content is growing and contains multiple versions.