Skip to content

Add set-project-id function #756

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

yuwenma
Copy link
Contributor

@yuwenma yuwenma commented Feb 2, 2022

Update

  • Extend to support wildcard match and replace a project from a string with given fieldspec. The wildcard should be configured using the regexPattern in each fieldspec in costs/custom.go file. The wildcard should use named groups "prefix", "suffix" to distinguish the reserved strings. The new string will be ${prefix match}${new project ID}${suffix match}
  • thirdparty forks kustomization/api, the only change is to add regexPattern to fieldspec

Description

  • Enumerate a builtin spec field list to tell whatproject really means for different KRM resources. So the resources are endowed with practical value on the opposite of merely yaml syntax (templating).
  • Leverage kustomize plugin annotation filter to add/update the annotation with key cnrm.cloud.google.com/project-id. These annotations include all KRM resources metadata.annotations and spec.metadata.annotations of major k8s Kind resources (e.g. Deployment, Service, ReplicaSet).

TODO:

  • Add examples and guides in README
  • Update generated/docs.go
  • Add tests.
  • Extend the specField list to cover more KCC resources.

@mengqiy
Copy link
Contributor

mengqiy commented Feb 3, 2022

Please let me know when this PR is ready for a review.

@yuwenma
Copy link
Contributor Author

yuwenma commented Feb 3, 2022

Please let me know when this PR is ready for a review.

Thank you! This is PoC.
Also, I may move cnrm functions to other dir so they can be well maintained and not accidentally used by irrelevant cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants