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

Extend 'config print' command with additional options #415

Merged
merged 9 commits into from
May 8, 2019

Conversation

xmudrii
Copy link
Member

@xmudrii xmudrii commented May 7, 2019

What this PR does / why we need it:

This is an experimental approach to the config print command. I tested and confirmed it works well. The config print command is now extended to support most of the options, so someone can build a configuration file without browsing GitHub and searching for the config.yaml.dist manifest.

The idea behind this is to improve the user experience, so the user can work with our API without having to browse GitHub to find config.yaml.dist or to browse the API types. Various tools have different approaches to this, so I can believe we can find a good one too.

However, I have several concerns regarding this topic:

  • All those flags can potentially confuse the user. It might make more sense to leave hosts and enableOpenIDConnect (so we have all features supported) and drop others as they're mostly like not-commonly used.
    • Instead of all flags we can put the most common ones and have a set flag that changes some property not covered by flags. That way the command is not overloaded with flags, but it's still possible to build usable configuration file.
    • Negative side of the set flag is that you still have to know the API.
  • Instead of a single config print command we can split them to two commands:
    • A config create command that works like one in this PR
    • A config print command that has two "modes":
      • Print full config.yaml.dist
      • Print just example manifest like we already have without this PR
      • In this case printing full config.yaml.dist might overlap with config create, so potentially we can drop one.
  • Another problem is maintainability—we need to make sure that we incorporate every API change here.
    • Using yamled is nice as we get a nice looking manifest without all the empty fields, but there is no strongly enforced type safety.
    • Using kyaml.UnmarshalStrict ensures that it'll not print invalid manifest, but in that case, there should be some unit test cases in the CI to check is it working.

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

Release note:

Extend 'config print' command with additional options

/assign @kron4eg

Signed-off-by: Marko Mudrinić <mudrinic.mare@gmail.com>
@xmudrii xmudrii requested a review from kron4eg May 7, 2019 10:08
@kubermatic-bot kubermatic-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Denotes that all commits in the pull request have the valid DCO signoff message. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 7, 2019
Signed-off-by: Marko Mudrinić <mudrinic.mare@gmail.com>
@kron4eg
Copy link
Member

kron4eg commented May 7, 2019

@xmudrii I just noticed that provider is not getting validated

$ kubeone config print -p unknown_provider
apiVersion: kubeone.io/v1alpha1
kind: KubeOneCluster
versions:
  kubernetes: 1.14.1
cloudProvider:
  name: unknown_provider

Signed-off-by: Marko Mudrinić <mudrinic.mare@gmail.com>
Signed-off-by: Marko Mudrinić <mudrinic.mare@gmail.com>
Signed-off-by: Marko Mudrinić <mudrinic.mare@gmail.com>
Signed-off-by: Marko Mudrinić <mudrinic.mare@gmail.com>
Copy link
Member

@kron4eg kron4eg left a comment

Choose a reason for hiding this comment

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

small tweaks are needed

pkg/cmd/config.go Outdated Show resolved Hide resolved
pkg/cmd/config.go Outdated Show resolved Hide resolved
Signed-off-by: Marko Mudrinić <mudrinic.mare@gmail.com>
Signed-off-by: Marko Mudrinić <mudrinic.mare@gmail.com>
Signed-off-by: Marko Mudrinić <mudrinic.mare@gmail.com>
Copy link
Member

@kron4eg kron4eg left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@kubermatic-bot kubermatic-bot added the lgtm Indicates that a PR is ready to be merged. label May 8, 2019
@kubermatic-bot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 01ecf6cbdfffbd2269b5ce6f2f736a27dded1f5a

@kubermatic-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kron4eg

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

@kubermatic-bot kubermatic-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 8, 2019
@xmudrii
Copy link
Member Author

xmudrii commented May 8, 2019

/override pull-kubeone-e2e-aws-conformance-1.13.5
/override pull-kubeone-e2e-digitalocean-conformance-1.13.5
/override pull-kubeone-e2e-digitalocean-conformance-1.14.1
/override pull-kubeone-e2e-digitalocean-upgrade-1.13.5-1.14.1

@kubermatic-bot
Copy link
Contributor

@xmudrii: Overrode contexts on behalf of xmudrii: pull-kubeone-e2e-aws-conformance-1.13.5, pull-kubeone-e2e-digitalocean-conformance-1.13.5, pull-kubeone-e2e-digitalocean-conformance-1.14.1, pull-kubeone-e2e-digitalocean-upgrade-1.13.5-1.14.1

In response to this:

/override pull-kubeone-e2e-aws-conformance-1.13.5
/override pull-kubeone-e2e-digitalocean-conformance-1.13.5
/override pull-kubeone-e2e-digitalocean-conformance-1.14.1
/override pull-kubeone-e2e-digitalocean-upgrade-1.13.5-1.14.1

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.

@xmudrii
Copy link
Member Author

xmudrii commented May 8, 2019

/test pull-kubeone-dependencies

@kubermatic-bot
Copy link
Contributor

@xmudrii: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubeone-e2e-digitalocean-conformance-1.14.1 cec0888 link /test pull-kubeone-e2e-digitalocean-conformance-1.14.1
pull-kubeone-e2e-digitalocean-conformance-1.13.5 cec0888 link /test pull-kubeone-e2e-digitalocean-conformance-1.13.5
pull-kubeone-e2e-digitalocean-upgrade-1.13.5-1.14.1 cec0888 link /test pull-kubeone-e2e-digitalocean-upgrade-1.13.5-1.14.1
pull-kubeone-e2e-aws-conformance-1.13.5 cec0888 link /test pull-kubeone-e2e-aws-conformance-1.13.5
pull-kubeone-e2e-aws-conformance-1.14.1 cec0888 link /test pull-kubeone-e2e-aws-conformance-1.14.1

Full PR test history

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.

@xmudrii
Copy link
Member Author

xmudrii commented May 8, 2019

/override pull-kubeone-e2e-aws-conformance-1.14.1

@kubermatic-bot
Copy link
Contributor

@xmudrii: Overrode contexts on behalf of xmudrii: pull-kubeone-e2e-aws-conformance-1.14.1

In response to this:

/override pull-kubeone-e2e-aws-conformance-1.14.1

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.

@kubermatic-bot kubermatic-bot merged commit 0b9f7fd into master May 8, 2019
@kubermatic-bot kubermatic-bot deleted the config-print-extend branch May 8, 2019 10:41
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. dco-signoff: yes Denotes that all commits in the pull request have the valid DCO signoff message. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

3 participants