-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ref: https://github.com/containerd/containerd/blob/release/2.0/docs/cri/config.md Signed-off-by: Brad Davidson <[email protected]>
- Loading branch information
Showing
7 changed files
with
163 additions
and
231 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
//go:build windows || windows_test | ||
// +build windows windows_test | ||
|
||
// test with: go test -tags windows_test | ||
// note that this requires the filename not end with '_windows.go' | ||
|
||
package templates | ||
|
||
import ( | ||
"net/url" | ||
"strings" | ||
"text/template" | ||
) | ||
|
||
const ContainerdConfigTemplate = ` | ||
{{- /* */ -}} | ||
# File generated by {{ .Program }}. DO NOT EDIT. Use config.toml.tmpl instead. | ||
version = 3 | ||
root = {{ printf "%q" .NodeConfig.Containerd.Root }} | ||
state = {{ printf "%q" .NodeConfig.Containerd.State }} | ||
[grpc] | ||
address = {{ deschemify .NodeConfig.Containerd.Address | printf "%q" }} | ||
[plugins."io.containerd.internal.v1.opt"] | ||
path = {{ printf "%q" .NodeConfig.Containerd.Opt }} | ||
[plugins.'io.containerd.grpc.v1.cri'] | ||
stream_server_address = "127.0.0.1" | ||
stream_server_port = "10010" | ||
[plugins.'io.containerd.cri.v1.runtime'] | ||
enable_selinux = false | ||
[plugins.'io.containerd.grpc.v1.cri'] | ||
stream_server_address = "127.0.0.1" | ||
stream_server_port = "10010" | ||
[plugins.'io.containerd.cri.v1.images'] | ||
snapshotter = "windows" | ||
[plugins.'io.containerd.cri.v1.runtime'.containerd] | ||
default_runtime_name = "runhcs-wcow-process" | ||
[plugins.'io.containerd.cri.v1.runtime'.containerd.runtimes.runhcs-wcow-process] | ||
runtime_type = "io.containerd.runhcs.v1" | ||
[plugins.'io.containerd.runtime.v2.task'] | ||
platforms = ["windows/amd64", "linux/amd64"] | ||
[plugins.'io.containerd.service.v1.diff-service'] | ||
default = ["windows", "windows-lcow"] | ||
[plugins.'io.containerd.cri.v1.runtime'.cni] | ||
bin_dir = {{ printf "%q" .NodeConfig.AgentConfig.CNIBinDir }} | ||
conf_dir = {{ printf "%q" .NodeConfig.AgentConfig.CNIConfDir }} | ||
[plugins.'io.containerd.grpc.v1.cri'.registry] | ||
config_path = "{{ .NodeConfig.Containerd.Registry }}" | ||
{{- if .PrivateRegistryConfig }} | ||
{{- range $k, $v := .PrivateRegistryConfig.Configs }} | ||
{{ if $v.Auth }} | ||
[plugins.'io.containerd.grpc.v1.cri'.registry.configs.'{{$k}}'.auth] | ||
{{ if $v.Auth.Username }}username = {{ printf "%q" $v.Auth.Username }}{{end}} | ||
{{ if $v.Auth.Password }}password = {{ printf "%q" $v.Auth.Password }}{{end}} | ||
{{ if $v.Auth.Auth }}auth = {{ printf "%q" $v.Auth.Auth }}{{end}} | ||
{{ if $v.Auth.IdentityToken }}identitytoken = {{ printf "%q" $v.Auth.IdentityToken }}{{end}} | ||
{{end -}} | ||
{{end -}} | ||
{{end -}} | ||
` | ||
|
||
// Windows config templates need named pipe addresses fixed up | ||
var templateFuncs = template.FuncMap{ | ||
"deschemify": func(s string) string { | ||
if strings.HasPrefix(s, "npipe:") { | ||
u, err := url.Parse(s) | ||
if err != nil { | ||
return "" | ||
} | ||
return u.Path | ||
} | ||
return s | ||
}, | ||
} |
Oops, something went wrong.