-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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: read templates from different sources #2265
✨clusterctl: read templates from different sources #2265
Conversation
/assign |
48dbee4
to
03e1172
Compare
/assign |
} | ||
|
||
if fileContent.Encoding == nil || *fileContent.Encoding != "base64" { | ||
return nil, errors.Errorf("invalid encoding detected for %q. Only base 64 encoding supported", rURL.Path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
return nil, errors.Errorf("invalid encoding detected for %q. Only base 64 encoding supported", rURL.Path) | |
return nil, errors.Errorf("invalid encoding detected for %q. Only base64 encoding supported", rURL.Path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also wanted to point out that we are just printing the rURL.Path
and not rURL.String()
. Not sure if that was the behavior you wanted. 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found printing rURL.Path less verbose, but I don't have strong opinions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool...I'm fine with it. Just wanted to confirm expected behavior.
cmd/clusterctl/cmd/config_cluster.go
Outdated
@@ -33,6 +34,13 @@ type configClusterOptions struct { | |||
kubernetesVersion string | |||
controlPlaneMachineCount int | |||
workerMachineCount int | |||
|
|||
URL string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this meant to be exported?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also do you want to use net.URL to have some sort of validation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are validating inside the library
@@ -47,19 +48,150 @@ func (c *clusterctlClient) GetProviderComponents(provider, targetNameSpace, watc | |||
return components, nil | |||
} | |||
|
|||
// GetClusterTemplateOptions carries the options supported by GetClusterTemplate. | |||
type GetClusterTemplateOptions struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type GetClusterTemplateOptions struct { | |
type GetClusterTemplateInput struct { |
Consider this for more clarrity to users
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no strong opinion, but all the other types in input to high-level types use options: InitOptions, DeleteOptions, MoveOptions, PlanUpgradeOptions, so I would prefer to keep this consistent (leave as it is or change all, but in another PR)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Options
tells me I'm configuring something, but here and in the other places you mentioned, the structs are really just used as input to avoid a bunch of arguments. We can refactor later, but to keep it consistent with other parts of Cluster API and providers, Input/Output is preferred
} | ||
|
||
// numSources return the number of template sources currently set on a GetClusterTemplateOptions. | ||
func (o *GetClusterTemplateOptions) numSources() int { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method seems to be used to check if the source is valid, seems that having more than one source isn't something we want to support. For that reason I'd suggest renaming to validateSources() error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to know the number of sources
- if > 1 error
- if == 0 use Respostiotry as a default source (values will be inferred from the cluster inventory)
@vincepri comment addressed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
@fabriziopandini squash and I think we should be good to go
@wfernandes over to you for lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: fabriziopandini, 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 |
@fabriziopandini Other than the |
a271ad3
to
67772a1
Compare
@wfernandes comment addressed + squashed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@fabriziopandini Looks like there are some conflicting files. |
67772a1
to
2d60f27
Compare
@wfernandes rebased |
/lgtm |
What this PR does / why we need it:
This PR introduces to clusterctl support for reading cluster templates from a location different than the provider repository.
Supported locations are GitHub repository, local file system, and ConfiMaps.
It also adds support for returning the list of variables in a template.
Which issue(s) this PR fixes:
Fixes #2133
/area clusterctl
/assign @ncdc
/assign @vincepri