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

Remove k8s client validity check from pkg/flags #1807

Merged
merged 1 commit into from
Dec 6, 2022

Conversation

zregvart
Copy link
Contributor

Changes

With the addition of cli/pkg/cli/prerun to pkg/cmd/bundle in #1575 the validity of the Kubernetes REST client is checked via invocation of pkg/flags.InitParams where it fails with:

Error: Couldn't get kubeConfiguration namespace: invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable

A valid Kuberenets configuration should not be supplied for tkn bundle commands, so this removes verifying that the Kuberenets configuration is valid from pkg/flags.InitParams. Seems that the same check for validity is preformed whenever invocation of pkg/cli.Params.Clients is used regardless, so having a check in the InitParams needlessly enforces the requirement of valid Kubernetes configuration.

Submitter Checklist

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

  • Includes tests (if functionality changed/added)
  • Run the code checkers with make check
  • Regenerate the manpages, docs and go formatting with make generated
  • Commit messages follow commit message best practices

See the contribution guide
for more details.

Release Notes

tkn bundle commands no longer require valid Kubernetes client parameters

With the addition of `cli/pkg/cli/prerun` to `pkg/cmd/bundle` in tektoncd#1575
the validity of the Kubernetes REST client is checked via invocation of
`pkg/flags.InitParams` where it fails with:

```
Error: Couldn't get kubeConfiguration namespace: invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable
```

A valid Kuberenets configuration should not be supplied for `tkn bundle`
commands, so this removes verifying that the Kuberenets configuration is
valid from `pkg/flags.InitParams`. Seems that the same check for
validity is preformed whenever invocation of `pkg/cli.Params.Clients` is
used regardless, so having a check in the `InitParams` needlessly
enforces the requirement of valid Kubernetes configuration.
@tekton-robot tekton-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Nov 25, 2022
@tekton-robot tekton-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Nov 25, 2022
@tekton-robot
Copy link
Contributor

Hi @zregvart. Thanks for your PR.

I'm waiting for a tektoncd 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.

@tekton-robot tekton-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Nov 25, 2022
zregvart added a commit to zregvart/ec-cli that referenced this pull request Nov 25, 2022
For `tkn bundle push` a k8s client is initialized, if the command is run
without a valid Kubernetes configuration it'll fail.

This provides a fake Kubernetes configuration file, and using the
`KUBECONFIG` environment variable configures the k8s client to use it.

See tektoncd/cli#1807
@piyush-garg
Copy link
Contributor

/ok-to-test

@tekton-robot tekton-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 Nov 25, 2022
@vinamra28
Copy link
Member

/retest

zregvart added a commit to zregvart/ec-cli that referenced this pull request Nov 28, 2022
For `tkn bundle push` a k8s client is initialized, if the command is run
without a valid Kubernetes configuration it'll fail.

This provides a fake Kubernetes configuration file, and using the
`KUBECONFIG` environment variable configures the k8s client to use it.

See tektoncd/cli#1807
zregvart added a commit to zregvart/ec-cli that referenced this pull request Nov 29, 2022
For `tkn bundle push` a k8s client is initialized, if the command is run
without a valid Kubernetes configuration it'll fail.

This provides a fake Kubernetes configuration file, and using the
`KUBECONFIG` environment variable configures the k8s client to use it.

See tektoncd/cli#1807
zregvart added a commit to zregvart/ec-cli that referenced this pull request Nov 30, 2022
For `tkn bundle push` a k8s client is initialized, if the command is run
without a valid Kubernetes configuration it'll fail.

This provides a fake Kubernetes configuration file, and using the
`KUBECONFIG` environment variable configures the k8s client to use it.

See tektoncd/cli#1807
Copy link
Member

@vinamra28 vinamra28 left a comment

Choose a reason for hiding this comment

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

/cc @pradeepitm12 @piyush-garg @vdemeester
we might have to cut a patch release for this

@tekton-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vinamra28

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 Dec 5, 2022
@piyush-garg
Copy link
Contributor

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 6, 2022
@tekton-robot tekton-robot merged commit f9030b6 into tektoncd:main Dec 6, 2022
@zregvart zregvart deleted the pr/don-validate-k8s-client branch December 6, 2022 13:00
piyush-garg added a commit that referenced this pull request Jan 5, 2023
#1806 | [vinamra28] Bump chocolatey package to 0.28.0 | 2022/11/25-07:58
#1805 | [vinamra28] Bump version to v0.28.0 in README and releases.md | 2022/11/27-12:04
#1809 | [dependabot[bot]] Bump golang.org/x/sys from 0.2.0 to 0.3.0 | 2022/12/06-12:48
#1810 | [dependabot[bot]] Bump go.uber.org/zap from 1.23.0 to 1.24.0 | 2022/12/06-13:24
#1807 | [Zoran Regvart] Remove k8s client validity check from pkg/flags | 2022/12/06-13:58
#1811 | [dependabot[bot]] Bump github.com/sigstore/cosign from 1.12.1 to 1.13.1 | 2022/12/06-15:38
#1812 | [dependabot[bot]] Bump github.com/sigstore/sigstore from 1.4.5 to 1.4.6 | 2022/12/06-16:16
#1813 | [dependabot[bot]] Bump golang.org/x/net from 0.2.0 to 0.3.0 | 2022/12/07-06:52
#1815 | [dependabot[bot]] Bump golang.org/x/time from 0.2.0 to 0.3.0 | 2022/12/07-07:24
#1816 | [dependabot[bot]] Bump github.com/hashicorp/go-hclog from 1.3.1 to 1.4.0 | 2022/12/07-08:22
null | [Piyush Garg] Bump tektoncd/pipeline to v0.42.0 | 2022/12/07-09:30
null | [dependabot[bot]] Bump golang.org/x/crypto from 0.3.0 to 0.4.0 | 2022/12/07-15:24
null | [dependabot[bot]] Bump golang.org/x/net from 0.3.0 to 0.4.0 | 2022/12/08-13:22
null | [dependabot[bot]] Bump github.com/hashicorp/go-plugin from 1.4.6 to 1.4.8 | 2022/12/08-14:26
null | [dependabot[bot]] Bump k8s.io/api from 0.25.4 to 0.25.5 | 2022/12/09-12:14
null | [dependabot[bot]] Bump github.com/sigstore/sigstore from 1.4.6 to 1.5.0 | 2022/12/12-07:04
null | [dependabot[bot]] Bump go.uber.org/multierr from 1.8.0 to 1.9.0 | 2022/12/13-11:20
null | [Piyush Garg] Fix e2e test broken | 2022/12/19-15:21
null | [dependabot[bot]] Bump github.com/docker/cli | 2022/12/19-16:11
null | [dependabot[bot]] Bump github.com/docker/docker | 2022/12/19-17:03
null | [dependabot[bot]] Bump github.com/hashicorp/vault/sdk from 0.6.1 to 0.6.2 | 2022/12/22-09:25
null | [Piyush Garg] Fix pipeline version to v0.42.0 in e2e | 2022/12/26-12:35
null | [vinamra28] Add support to pass CSI workspace | 2022/12/26-13:21
null | [Yongxuan Zhang] fix trusted resources docs error | 2023/01/05-08:29
null | [Piyush Garg] Bump tektoncd/chains to v0.14.0 | 2023/01/05-09:31
null | [dependabot[bot]] Bump golang.org/x/sys from 0.3.0 to 0.4.0 | 2023/01/05-10:11
null | [dependabot[bot]] Bump golang.org/x/term from 0.3.0 to 0.4.0 | 2023/01/05-10:53
null | [dependabot[bot]] Bump golang.org/x/net from 0.4.0 to 0.5.0 | 2023/01/05-11:27
null | [dependabot[bot]] Bump golang.org/x/crypto from 0.4.0 to 0.5.0 | 2023/01/05-12:01
null | [dependabot[bot]] Bump github.com/hashicorp/go-retryablehttp from 0.7.1 to 0.7.2 | 2023/01/05-12:37

Signed-off-by: Piyush Garg <pgarg@redhat.com>
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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants