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

🌱 Operator two small required changes #5300

Merged

Conversation

asalkeld
Copy link
Contributor

@asalkeld asalkeld commented Sep 23, 2021

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.

  • Add a public factory for githubRepository
    This is needed because it is normally created in the same package, but since the operator is outside, we can't use this function.
  • Add a way to customize the component objects
    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.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 23, 2021
@k8s-ci-robot
Copy link
Contributor

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 23, 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.

@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..

cmd/clusterctl/client/repository/components.go Outdated Show resolved Hide resolved
cmd/clusterctl/client/repository/components.go Outdated Show resolved Hide resolved
@asalkeld asalkeld force-pushed the operator-required-fixes-combined branch from 6ed39b7 to c0ca97a Compare September 27, 2021 22:35
@enxebre
Copy link
Member

enxebre commented Sep 29, 2021

hey @asalkeld could you include in the PR desc and commit desc context about the "Why" in addition to the "what" (i.e git ci -m"imperative mood action" -m"WHY") so there's a lower entry barrier for reviewers not that familiar with clusterctl? Thanks!

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 29, 2021
@asalkeld asalkeld force-pushed the operator-required-fixes-combined branch from c0ca97a to 5616bcb Compare October 5, 2021 00:09
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Oct 5, 2021
@@ -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) {
Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Contributor Author

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) {

Copy link
Contributor Author

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..

@asalkeld asalkeld force-pushed the operator-required-fixes-combined branch from 5616bcb to ad98753 Compare October 6, 2021 04:12
@asalkeld
Copy link
Contributor Author

asalkeld commented Oct 6, 2021

/retest

@fabriziopandini
Copy link
Member

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 14, 2021
@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 14, 2021
@k8s-ci-robot k8s-ci-robot merged commit 55e92ea into kubernetes-sigs:main Oct 14, 2021
@k8s-ci-robot k8s-ci-robot added this to the v0.4 milestone Oct 14, 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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants