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

Improve YAML processing in clusterctl #716

Merged
merged 6 commits into from
Jan 28, 2019

Conversation

randomvariable
Copy link
Member

@randomvariable randomvariable commented Jan 28, 2019

What this PR does / why we need it:

Part of UX improvements for kubernetes-sigs/cluster-api-provider-aws#276 and kubernetes-sigs/cluster-api-provider-aws#371, this allows clusterctl to search for relevant objects within manifests instead of assuming the first document in the YAML file is the correct one.

This enables the use of common configuration to be handled by kustomize, which will typically add elements to a YAML file.

Potentially, this will allow removal of the separate machines and cluster manifest, as they can now be the
same file.

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 #

Special notes for your reviewer:

Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.

Release note:

clusterctl: Can now use Machines as well as MachineLists for `clusterctl create cluster --machines`

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 28, 2019
@randomvariable
Copy link
Member Author

/test pull-cluster-api-test

@randomvariable randomvariable changed the title Improve YAML processing in clusterctl [wip] Improve YAML processing in clusterctl Jan 28, 2019
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 28, 2019
Allow clusterctl to handle a variety of groups of objects under
`--cluster` and `--machine`. Search for the correct objects instead
of assuming a single document.

This opens up being able to use a single configuration file, kustomize
and combining cluster, machine and other objects together.

Signed-off-by: Naadir Jeewa <[email protected]>
@randomvariable randomvariable changed the title [wip] Improve YAML processing in clusterctl Improve YAML processing in clusterctl Jan 28, 2019
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Jan 28, 2019
Copy link
Contributor

@chuckha chuckha left a comment

Choose a reason for hiding this comment

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

I really like the paths this opens up 👍 couple of comments and a few nits.

pkg/util/util.go Show resolved Hide resolved
pkg/util/util.go Outdated Show resolved Hide resolved
pkg/util/util.go Outdated Show resolved Hide resolved
pkg/util/util.go Outdated Show resolved Hide resolved
pkg/util/util.go Show resolved Hide resolved
pkg/util/util.go Outdated Show resolved Hide resolved
pkg/util/util.go Outdated Show resolved Hide resolved
pkg/util/util.go Outdated Show resolved Hide resolved
pkg/util/util.go Show resolved Hide resolved
chuckha and others added 2 commits January 28, 2019 14:30
Co-Authored-By: randomvariable <[email protected]>
Signed-off-by: Naadir Jeewa <[email protected]>
@randomvariable
Copy link
Member Author

Cleaned up the debugging code I was using as I was figuring out how API machinery bits work, and have switched to passing the Decoder to the relevant, private, functions.

}

// Will reread the file to find items which aren't a list.
// TODO: Make the Kind field mandatory on machines.yaml and then use the
Copy link
Member

Choose a reason for hiding this comment

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

Since we are still pre-alpha, maybe we should just bite the bullet and take the breaking change now?

@roberthbailey thoughts?

Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

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

This looks good! Left a few comments here and there. We should also make sure to update docs and gitbook (cc @davidewatson).

pkg/util/util.go Outdated Show resolved Hide resolved
pkg/util/util.go Outdated Show resolved Hide resolved
pkg/util/util.go Show resolved Hide resolved
pkg/util/util.go Outdated Show resolved Hide resolved
pkg/util/util.go Outdated Show resolved Hide resolved
pkg/util/util_test.go Show resolved Hide resolved
pkg/util/util_test.go Show resolved Hide resolved
pkg/util/util.go Show resolved Hide resolved
Signed-off-by: Naadir Jeewa <[email protected]>
@randomvariable
Copy link
Member Author

Have updated @vincepri

Signed-off-by: Naadir Jeewa <[email protected]>
Signed-off-by: Naadir Jeewa <[email protected]>
@vincepri
Copy link
Member

/approve
/assign @chuckha

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: randomvariable, vincepri

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 Jan 28, 2019
@chuckha
Copy link
Contributor

chuckha commented Jan 28, 2019

do I have review powers here?

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 28, 2019
@k8s-ci-robot k8s-ci-robot merged commit 9d16c16 into kubernetes-sigs:master Jan 28, 2019
@randomvariable randomvariable deleted the yaml/leniancy branch January 28, 2019 19:22
jayunit100 pushed a commit to jayunit100/cluster-api that referenced this pull request Jan 31, 2020
…erctl-settings

add clusterctl-settings.json
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.

5 participants