Skip to content

Commit

Permalink
fix(installer): tke-gateway pods pull image failed by all-one (#825)
Browse files Browse the repository at this point in the history
  • Loading branch information
huxiaoliang committed Oct 16, 2020
1 parent 932a7c6 commit 19fac0d
Showing 1 changed file with 10 additions and 24 deletions.
34 changes: 10 additions & 24 deletions cmd/tke-installer/app/installer/installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -1433,31 +1433,17 @@ func (t *TKE) prepareBaremetalProviderConfig(ctx context.Context) error {
}

func (t *TKE) prepareImages(ctx context.Context) error {
pod := &corev1.Pod{
ObjectMeta: metav1.ObjectMeta{
Name: "tke-gateway",
Namespace: t.namespace,
},
Spec: corev1.PodSpec{
NodeSelector: map[string]string{
"node-role.kubernetes.io/master": "",
},
Containers: []corev1.Container{
{
Name: "tke-gateway",
Image: images.Get().TKEGateway.FullName(),
},
},
},
}
ctx, cancel := context.WithTimeout(ctx, time.Minute)
defer cancel()

err := apiclient.PullImageWithPod(ctx, t.globalClient, pod)
if err != nil {
return fmt.Errorf("prepare image error: %w", err)
for _, machine := range t.Cluster.Spec.Machines {
machineSSH, err := machine.SSH()
if err != nil {
return err
}
cmdString := fmt.Sprintf("docker pull %s", images.Get().TKEGateway.FullName())
_, err = machineSSH.CombinedOutput(cmdString)
if err != nil {
return errors.Wrap(err, machine.IP)
}
}

return nil
}

Expand Down

0 comments on commit 19fac0d

Please sign in to comment.