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
Adding flexibility to CCM #93764
Adding flexibility to CCM #93764
Conversation
1fd6c06
to
046878c
Compare
/retest |
func main() { | ||
rand.Seed(time.Now().UnixNano()) | ||
|
||
command := app.NewCloudControllerManagerCommand() | ||
cloud, err := cloudprovider.InitCloudProvider(cloudProviderName, cloudConfigFile) |
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 think we'd still want to call this after flag parsing since a provider will likely depend on flags for the cloud config file 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.
In fact, it would be good to update this reference to parse the cloud config file from the flag option.
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 think it might be nice to show a split example. Have 1 parameter (provider name) hard coded to demonstrate they can get rid of these flag options and the other parameter (cloud config file) which as Andrew suggests demonstrates how to consume flag options.
00a954c
to
135ea31
Compare
/retest |
1 similar comment
/retest |
1ae6f29
to
375f956
Compare
/test pull-kubernetes-bazel-test |
/lgtm |
/assign @liggitt |
- k8s.io/kubernetes/pkg/api/legacyscheme |
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.
was adding these back intentional or a bad rebase?
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.
intentional. This is indirectly imported by k8s.io/kubernetes/pkg/controller/testutil
-> node_ipam_controller_test
in `k8s.io/kubernetes/pkg/controller/nodeipam'.
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 could have a follow up PR to put the samples(like nodeIpamController) in its own directory and also split out the base/vanilla version from the sample showing usage of the extensions as mentioned above. In this way the .import-restrictions file might look better and make less confusion for cloud providers to follow.
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.
The changes under staging look fine to me.
I'm having trouble understanding the current status/consumers and goals for each of the following:
- current
cloud-controller-manager
command / binary (cmd/cloud-controller-manager)- is this included in current releases or image manifests built/pushed? are there consumers of this today?
- ideal minimal example
main()
- I expected this to live in staging
k8s.io/cloud-provider
with no k8s.io/kubernetes dependencies
- I expected this to live in staging
- an example that stitches in node_ipam to the minimal example (either by moving out node_ipam or by living in k8s.io/kubernetes)
Modifying the existing main()
to add node_ipam without first extracting the minimal k8s.io/kubernetes-free one is making the path to the minimal on harder to see. Is that still the plan?
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.
1.a) As a fast follow it might be nice to split the binary. Have a vanilla binary with none of the extensions in use which a cloud provider could copy and modify to get started. A sample which shows how to use each of the extension mechanisms. I think the vanilla should be here and the sample under a sample sub directory?
1.b) The CCM in K/K is not included in any releases but it is built to ensure it remains buildable. It is forked and modified into various other repos where the modified version is released. These changes should allow the cloud providers to just depend on libraries, no more forking needed.
2.a) +1, see the fast follow suggestion above.
2.b) +Alot, if we break the sample into its own directory, that should allow the base version to have no K8s.io/kubernetes dependencies. More importantly we can then enforce that the base version have no K8s.io/kubernetes dependencies.
- +1
@liggitt Would you please have a look when you have time? Thank you :) The changes added after last review: |
@@ -114,10 +115,17 @@ func StartTestServer(t Logger, customFlags []string) (result TestServer, err err | |||
if err != nil { | |||
return result, fmt.Errorf("failed to create config from options: %v", err) | |||
} | |||
cloud, err := cloudprovider.InitCloudProvider(config.Complete().ComponentConfig.KubeCloudShared.CloudProvider.Name, config.Complete().ComponentConfig.KubeCloudShared.CloudProvider.CloudConfigFile) |
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 don't have the context to know whether we should use a fake or not, but calling config.Complete()
twice was surprising to me
@@ -84,13 +85,13 @@ func StartTestServer(t Logger, customFlags []string) (result TestServer, err err | |||
if err != nil { | |||
return TestServer{}, err | |||
} | |||
all, disabled := app.KnownControllers(), app.ControllersDisabledByDefault.List() | |||
all := []string{"cloud-node", "cloud-node-lifecycle", "service", "route"} |
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.
will anything notice if this drifts? does it matter if it does?
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.
It doesn't matter even if we pass an empty string array. Used for validate: https://github.com/kubernetes/kubernetes/blob/bd95fb101dd83cfca9d95e55b2f0d29720016e51/staging/src/k8s.io/controller-manager/options/generic.go#L90
@@ -17,32 +17,131 @@ limitations under the License. | |||
// The external controller manager is responsible for running controller loops that | |||
// are cloud provider dependent. It uses the API to listen to new events on resources. | |||
|
|||
// This file should be written by each cloud provider. | |||
// The current file demonstrate how other cloud provider should leverage CCM and it uses fake parameters. Please modify for your own use. |
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 seems to be changing the current cloud-controller-manager binary to use fake / example params... am I reading that correctly? Is this in use by anyone who would be affected by these changes?
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.
Current plan is to keep this file as a sample main.go in k/k. Other cloud providers will have their own main.go file in their repo(e.g.:https://github.com/kubernetes/cloud-provider-aws/blob/master/cmd/aws-cloud-controller-manager/main.go
).
The current cloud-controller-manager binary (cmd/cloud-controller-manager) will only contain sample code and will not have consumers.
- k8s.io/kubernetes/pkg/api/legacyscheme |
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.
The changes under staging look fine to me.
I'm having trouble understanding the current status/consumers and goals for each of the following:
- current
cloud-controller-manager
command / binary (cmd/cloud-controller-manager)- is this included in current releases or image manifests built/pushed? are there consumers of this today?
- ideal minimal example
main()
- I expected this to live in staging
k8s.io/cloud-provider
with no k8s.io/kubernetes dependencies
- I expected this to live in staging
- an example that stitches in node_ipam to the minimal example (either by moving out node_ipam or by living in k8s.io/kubernetes)
Modifying the existing main()
to add node_ipam without first extracting the minimal k8s.io/kubernetes-free one is making the path to the minimal on harder to see. Is that still the plan?
3b7330e
to
5fd7cef
Compare
@liggitt Thank you so much for the review.
|
talked offline... cmd/cloud-controller-manager is currently built, but not included in release artifacts this PR is an interim state, and will be followed by the split described in #93764 (comment) /approve will leave lgtm to @cheftako |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cici37, liggitt 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 |
/lgtm |
Have the following PR to add more samples: #96385 |
@cici37: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. |
/retest |
What type of PR is this?
/kind feature
What this PR does / why we need it:
The Cloud Provider would be responsible for creating the outer CCM process which is https://github.com/kubernetes/kubernetes/blob/master/cmd/cloud-controller-manager/controller-manager.go and have the flexibility to specify the controllers and cloud provider config.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: