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

✨clusterctl: generate returns better error message in case there is no management cluster available #5373

Merged

Conversation

ykakarap
Copy link
Contributor

@ykakarap ykakarap commented Oct 1, 2021

What this PR does / why we need it:
Adds better errors to clusterctl generate cluster command.
This PR also adds a few helper functions to help with detecting the state of the existing cluster.

With this PR if a user runs the following clusterctl generate command without a management cluster we get the following error:

New Error Message:

❯ clusterctl generate cluster test2 -i docker:v0.4.3 --flavor "development" --kubernetes-version "v1.22.1"          
Error: management cluster not available. Cannot auto-discover target namespace. Please specify a target namespace

Old Error Message:

❯ clusterctl generate cluster test2 -i docker:v0.4.3 --flavor "development" --kubernetes-version "v1.22.0"
Error: failed to get context "" from ["/home/kakaraparthy/.kube/config"]

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #5352

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Oct 1, 2021
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 1, 2021
@ykakarap ykakarap force-pushed the clusterctl-better-errors branch from 0462bfd to 3b16a7b Compare October 1, 2021 15:57
@fabriziopandini
Copy link
Member

/retitle clusterctl: generate returns better error message in case there is no management cluster available

@k8s-ci-robot k8s-ci-robot changed the title ✨ clusterctl: initial commit for better error messages clusterctl: generate returns better error message in case there is no management cluster available Oct 4, 2021
@fabriziopandini
Copy link
Member

/retitle ✨clusterctl: generate returns better error message in case there is no management cluster available

@k8s-ci-robot k8s-ci-robot changed the title clusterctl: generate returns better error message in case there is no management cluster available ✨clusterctl: generate returns better error message in case there is no management cluster available Oct 4, 2021
@ykakarap ykakarap force-pushed the clusterctl-better-errors branch from 3b16a7b to 56de3a6 Compare October 5, 2021 16:29
Copy link
Member

@sbueringer sbueringer left a comment

Choose a reason for hiding this comment

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

last nit from my side

cmd/clusterctl/client/cluster/proxy.go Outdated Show resolved Hide resolved
@ykakarap ykakarap force-pushed the clusterctl-better-errors branch from 56de3a6 to a4fe42f Compare October 5, 2021 16:47
@k8s-ci-robot
Copy link
Contributor

@ykakarap: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-cluster-api-apidiff-main a4fe42f link false /test pull-cluster-api-apidiff-main

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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.

@sbueringer
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 5, 2021
Copy link
Member

@fabriziopandini fabriziopandini left a comment

Choose a reason for hiding this comment

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

/lgtm

Wondering if we should wait after release before merging this 🤔

@sbueringer
Copy link
Member

sbueringer commented Oct 5, 2021

/lgtm

Wondering if we should wait after release before merging this 🤔

In this case I personally would prefer waiting until after the release.

@ykakarap
Copy link
Contributor Author

ykakarap commented Oct 5, 2021

/hold
until 1.0 release is out.

@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 Oct 5, 2021
@vincepri
Copy link
Member

vincepri commented Oct 6, 2021

Any reason to hold this? Seems a good improvement to me

@sbueringer
Copy link
Member

sbueringer commented Oct 6, 2021

My thinking was that we don't necessarily need it in v1.0.0 and we don't have enough time to see if it introduces any kind of flakiness. (although the chance of that is very low)

@ykakarap
Copy link
Contributor Author

ykakarap commented Oct 6, 2021

The chances of this introducing any flakiness is pretty low. Are there any other tests we can run to gain confidence that this did not introduce and unknown bugs or unexpected UX?

This is a good UX improvement for uses to try 1.0, would be nice to have in the 1.0 release.
However, it is okay if we do not include it as it is not blocking or critical.

@sbueringer
Copy link
Member

sbueringer commented Oct 6, 2021

Just to be clear. I don't have a strong opinion either way :). That was just why I wrote #5373 (comment). (We were also doing a bunch of manual testing with clusterctl locally yesterday with various upgrade scenarios with CAPD and CAPA)

@ykakarap
Copy link
Contributor Author

ykakarap commented Oct 6, 2021

/hold cancel
v1.0.0 release is out.

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 6, 2021
@fabriziopandini
Copy link
Member

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fabriziopandini

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 the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 7, 2021
@k8s-ci-robot k8s-ci-robot merged commit 4613624 into kubernetes-sigs:main Oct 7, 2021
@k8s-ci-robot k8s-ci-robot added this to the v0.4 milestone Oct 7, 2021
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", 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.

Show clearer error message when using clusterctl generate cluster without a cluster
5 participants