refactor: use etcd configuration from the EtcdSpec resource
This is currently no-op, just noticed that while looking into another bug. This should make the intention more clean. Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
This commit is contained in:
parent
4e9b688d3f
commit
c1e45071f0
@ -108,9 +108,15 @@ func (e *Etcd) PreFunc(ctx context.Context, r runtime.Runtime) error {
|
||||
// Pull the image and unpack it.
|
||||
containerdctx := namespaces.WithNamespace(ctx, constants.SystemContainerdNamespace)
|
||||
|
||||
img, err := image.Pull(containerdctx, r.Config().Machine().Registries(), client, r.Config().Cluster().Etcd().Image(), image.WithSkipIfAlreadyPulled())
|
||||
spec, err := safe.ReaderGet[*etcdresource.Spec](ctx, r.State().V1Alpha2().Resources(), etcdresource.NewSpec(etcdresource.NamespaceName, etcdresource.SpecID).Metadata())
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to pull image %q: %w", r.Config().Cluster().Etcd().Image(), err)
|
||||
// spec should be ready
|
||||
return fmt.Errorf("failed to get etcd spec: %w", err)
|
||||
}
|
||||
|
||||
img, err := image.Pull(containerdctx, r.Config().Machine().Registries(), client, spec.TypedSpec().Image, image.WithSkipIfAlreadyPulled())
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to pull image %q: %w", spec.TypedSpec().Image, err)
|
||||
}
|
||||
|
||||
e.imgRef = img.Target().Digest.String()
|
||||
@ -118,12 +124,6 @@ func (e *Etcd) PreFunc(ctx context.Context, r runtime.Runtime) error {
|
||||
// Clear any previously set learner member ID
|
||||
e.learnerMemberID = 0
|
||||
|
||||
spec, err := safe.ReaderGet[*etcdresource.Spec](ctx, r.State().V1Alpha2().Resources(), etcdresource.NewSpec(etcdresource.NamespaceName, etcdresource.SpecID).Metadata())
|
||||
if err != nil {
|
||||
// spec should be ready
|
||||
return fmt.Errorf("failed to get etcd spec: %w", err)
|
||||
}
|
||||
|
||||
switch t := r.Config().Machine().Type(); t {
|
||||
case machine.TypeInit:
|
||||
if err = e.argsForInit(ctx, r, spec.TypedSpec()); err != nil {
|
||||
@ -400,7 +400,7 @@ func (e *Etcd) argsForInit(ctx context.Context, r runtime.Runtime, spec *etcdres
|
||||
"experimental-compact-hash-check-enabled": "true",
|
||||
}
|
||||
|
||||
extraArgs := argsbuilder.Args(r.Config().Cluster().Etcd().ExtraArgs())
|
||||
extraArgs := argsbuilder.Args(spec.ExtraArgs)
|
||||
|
||||
denyList := argsbuilder.WithDenyList(denyListArgs)
|
||||
|
||||
@ -477,7 +477,7 @@ func (e *Etcd) argsForControlPlane(ctx context.Context, r runtime.Runtime, spec
|
||||
"experimental-compact-hash-check-enabled": "true",
|
||||
}
|
||||
|
||||
extraArgs := argsbuilder.Args(r.Config().Cluster().Etcd().ExtraArgs())
|
||||
extraArgs := argsbuilder.Args(spec.ExtraArgs)
|
||||
|
||||
denyList := argsbuilder.WithDenyList(denyListArgs)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user