Skip to content
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

chore: create command for updating auto-generated docs and helm resources for CRD structs #2897

Closed

Conversation

prakrit55
Copy link
Member

Fixes #1879

Description

  • command for make generate in the operator directory to update the zz_autogenerated.deepcopy.go files
  • command for make manifests to update the CRD manifests in the operator's config directory
  • command for the generated manifest for the CRD to helm/chart/templates/
  • command for updating the auto-generated CRD docs by running ./.github/scripts/generate-crd-docs/generate-crd-docs.sh

How to test

Please describe how to run the tests that you ran to verify your changes.
Provide instructions so we can reproduce.
Please also provide information about any automatic tests that you added.

  • Manual Test A
  • Unit Test B
  • Integration Test C

Checklist

  • My PR fulfills the Definition of Done of the corresponding issue and not more (or parts if the issue is separated
    into multiple PRs)
  • I used descriptive commit messages to help reviewers understand my thought process
  • I signed off all my commits according to the Developer Certificate of Origin (DCO)
    see Contribution Guide
  • My PR title is formatted according to the semantic PR conventions described in
    the Contribution Guide
  • My code follows the style guidelines of this project (golangci-lint passes, YAMLLint passes)
  • I regenerated the auto-generated docs for Helm and the CRD documentation (if applicable)
  • I have performed a self-review of my code
  • I have made corresponding changes to the documentation (if needed)
  • My changes result in all-green PR checks (first-time contributors need to ask a maintainer to approve their test runs)
  • New and existing unit and integration tests pass locally with my changes

Summary

Please include a short summary of the changes and the related issue.
Please also include relevant motivation and context.
List any dependencies that are required for this change.

Fixes # (issue)

Checks

  • My PR fulfills the Definition of Done of the corresponding issue and not more (or parts if the issue is separated
    into multiple PRs)
  • I used descriptive commit messages to help reviewers understand my thought process
  • I signed off all my commits according to the Developer Certificate of Origin (DCO)(
    see Contribution Guide)
  • My PR title is formatted according to the semantic PR conventions described in
    the Contribution Guide
  • My content follows the style guidelines of this project (YAMLLint, markdown-lint)
  • I regenerated the auto-generated docs for Helm and the CRD documentation (if applicable)
  • I have performed a self-review of my content including grammar and typo errors and also checked the rendered page
    from the Netlify deploy preview
  • My changes result in all-green PR checks (first-time contributors need to ask a maintainer to approve their test runs)

Signed-off-by: Griffin <prakritimandal611@gmail.com>
Signed-off-by: Griffin <prakritimandal611@gmail.com>
Signed-off-by: Griffin <prakritimandal611@gmail.com>
Copy link

sonarcloud bot commented Jan 29, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@RealAnna
Copy link
Contributor

RealAnna commented Jan 31, 2024

Hey @prakrit55 great job here! To simplify your scripts a bit you may want to have a look to Kustomize transformers and patches: basically, there is a way to define how your yaml file should be enriched when you run the make generate command for instance to add labels like you do in your script :)

some maybe helpful links:

https://medium.com/@giorgiodevops/kustomize-use-patches-to-add-or-override-resources-48ef65cb634c
https://github.com/kubernetes-sigs/kustomize/tree/master/examples/transformerconfigs
https://github.com/kubernetes-sigs/kustomize/blob/master/examples/patchMultipleObjects.md

@prakrit55
Copy link
Member Author

prakrit55 commented Jan 31, 2024

Hey @prakrit55 great job here! To simplify your scripts a bit you may want to have a look to Kustomize transformers and patches: basically, there is a way to define how your yaml file should be enriched when you run the make generate command for instance to add labels like you do in your script :)

some maybe helpful links:

https://medium.com/@giorgiodevops/kustomize-use-patches-to-add-or-override-resources-48ef65cb634c https://github.com/kubernetes-sigs/kustomize/tree/master/examples/transformerconfigs https://github.com/kubernetes-sigs/kustomize/blob/master/examples/patchMultipleObjects.md

Thanks @RealAnna, this so cool with kustomize for the annotations to feed in the CRDs. Could you suggest if there is any other potential methods to copy the CRDs from config to helm templates, I could only think of the scripts that I hve created ?

@RealAnna
Copy link
Contributor

Hey @prakrit55 great job here! To simplify your scripts a bit you may want to have a look to Kustomize transformers and patches: basically, there is a way to define how your yaml file should be enriched when you run the make generate command for instance to add labels like you do in your script :)
some maybe helpful links:
medium.com/@giorgiodevops/kustomize-use-patches-to-add-or-override-resources-48ef65cb634c kubernetes-sigs/kustomize@master/examples/transformerconfigs kubernetes-sigs/kustomize@master/examples/patchMultipleObjects.md

Thanks @RealAnna, this so cool with kustomize for the annotations to feed in the CRDs. Could you suggest if there is any other potential methods to copy the CRDs from config to helm templates, I could only think of the scripts that I hve created ?

If you manage to add the helm templates bits in the CRD as a separate patch this means you can directly call kustomize in the chart/templates folder and substitute the files there. So a variation of what we have here but instead of using | you store the resource in a file in the chart path ... I have not tested wheter everything can be done like this, but you could choose one crd file and test this out :)

@odubajDT
Copy link
Contributor

Hi @prakrit55 any news on this PR?

@prakrit55
Copy link
Member Author

Hi @prakrit55 any news on this PR?

was a bit busy, will start working on it : )

@prakrit55
Copy link
Member Author

hello @odubajDT, had a query with kustomize and some bash stuffs, I am able to produce the crds in a single file as realanna said, now do u get any solution how to reassemble those crds into the same hlm templates file ??? 😓 like I got stuck in this thing previously

@odubajDT
Copy link
Contributor

hello @odubajDT, had a query with kustomize and some bash stuffs, I am able to produce the crds in a single file as realanna said, now do u get any solution how to reassemble those crds into the same hlm templates file ??? 😓 like I got stuck in this thing previously

Hi @prakrit55 not sure I understand your question. But I don't think producing a single file output is the goal. What I think Anna suggested is to actually template the CRDs and create it basically "substituable", but in multiple templates files.

Can you explain your thoughts a little bit more ?

@prakrit55
Copy link
Member Author

hello @odubajDT, had a query with kustomize and some bash stuffs, I am able to produce the crds in a single file as realanna said, now do u get any solution how to reassemble those crds into the same hlm templates file ??? 😓 like I got stuck in this thing previously

Hi @prakrit55 not sure I understand your question. But I don't think producing a single file output is the goal. What I think Anna suggested is to actually template the CRDs and create it basically "substituable", but in multiple templates files.

Can you explain your thoughts a little bit more ?

Sorry for the confusion. So I tried to run kustomize build config/crd > chart/templates/file.yaml, with some scripts for the annotations. Now we are getting a single file with all the CRDs in the template . Its difficult to put the files separately. Any thoughts ??

@RealAnna
Copy link
Contributor

hello @odubajDT, had a query with kustomize and some bash stuffs, I am able to produce the crds in a single file as realanna said, now do u get any solution how to reassemble those crds into the same hlm templates file ??? 😓 like I got stuck in this thing previously

Hi @prakrit55 not sure I understand your question. But I don't think producing a single file output is the goal. What I think Anna suggested is to actually template the CRDs and create it basically "substituable", but in multiple templates files.
Can you explain your thoughts a little bit more ?

Sorry for the confusion. So I tried to run kustomize build config/crd > chart/templates/file.yaml, with some scripts for the annotations. Now we are getting a single file with all the CRDs in the template . Its difficult to put the files separately. Any thoughts ??

@prakrit55 I think having all crd in a file is an acceptable outcome as long as we are certain that the content is automatically updated 😃

Copy link

sonarcloud bot commented Feb 28, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@odubajDT odubajDT closed this Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create command for updating auto-generated docs and helm resources for CRD structs
3 participants