version = 2

root = "{{ .cri.containerd.data_root | default "/var/lib/containerd" }}"
state = "/run/containerd"

[grpc]
  address = "/run/containerd/containerd.sock"
  uid = 0
  gid = 0
  max_recv_message_size = 16777216
  max_send_message_size = 16777216

[ttrpc]
  address = ""
  uid = 0
  gid = 0

[debug]
  address = ""
  uid = 0
  gid = 0
  level = ""

[metrics]
  address = ""
  grpc_histogram = false

[cgroup]
  path = ""

[timeouts]
  "io.containerd.timeout.shim.cleanup" = "5s"
  "io.containerd.timeout.shim.load" = "5s"
  "io.containerd.timeout.shim.shutdown" = "3s"
  "io.containerd.timeout.task.state" = "2s"

[plugins]
  [plugins."io.containerd.grpc.v1.cri"]
    sandbox_image = "{{ .cri.sandbox_image.registry }}/{{ .cri.sandbox_image.repository }}:{{ .cri.sandbox_image.tag }}"
    [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]
      runtime_type = "io.containerd.runc.v2"
      [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
        SystemdCgroup = {{ if .cri.cgroup_driver | eq "systemd" }}true{{ else }}false{{ end }}
    [plugins."io.containerd.grpc.v1.cri".cni]
      bin_dir = "/opt/cni/bin"
      conf_dir = "/etc/cni/net.d"
      max_conf_num = 1
      conf_template = ""
    [plugins."io.containerd.grpc.v1.cri".registry]
      [plugins."io.containerd.grpc.v1.cri".registry.mirrors]
{{- if .cri.registry.mirrors | empty | not }}
        [plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"]
          endpoint = {{ .cri.registry.mirrors | toJson }}
{{- end }}
{{- range .cri.registry.insecure_registries }}
        [plugins."io.containerd.grpc.v1.cri".registry.mirrors."{{ . }}"]
          endpoint = ["http://{{ . }}"]
{{- end }}
{{- if .cri.registry.auths | empty | not }}
        [plugins."io.containerd.grpc.v1.cri".registry.configs]
  {{- range .cri.registry.auths }}
          [plugins."io.containerd.grpc.v1.cri".registry.configs."{{ .repo }}".auth]
            username = "{{ .username }}"
            password = "{{ .password }}"
          [plugins."io.containerd.grpc.v1.cri".registry.configs."{{ .repo }}".tls]
    {{- if.ca_file }}
            ca_file = {{ .ca_file }}
    {{- end }}
    {{- if .crt_file }}
            cert_file = {{ .crt_file }}
    {{- end }}
    {{- if .key_file }}
            key_file = {{ .key_file }}
    {{- end }}
            insecure_skip_verify = {{ .skip_ssl | default true }}
  {{- end }}
{{- end }}
