-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Task description:
We removed the InitContainer for karmada-etcd in #6637, and marked the etcd-init-image flag deprecated in #6942. It is time to clean up the unused leftover code about setting the etcd init image during the process of karmadactl init.
Solution:
Here are the leftover code blocks:
karmada/pkg/karmadactl/cmdinit/kubernetes/deploy_test.go
Lines 392 to 430 in a14c8af
| func TestEtcdInitImage(t *testing.T) { | |
| tests := []struct { | |
| name string | |
| opt *CommandInitOption | |
| expected string | |
| }{ | |
| { | |
| name: "ImageRegistry is set and EtcdInitImage is set to default value", | |
| opt: &CommandInitOption{ | |
| ImageRegistry: "my-registry", | |
| EtcdInitImage: DefaultInitImage, | |
| }, | |
| expected: "my-registry/alpine:3.21.3", | |
| }, | |
| { | |
| name: "EtcdInitImage is set to a non-default value", | |
| opt: &CommandInitOption{ | |
| EtcdInitImage: "my-etcd-init-image", | |
| }, | |
| expected: "my-etcd-init-image", | |
| }, | |
| { | |
| name: "ImageRegistry is not set and EtcdInitImage is set to default value", | |
| opt: &CommandInitOption{ | |
| EtcdInitImage: DefaultInitImage, | |
| }, | |
| expected: DefaultInitImage, | |
| }, | |
| } | |
| for _, tt := range tests { | |
| t.Run(tt.name, func(t *testing.T) { | |
| result := tt.opt.etcdInitImage() | |
| if result != tt.expected { | |
| t.Errorf("Unexpected result: %s, expected: %s", result, tt.expected) | |
| } | |
| }) | |
| } | |
| } |
karmada/pkg/karmadactl/cmdinit/kubernetes/deploy.go
Lines 804 to 810 in a14c8af
| // get etcd-init image | |
| func (i *CommandInitOption) etcdInitImage() string { | |
| if i.ImageRegistry != "" && i.EtcdInitImage == DefaultInitImage { | |
| return i.ImageRegistry + "/alpine:3.21.3" | |
| } | |
| return i.EtcdInitImage | |
| } |
| setIfNotEmpty(&i.EtcdInitImage, localEtcd.InitImage.GetImage()) |
karmada/pkg/karmadactl/cmdinit/kubernetes/deploy_test.go
Lines 579 to 582 in a14c8af
| InitImage: config.Image{ | |
| Repository: "init-image", | |
| Tag: "latest", | |
| }, |
| assert.Equal(t, "init-image:latest", opt.EtcdInitImage) |
Who can join or take the task:
The good first issue is intended for first-time contributors to get started on his/her contributor journey.
After a contributor has successfully completed 1-2 good first issue's,
they should be ready to move on to help wanted items, saving the remaining good first issue for other new contributors.
How to join or take the task:
Just reply on the issue with the message /assign in a separate line.
Then, the issue will be assigned to you.
How to ask for help:
If you need help or have questions, please feel free to ask on this issue.
The issue author or other members of the community will guide you through the contribution process.