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

External etcd Support for Karmada Operator - Part 2 #5720

Merged
merged 1 commit into from
Oct 24, 2024

Conversation

jabellard
Copy link
Contributor

What type of PR is this?

/kind feature

What this PR does / why we need it:
This is an implementation of this proposal for adding support to the Karmada operator for external etcd cluster connections.

Which issue(s) this PR fixes:
Fixes #5242

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

@karmada-bot karmada-bot added the kind/feature Categorizes issue or PR as related to a new feature. label Oct 22, 2024
@karmada-bot karmada-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 22, 2024
@jabellard jabellard marked this pull request as draft October 22, 2024 13:07
@karmada-bot karmada-bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 22, 2024
@jabellard jabellard marked this pull request as ready for review October 22, 2024 13:20
@karmada-bot karmada-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 22, 2024
@jabellard
Copy link
Contributor Author

@RainbowMango, I gave some thought into how to best implement this part of the feature. Given that @chaosi-zju is doing some great work for standardizing naming conventions, my goal was to not duplicate that work. As such, the approach I took here is intended to:

  • Introduce as minimal changes as possible
  • Implement the changes in such a way that future refactorings and changes for the ongoing standardization effort can be incorporated into the code very easily

Copy link
Member

@RainbowMango RainbowMango left a comment

Choose a reason for hiding this comment

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

/assign

Copy link
Member

@RainbowMango RainbowMango left a comment

Choose a reason for hiding this comment

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

Generally looks good to me.

But the unit test is failing:

# go test ./operator/pkg/controller/karmada/... 
I1023 14:40:51.153174  499685 defaults.go:53] default Karmada Image Version: v0.0.0-master
--- FAIL: TestNewPlannerFor (0.00s)
    --- FAIL: TestNewPlannerFor/NewPlannerFor_WithInitAction_PlannerConstructed (0.00s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x178edff]

goroutine 42 [running]:
testing.tRunner.func1.2({0x1984860, 0x2c942f0})
	/root/.local/share/mise/installs/go/1.22.7/src/testing/testing.go:1631 +0x24a
testing.tRunner.func1()
	/root/.local/share/mise/installs/go/1.22.7/src/testing/testing.go:1634 +0x377
panic({0x1984860?, 0x2c942f0?})
	/root/.local/share/mise/installs/go/1.22.7/src/runtime/panic.go:770 +0x132
github.com/karmada-io/karmada/operator/pkg.NewInitJob(0xc0001b4a80)
	/root/go/src/github.com/karmada-io/karmada/operator/pkg/init.go:123 +0x73f
github.com/karmada-io/karmada/operator/pkg/controller/karmada.NewPlannerFor(0xc000602300, {0x7f57f0111bc8, 0xc000130d20}, 0xc00047c908)
	/root/go/src/github.com/karmada-io/karmada/operator/pkg/controller/karmada/planner.go:72 +0x14f
github.com/karmada-io/karmada/operator/pkg/controller/karmada.TestNewPlannerFor.func1(0xc0001c7520)
	/root/go/src/github.com/karmada-io/karmada/operator/pkg/controller/karmada/planner_test.go:79 +0x3c
testing.tRunner(0xc0001c7520, 0xc000130e10)
	/root/.local/share/mise/installs/go/1.22.7/src/testing/testing.go:1689 +0xfb
created by testing.(*T).Run in goroutine 41
	/root/.local/share/mise/installs/go/1.22.7/src/testing/testing.go:1742 +0x390
FAIL	github.com/karmada-io/karmada/operator/pkg/controller/karmada	0.024s

Comment on lines 80 to 83
// EtcClientCredentialsVolumeName defines the name of the volume for the etcd client credentials
EtcClientCredentialsVolumeName = "etcd-client" // #nosec G101
// EtcClientCredentialsMountPath defines the mount path for the etcd client credentials data
EtcClientCredentialsMountPath = "/etc/karmada/pki/etcd-client" // #nosec G101
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// EtcClientCredentialsVolumeName defines the name of the volume for the etcd client credentials
EtcClientCredentialsVolumeName = "etcd-client" // #nosec G101
// EtcClientCredentialsMountPath defines the mount path for the etcd client credentials data
EtcClientCredentialsMountPath = "/etc/karmada/pki/etcd-client" // #nosec G101
// EtcdClientCredentialsVolumeName defines the name of the volume for the etcd client credentials
EtcdClientCredentialsVolumeName = "etcd-client-cert" // #nosec G101
// EtcdClientCredentialsMountPath defines the mount path for the etcd client credentials data
EtcdClientCredentialsMountPath = "/etc/karmada/pki/etcd-client" // #nosec G101

const name: s/Etc/Etcd
volume name: s/etcd-client/etcd-client-cert

@codecov-commenter
Copy link

codecov-commenter commented Oct 23, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 37.67123% with 91 lines in your changes missing coverage. Please review.

Project coverage is 40.85%. Comparing base (13df63f) to head (5442736).
Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
operator/pkg/controlplane/etcd/util.go 0.00% 56 Missing ⚠️
operator/pkg/tasks/deinit/component.go 0.00% 21 Missing ⚠️
operator/pkg/controlplane/apiserver/apiserver.go 75.00% 4 Missing and 4 partials ⚠️
operator/pkg/controlplane/search/search.go 73.33% 2 Missing and 2 partials ⚠️
operator/pkg/controller/karmada/controller.go 0.00% 1 Missing ⚠️
operator/pkg/tasks/init/component.go 0.00% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5720      +/-   ##
==========================================
+ Coverage   40.52%   40.85%   +0.32%     
==========================================
  Files         650      651       +1     
  Lines       55184    55256      +72     
==========================================
+ Hits        22365    22573     +208     
+ Misses      31386    31241     -145     
- Partials     1433     1442       +9     
Flag Coverage Δ
unittests 40.85% <37.67%> (+0.32%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@jabellard
Copy link
Contributor Author

Generally looks good to me.

But the unit test is failing:

@RainbowMango , I just pushed changes to address those issues.

@RainbowMango
Copy link
Member

Great!
Maybe you can help to tidy the commits? e.g. squash them?

Signed-off-by: Joe Nathan Abellard <[email protected]>

Onwards!

Signed-off-by: Joe Nathan Abellard <[email protected]>

Onwards!

Signed-off-by: Joe Nathan Abellard <[email protected]>

Onwards!

Signed-off-by: Joe Nathan Abellard <[email protected]>

Onwards!

Signed-off-by: Joe Nathan Abellard <[email protected]>

Onwards!

Signed-off-by: Joe Nathan Abellard <[email protected]>

Onwards!

Signed-off-by: Joe Nathan Abellard <[email protected]>
@jabellard jabellard force-pushed the external_etcd_part2 branch from cf6a2b4 to 5442736 Compare October 23, 2024 11:11
@jabellard
Copy link
Contributor Author

Great! Maybe you can help to tidy the commits? e.g. squash them?

Just squashed.

Copy link
Member

@RainbowMango RainbowMango left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Oct 24, 2024
@karmada-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: RainbowMango

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

@karmada-bot karmada-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 24, 2024
@karmada-bot karmada-bot merged commit 60e8e34 into karmada-io:master Oct 24, 2024
12 checks passed
@RainbowMango
Copy link
Member

Hi @jabellard
As we discussed at the last community meeting, we will have a pre-release for this feature.
Here it is: https://github.com/karmada-io/karmada/releases/tag/v1.12.0-beta.0

@jabellard
Copy link
Contributor Author

Here it is: https://github.com/karmada-io/karmada/releases/tag/v1.12.0-beta.0

This is amazing! Thank you!

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. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add The Ability to Retrieve External Etcd Client Credentials From Secret
4 participants