Skip to content

Conversation

laxmikantbpandhare
Copy link
Contributor

This will fix #2556

Before fixing this issue, it is failing like below:

laxmikantbhaskarpandhare@lpandhar-mac project % make install
/Users/laxmikantbhaskarpandhare/go/src/github.com/kubernetes-sigs/kubebuilder/docs/book/src/multiversion-tutorial/testdata/project/bin/kustomize build config/crd | kubectl apply -f -
The CustomResourceDefinition "cronjobs.batch.tutorial.kubebuilder.io" is invalid: metadata.annotations: Too long: must have at most 262144 bytes
make: *** [install] Error 1

After fix, it worked.

laxmikantbhaskarpandhare@lpandhar-mac project % make install
test -s /Users/laxmikantbhaskarpandhare/go/src/github.com/kubernetes-sigs/kubebuilder/docs/book/src/multiversion-tutorial/testdata/project/bin/controller-gen || GOBIN=/Users/laxmikantbhaskarpandhare/go/src/github.com/kubernetes-sigs/kubebuilder/docs/book/src/multiversion-tutorial/testdata/project/bin go install sigs.k8s.io/controller-tools/cmd/[email protected]
/Users/laxmikantbhaskarpandhare/go/src/github.com/kubernetes-sigs/kubebuilder/docs/book/src/multiversion-tutorial/testdata/project/bin/controller-gen rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
/Users/laxmikantbhaskarpandhare/go/src/github.com/kubernetes-sigs/kubebuilder/docs/book/src/multiversion-tutorial/testdata/project/bin/kustomize build config/crd | kubectl replace --force -f -
customresourcedefinition.apiextensions.k8s.io/cronjobs.batch.tutorial.kubebuilder.io replaced

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Aug 7, 2022
@k8s-ci-robot
Copy link
Contributor

Hi @laxmikantbpandhare. 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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@laxmikantbpandhare
Copy link
Contributor Author

Hi @camilamacedo86 -

I was able to recreate the issue. There are two ways through which we can fix this issue.

  1. As mentioned in the issue, modify the Makefile manifests target. change crd => crd:maxDescLen=0;
  2. Change kubectl apply to kubectl replace --force` as mentioned here

Please take a look and let me know your thoughts.

Copy link
Contributor

@everettraven everettraven left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@laxmikantbpandhare I think this looks good but I have one concern with using kubectl replace instead of kubectl apply.

My understanding with kubectl apply is that it will create the resource if it does not exist or update it if it does exist. This seems like the functionality we would want.

I could be wrong, but my understanding of kubectl replace is that it will only replace something that already exists. If you run make install or make deploy with this change on a fresh KinD cluster does it still work as expected?

@laxmikantbpandhare
Copy link
Contributor Author

laxmikantbpandhare commented Aug 8, 2022

@laxmikantbpandhare I think this looks good but I have one concern with using kubectl replace instead of kubectl apply.

My understanding with kubectl apply is that it will create the resource if it does not exist or update it if it does exist. This seems like the functionality we would want.

I could be wrong, but my understanding of kubectl replace is that it will only replace something that already exists. If you run make install or make deploy with this change on a fresh KinD cluster does it still work as expected?

@everettraven _ I tried make install and it worked. If that is the case then I can try adding another solution mentioned above WDYT?

@laxmikantbpandhare
Copy link
Contributor Author

@camilamacedo86 @everettraven - Updated PR. crd:maxDescLen=0 - It will skip the description section while creating an annotation. This change will avoid annotations too long errors.

Please take a look once.

Copy link
Contributor

@everettraven everettraven left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks good and will fix the case in the issue, but I wonder if we should also apply this to the scaffolds?

Is there a reason why this occurs in this specific tutorial and not on a regular basis?

Thoughts @camilamacedo86 ?

@laxmikantbpandhare
Copy link
Contributor Author

I think this looks good and will fix the case in the issue, but I wonder if we should also apply this to the scaffolds?

Is there a reason why this occurs in this specific tutorial and not on a regular basis?

Thoughts @camilamacedo86 ?

@everettraven - this is the file that is causing this issue - https://raw.githubusercontent.com/kubernetes-sigs/kubebuilder/master/docs/book/src/multiversion-tutorial/testdata/project/config/crd/bases/batch.tutorial.kubebuilder.io_cronjobs.yaml

If you see the above file then it is a large file and has too many description sections. I don't think we need to scaffold it out just for only one file. WDYT?

@everettraven
Copy link
Contributor

this is the file that is causing this issue - https://raw.githubusercontent.com/kubernetes-sigs/kubebuilder/master/docs/book/src/multiversion-tutorial/testdata/project/config/crd/bases/batch.tutorial.kubebuilder.io_cronjobs.yaml

If you see the above file then it is a large file and has too many description sections. I don't think we need to scaffold it out just for only one file. WDYT?

@laxmikantbpandhare Ah, thanks for that information! I went through the tutorial and having the extra context clears up the confusion I was having. This change looks good to me so I will go ahead and approve the PR.

@everettraven
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 9, 2022
@laxmikantbpandhare
Copy link
Contributor Author

@camilamacedo86 could you please take a look.

@laxmikantbpandhare laxmikantbpandhare changed the title 🐛 : metadata.annotations: Too long: must have at most 262144 bytes 🐛 : doc: fix multiversion tutorial sample error: metadata.annotations: Too long: must have at most 262144 bytes Aug 11, 2022
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Aug 11, 2022
skipped descrioption during creation of annotations

updated according to PR review comments

updated according to PR review comments
Copy link
Member

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 11, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: camilamacedo86, everettraven, laxmikantbpandhare

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 11, 2022
@k8s-ci-robot k8s-ci-robot merged commit dd7d3db into kubernetes-sigs:master Aug 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

metadata.annotations: Too long: must have at most 262144 bytes

4 participants