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 support for applying and deleting configs on cluster #582

Merged
merged 1 commit into from
Jul 13, 2020

Conversation

YolandaDu1997
Copy link
Contributor

@YolandaDu1997 YolandaDu1997 commented Jul 7, 2020

Changes

This PR aims to add support for managing generated configs on Kubernetes cluster for Tekton Generators.

The changes includes:

  1. Add support for applying config to cluster.
  2. Add support for deleting configs from cluster.

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

See the contribution guide
for more details.

@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 7, 2020
generators/pkg/manager/manage.go Outdated Show resolved Hide resolved
generators/pkg/manager/manage_test.go Outdated Show resolved Hide resolved
@YolandaDu1997
Copy link
Contributor Author

/retest

generators/pkg/manager/manage.go Outdated Show resolved Hide resolved
Comment on lines 21 to 27
var kubeconfig *string
if home := homedir.HomeDir(); home != "" {
kubeconfig = flag.String("kubeconfig", filepath.Join(home, ".kube", "config"), "(optional) absolute path to the kubeconfig file")
} else {
kubeconfig = flag.String("kubeconfig", "", "absolute path to the kubeconfig file")
}
flag.Parse()
Copy link
Member

Choose a reason for hiding this comment

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

I think we should probably break this out from this func.

  1. I'm not sure if these flags will actually render in --help unless they're declared in a var / cobra flags
  2. I'm not sure what happens if you call flag.Parse multiple times, which may cause problems.
  3. This forces the flags on any caller of the function, which is generally something I try to avoid.

What I think we should do instead is define this flag on the cobra root command, which will automatically apply to all subcommands, and change this func to just take the kubeconfig path as a string.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will move the kubeconfig as the flag on the cobra root command.

generators/pkg/manager/manage.go Outdated Show resolved Hide resolved
@YolandaDu1997
Copy link
Contributor Author

Done.

Copy link
Member

@wlynch wlynch left a comment

Choose a reason for hiding this comment

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

/lgtm

Looks good! Let's squash this up.

generators/pkg/manager/manage.go Outdated Show resolved Hide resolved
@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 10, 2020
This commit is to add support to apply generated configs on cluster and
then also enable users to delete them from cluster. Use subtests to test
different cases.
@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Jul 10, 2020
@YolandaDu1997
Copy link
Contributor Author

Done!

@dibyom
Copy link
Member

dibyom commented Jul 10, 2020

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 10, 2020
@wlynch
Copy link
Member

wlynch commented Jul 13, 2020

/lgtm
/approval

@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: wlynch

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

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 13, 2020
@tekton-robot tekton-robot merged commit a5b2f43 into tektoncd:master Jul 13, 2020
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. lgtm Indicates that a PR is ready to be merged. 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.

4 participants