83 lines
2.7 KiB
Go
83 lines
2.7 KiB
Go
/*
|
|
Copyright 2021 The KubeSphere Authors.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
package templates
|
|
|
|
import (
|
|
"text/template"
|
|
|
|
"github.com/lithammer/dedent"
|
|
)
|
|
|
|
var ContainerdConfig = template.Must(template.New("config.toml").Parse(
|
|
dedent.Dedent(`version = 2
|
|
{{- if .DataRoot }}
|
|
root = {{ .DataRoot }}
|
|
{{ else }}
|
|
root = "/var/lib/containerd"
|
|
{{- end }}
|
|
|
|
[plugins]
|
|
|
|
[plugins."io.containerd.grpc.v1.cri"]
|
|
sandbox_image = "{{ .SandBoxImage }}"
|
|
|
|
[plugins."io.containerd.grpc.v1.cri".containerd]
|
|
default_runtime_name = "runc"
|
|
|
|
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes]
|
|
|
|
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]
|
|
runtime_type = 'io.containerd.runc.v2'
|
|
sandboxer = 'podsandbox'
|
|
snapshotter = "{{ .FsType }}"
|
|
|
|
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
|
|
SystemdCgroup = true
|
|
|
|
[plugins."io.containerd.grpc.v1.cri".registry]
|
|
|
|
[plugins."io.containerd.grpc.v1.cri".registry.mirrors]
|
|
{{- if .Mirrors }}
|
|
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"]
|
|
endpoint = [{{ .Mirrors }}, "https://registry-1.docker.io"]
|
|
{{ else }}
|
|
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"]
|
|
endpoint = ["https://registry-1.docker.io"]
|
|
{{- end}}
|
|
{{- range $value := .InsecureRegistries }}
|
|
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."{{$value}}"]
|
|
endpoint = ["http://{{$value}}"]
|
|
{{- end}}
|
|
|
|
{{- if .Auths }}
|
|
[plugins."io.containerd.grpc.v1.cri".registry.configs]
|
|
{{- range $repo, $entry := .Auths }}
|
|
[plugins."io.containerd.grpc.v1.cri".registry.configs."{{$repo}}".auth]
|
|
username = "{{$entry.Username}}"
|
|
password = "{{$entry.Password}}"
|
|
[plugins."io.containerd.grpc.v1.cri".registry.configs."{{$repo}}".tls]
|
|
ca_file = "{{$entry.CAFile}}"
|
|
cert_file = "{{$entry.CertFile}}"
|
|
key_file = "{{$entry.KeyFile}}"
|
|
insecure_skip_verify = {{$entry.SkipTLSVerify}}
|
|
{{- end}}
|
|
{{- end}}
|
|
|
|
[plugins."io.containerd.snapshotter.v1.zfs"]
|
|
root_path = "{{ .ZfsRootPath }}"
|
|
`)))
|