-
Notifications
You must be signed in to change notification settings - Fork 336
feat(platform): support containerd as runtime (#1390) #1470
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1577,7 +1577,7 @@ func (t *TKE) prepareImages(ctx context.Context) error { | |
| if err != nil { | ||
| return err | ||
| } | ||
| cmdString := fmt.Sprintf("docker pull %s", images.Get().TKEGateway.FullName()) | ||
| cmdString := fmt.Sprintf("nerdctl --insecure-registry --namespace k8s.io pull %s", images.Get().TKEGateway.FullName()) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why --insecre
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need pull without certs. |
||
| _, err = machineSSH.CombinedOutput(cmdString) | ||
| if err != nil { | ||
| return errors.Wrap(err, machine.IP) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,6 +48,7 @@ import ( | |
| "tkestack.io/tke/pkg/platform/provider/baremetal/images" | ||
| "tkestack.io/tke/pkg/platform/provider/baremetal/phases/addons/cniplugins" | ||
| "tkestack.io/tke/pkg/platform/provider/baremetal/phases/authzwebhook" | ||
| "tkestack.io/tke/pkg/platform/provider/baremetal/phases/containerd" | ||
| csioperatorimage "tkestack.io/tke/pkg/platform/provider/baremetal/phases/csioperator/images" | ||
| "tkestack.io/tke/pkg/platform/provider/baremetal/phases/docker" | ||
| "tkestack.io/tke/pkg/platform/provider/baremetal/phases/galaxy" | ||
|
|
@@ -502,6 +503,38 @@ func (p *Provider) EnsureNvidiaContainerRuntime(ctx context.Context, c *v1.Clust | |
| return nil | ||
| } | ||
|
|
||
| func (p *Provider) EnsureContainerRuntime(ctx context.Context, c *v1.Cluster) error { | ||
| if c.Cluster.Spec.Features.ContainerRuntime == platformv1.Docker { | ||
| return p.EnsureDocker(ctx, c) | ||
| } | ||
| return p.EnsureContainerd(ctx, c) | ||
| } | ||
|
|
||
| func (p *Provider) EnsureContainerd(ctx context.Context, c *v1.Cluster) error { | ||
| insecureRegistries := []string{p.config.Registry.Domain} | ||
| if p.config.Registry.NeedSetHosts() && c.Spec.TenantID != "" { | ||
| insecureRegistries = append(insecureRegistries, c.Spec.TenantID+"."+p.config.Registry.Domain) | ||
| } | ||
| option := &containerd.Option{ | ||
| InsecureRegistries: insecureRegistries, | ||
| SandboxImage: images.Get().Pause.FullName(), | ||
| } | ||
| for _, machine := range c.Spec.Machines { | ||
| machineSSH, err := machine.SSH() | ||
| if err != nil { | ||
| return err | ||
| } | ||
|
|
||
| option.IsGPU = gpu.IsEnable(machine.Labels) | ||
| err = containerd.Install(machineSSH, option) | ||
| if err != nil { | ||
| return errors.Wrap(err, machine.IP) | ||
| } | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we need try contained works well with gpu |
||
|
|
||
| return nil | ||
| } | ||
|
|
||
| func (p *Provider) EnsureDocker(ctx context.Context, c *v1.Cluster) error { | ||
| machines := map[bool][]platformv1.ClusterMachine{ | ||
| true: c.Spec.ScalingMachines, | ||
|
|
@@ -537,13 +570,13 @@ func (p *Provider) EnsureKubernetesImages(ctx context.Context, c *v1.Cluster) er | |
| machines := map[bool][]platformv1.ClusterMachine{ | ||
| true: c.Spec.ScalingMachines, | ||
| false: c.Spec.Machines}[len(c.Spec.ScalingMachines) > 0] | ||
| option := &image.Option{Version: c.Spec.Version, RegistryDomain: p.config.Registry.Domain} | ||
| option := &image.Option{Version: c.Spec.Version, RegistryDomain: p.config.Registry.Domain, KubeImages: images.KubecomponetNames} | ||
| for _, machine := range machines { | ||
| machineSSH, err := machine.SSH() | ||
| if err != nil { | ||
| return err | ||
| } | ||
| err = image.PullKubernetesImages(machineSSH, option) | ||
| err = image.PullKubernetesImages(c, machineSSH, option) | ||
| if err != nil { | ||
| return errors.Wrap(err, machine.IP) | ||
| } | ||
|
|
@@ -581,7 +614,11 @@ func (p *Provider) EnsureKubeadm(ctx context.Context, c *v1.Cluster) error { | |
| return err | ||
| } | ||
|
|
||
| err = kubeadm.Install(machineSSH, c.Spec.Version) | ||
| option := &kubeadm.Option{ | ||
| RuntimeType: c.Spec.Features.ContainerRuntime, | ||
| Version: c.Spec.Version, | ||
| } | ||
| err = kubeadm.Install(machineSSH, option) | ||
| if err != nil { | ||
| return errors.Wrap(err, machine.IP) | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why we need this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove it.