-
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
🌱 Operator two small required changes #5300
🌱 Operator two small required changes #5300
Conversation
Hi @asalkeld. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the 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. |
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.
@asalkeld I'm not sure I fully understand the rational for this changes; some of the feedback are more request of clarifications than real suggestions..
6ed39b7
to
c0ca97a
Compare
hey @asalkeld could you include in the PR desc and commit desc context about the "Why" in addition to the "what" ( /ok-to-test |
c0ca97a
to
5616bcb
Compare
@@ -116,6 +116,11 @@ func (g *gitHubRepository) GetFile(version, path string) ([]byte, error) { | |||
return files, nil | |||
} | |||
|
|||
// NewGitHubRepository returns a gitHubRepository implementation. | |||
func NewGitHubRepository(providerConfig config.Provider, configVariablesClient config.VariablesClient, opts ...githubRepositoryOption) (Repository, 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.
Q: Can we avoid this wrapper and just make the existing constructor public?
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.
Sure I can make it public and return the private struct.
I made the new constructor to return the Repository interface rather than the private type, since the unit tests use private
functions we still needed that. 🤷♂️ - not much difference I guess
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.
Just tried this and I get this lint error
cmd/clusterctl/client/repository/repository_github.go:120:137: unexported-return: exported func NewGitHubRepository returns unexported type *repository.gitHubRepository, which can be annoying to use (revive)
func NewGitHubRepository(providerConfig config.Provider, configVariablesClient config.VariablesClient, opts ...githubRepositoryOption) (*gitHubRepository, 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.
so there were not many uses of the private struct, so i have changed the return to "Repository" and cast the usages in the unit tests..
5616bcb
to
ad98753
Compare
/retest |
/lgtm |
[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 |
What this PR does / why we need it:
When implementing the capi operator (#4926) that uses
clusterctl as a library there were some required changes needed to complete the PR.
This is needed because it is normally created in the same package, but since the operator is outside, we can't use this function.
The operator API defines a different way of customizing the provider's components (to how clusterctl does it natively) so we need a way of injecting these changes back into the Component. This commit just adds a SetObjs() function.