@@ -108,22 +108,22 @@ func (e *Etcd) PreFunc(ctx context.Context, r runtime.Runtime) error {
108
108
// Pull the image and unpack it.
109
109
containerdctx := namespaces .WithNamespace (ctx , constants .SystemContainerdNamespace )
110
110
111
- img , err := image .Pull (containerdctx , r .Config ().Machine ().Registries (), client , r .Config ().Cluster ().Etcd ().Image (), image .WithSkipIfAlreadyPulled ())
111
+ spec , err := safe .ReaderGet [* etcdresource.Spec ](ctx , r .State ().V1Alpha2 ().Resources (), etcdresource .NewSpec (etcdresource .NamespaceName , etcdresource .SpecID ).Metadata ())
112
+ if err != nil {
113
+ // spec should be ready
114
+ return fmt .Errorf ("failed to get etcd spec: %w" , err )
115
+ }
116
+
117
+ img , err := image .Pull (containerdctx , r .Config ().Machine ().Registries (), client , spec .TypedSpec ().Image , image .WithSkipIfAlreadyPulled ())
112
118
if err != nil {
113
- return fmt .Errorf ("failed to pull image %q: %w" , r . Config ().Cluster (). Etcd (). Image () , err )
119
+ return fmt .Errorf ("failed to pull image %q: %w" , spec . TypedSpec ().Image , err )
114
120
}
115
121
116
122
e .imgRef = img .Target ().Digest .String ()
117
123
118
124
// Clear any previously set learner member ID
119
125
e .learnerMemberID = 0
120
126
121
- spec , err := safe .ReaderGet [* etcdresource.Spec ](ctx , r .State ().V1Alpha2 ().Resources (), etcdresource .NewSpec (etcdresource .NamespaceName , etcdresource .SpecID ).Metadata ())
122
- if err != nil {
123
- // spec should be ready
124
- return fmt .Errorf ("failed to get etcd spec: %w" , err )
125
- }
126
-
127
127
switch t := r .Config ().Machine ().Type (); t {
128
128
case machine .TypeInit :
129
129
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
400
400
"experimental-compact-hash-check-enabled" : "true" ,
401
401
}
402
402
403
- extraArgs := argsbuilder .Args (r . Config (). Cluster (). Etcd (). ExtraArgs () )
403
+ extraArgs := argsbuilder .Args (spec . ExtraArgs )
404
404
405
405
denyList := argsbuilder .WithDenyList (denyListArgs )
406
406
@@ -477,7 +477,7 @@ func (e *Etcd) argsForControlPlane(ctx context.Context, r runtime.Runtime, spec
477
477
"experimental-compact-hash-check-enabled" : "true" ,
478
478
}
479
479
480
- extraArgs := argsbuilder .Args (r . Config (). Cluster (). Etcd (). ExtraArgs () )
480
+ extraArgs := argsbuilder .Args (spec . ExtraArgs )
481
481
482
482
denyList := argsbuilder .WithDenyList (denyListArgs )
483
483
0 commit comments