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

add generated annotation #354

Closed
wants to merge 8 commits into from

Conversation

pnovotnak
Copy link

closes #353

Add a common label to generated objects, so that they may be identified as such. I don't think this requires documentation--the first place someone will probably look for this information on generated objects themselves.

add generated annotation
@k8s-ci-robot
Copy link
Contributor

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.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Sep 18, 2018
@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Sep 18, 2018
@pnovotnak
Copy link
Author

I just signed the CLA (again?) And I've already signed on behalf of my company so I think I'm good now?

@pnovotnak
Copy link
Author

/check-cla

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Sep 18, 2018
@pnovotnak
Copy link
Author

Looks like this PR is a little premature, I'll wrap it up tomorrow

@monopole
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 18, 2018
@monopole
Copy link
Contributor

/hold

test needs fixing.

Also, how about adding a new field to the kustomization.yaml file to allow people to add the annotation optionally rather than hardcoding it.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 18, 2018
@pnovotnak
Copy link
Author

@monopole I thought about that--I think it might be a good idea to add both, allowing users to overwrite the value of the default. Sound Ok?

@pnovotnak
Copy link
Author

Ah wait, @monopole, we can do this already with *Generator[*].behavior: merge

Peter Novotnak and others added 3 commits September 19, 2018 15:33
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 19, 2018
@k8s-ci-robot
Copy link
Contributor

New changes are detected. LGTM label has been removed.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: pnovotnak
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: monopole

If they are not already assigned, you can assign the PR to them by writing /assign @monopole in a comment when ready.

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 size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Sep 19, 2018
@k8s-ci-robot k8s-ci-robot removed the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Sep 19, 2018
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 19, 2018
@pnovotnak
Copy link
Author

Ok, tests are fixed, and I added a testcase for both configmaps and secrets that are not generated (neither should have the generated annotation applied).

I think this is ready to go if someone has time to review

@monopole
Copy link
Contributor

Hi, sorry about the delay.

We think this is a good feature, but would prefer to make it strictly optional.

@Liujingfang1 and i talked, and think it would be good to add a field at the root level - i.e.
here: https://github.com/kubernetes-sigs/kustomize/blob/master/pkg/types/kustomization.go#L27

called, say. GeneratorOptions that would, inside it, have options to modify the behavior of all secret and configmap generators (e.g. add a common annotation to them). This way we have a means to grow and add new options later.

E.g.

type Kustomization struct {
  ...
 GeneratorOptions GeneratorOptions
 ...
}
type GeneratorOptions struct {
 Labels map[string]string
 Annotations map[string]string
}

This PR would get smaller, because there'd be no need to change the data for all the tests. Just add new tests.

@Liujingfang1
Copy link
Contributor

@pnovotnak What's the progress on this? Do you need any help?

@pnovotnak
Copy link
Author

@Liujingfang1 Sorry! I hadn't been keeping up with my GH notifications. I'll make the change today

@Liujingfang1
Copy link
Contributor

I added generatorOptions in kustomization type. It can add optional labels/annotations to generated resources. #494

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generated Objects Should Have a Common Label or Annotation
4 participants