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

Separate kubeconfig operations from cluster manager #7267

Merged
merged 1 commit into from
Jan 17, 2024

Conversation

tatlat
Copy link
Member

@tatlat tatlat commented Jan 5, 2024

Issue #, if available:
#7110 (comment)

Description of changes:
These changes separate some functionality from ClusterManager into a new component which is solely responsible for writing the kubeconfig file. Unlike ClusterManager which used clusterctl to get the kubeconfig, the new component gets the kubeconfig content from the cluster's kubeconfig secret. Another higher level abstraction called ClusterCreator was also added which groups the Applier with the kubeconfig writer.

Testing (if applicable):
Manual testing with docker and cloudstack.

Documentation added/planned (if applicable):

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@eks-distro-bot
Copy link
Collaborator

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@eks-distro-bot eks-distro-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jan 5, 2024
@tatlat tatlat changed the title Separate kubeconfig operation from cluster manager Separate kubeconfig operations from cluster manager Jan 5, 2024
pkg/clustermanager/cluster_creator.go Outdated Show resolved Hide resolved
pkg/clustermanager/cluster_creator.go Outdated Show resolved Hide resolved
pkg/clustermanager/cluster_creator.go Outdated Show resolved Hide resolved
pkg/clustermanager/cluster_creator.go Outdated Show resolved Hide resolved
pkg/clustermanager/kubeconfig_manager.go Outdated Show resolved Hide resolved
pkg/clustermanager/kubeconfig_manager.go Outdated Show resolved Hide resolved
pkg/clustermanager/kubeconfig_manager.go Outdated Show resolved Hide resolved
pkg/workflows/workload/create.go Outdated Show resolved Hide resolved
pkg/clustermanager/cluster_creator.go Outdated Show resolved Hide resolved
pkg/workflows/workload/createcluster.go Outdated Show resolved Hide resolved
Copy link

codecov bot commented Jan 9, 2024

Codecov Report

Attention: 19 lines in your changes are missing coverage. Please review.

Comparison is base (a99d4da) 71.64% compared to head (9209b52) 71.71%.
Report is 12 commits behind head on main.

Files Patch % Lines
pkg/clustermanager/cluster_creator.go 72.72% 6 Missing and 3 partials ⚠️
cmd/eksctl-anywhere/cmd/createcluster.go 0.00% 4 Missing ⚠️
pkg/kubeconfig/kubeconfig_writer.go 93.61% 2 Missing and 1 partial ⚠️
pkg/providers/docker/docker.go 86.36% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7267      +/-   ##
==========================================
+ Coverage   71.64%   71.71%   +0.07%     
==========================================
  Files         556      559       +3     
  Lines       43190    43368     +178     
==========================================
+ Hits        30943    31101     +158     
- Misses      10537    10551      +14     
- Partials     1710     1716       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

pkg/clustermanager/cluster_creator.go Outdated Show resolved Hide resolved
pkg/clustermanager/cluster_creator.go Outdated Show resolved Hide resolved
pkg/dependencies/factory.go Outdated Show resolved Hide resolved
pkg/providers/docker/docker.go Outdated Show resolved Hide resolved
pkg/providers/docker/docker.go Outdated Show resolved Hide resolved
pkg/providers/docker/docker.go Outdated Show resolved Hide resolved
pkg/providers/kubeconfig_reader.go Outdated Show resolved Hide resolved
pkg/providers/kubeconfig_reader.go Outdated Show resolved Hide resolved
pkg/providers/provider.go Outdated Show resolved Hide resolved
pkg/providers/provider.go Outdated Show resolved Hide resolved
cmd/eksctl-anywhere/cmd/createcluster.go Outdated Show resolved Hide resolved
pkg/clustermanager/cluster_creator_test.go Outdated Show resolved Hide resolved
pkg/dependencies/factory_test.go Outdated Show resolved Hide resolved
pkg/kubeconfig/kubeconfig_writer.go Outdated Show resolved Hide resolved
pkg/kubeconfig/kubeconfig_writer.go Outdated Show resolved Hide resolved
pkg/kubeconfig/kubeconfig_writer.go Outdated Show resolved Hide resolved
pkg/providers/docker/docker.go Outdated Show resolved Hide resolved
pkg/kubeconfig/kubeconfig_writer.go Outdated Show resolved Hide resolved
pkg/providers/docker/docker.go Outdated Show resolved Hide resolved
@eks-distro-bot eks-distro-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 12, 2024
@tatlat tatlat marked this pull request as ready for review January 12, 2024 20:29
Comment on lines 51 to 59
cct.writer.EXPECT().Create(gomock.Any(), gomock.Any(), gomock.Any()).Return(os.NewFile(uintptr(*pointer.Uint(1)), "test"), "", nil)
}

func (cct *clusterCreatorTest) expectWriteKubeconfig() {
cct.kubeconfigWriter.EXPECT().WriteKubeconfig(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil)
}

func (cct *clusterCreatorTest) expectApplierRun() {
cct.applier.EXPECT().Run(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil)
Copy link
Member

Choose a reason for hiding this comment

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

is there a way we can expect a bit more than any?
there is a bit more logic in this code than just calling those methods
The methods need to be called with the right arguments

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure how to expect something specific for second and third arguments for filewriter's Create method, but I changed everything else.

pkg/dependencies/factory.go Show resolved Hide resolved
pkg/dependencies/factory.go Show resolved Hide resolved
pkg/dependencies/factory.go Show resolved Hide resolved
pkg/kubeconfig/kubeconfig.go Outdated Show resolved Hide resolved
pkg/providers/docker/docker.go Outdated Show resolved Hide resolved
pkg/providers/docker/docker.go Outdated Show resolved Hide resolved
@tatlat
Copy link
Member Author

tatlat commented Jan 16, 2024

/retest

@mitalipaygude
Copy link
Member

Can we update the description and squash the commits?

pkg/dependencies/factory.go Outdated Show resolved Hide resolved
pkg/clustermanager/cluster_creator_test.go Outdated Show resolved Hide resolved
pkg/clustermanager/cluster_creator_test.go Outdated Show resolved Hide resolved
@tatlat
Copy link
Member Author

tatlat commented Jan 17, 2024

/approve

@eks-distro-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tatlat

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

Copy link
Member

@g-gaston g-gaston left a comment

Choose a reason for hiding this comment

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

/lgtm

@eks-distro-bot eks-distro-bot merged commit a9517b1 into aws:main Jan 17, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants