Skip to content

Commit

Permalink
capi: make containerd cri socket configurable
Browse files Browse the repository at this point in the history
We should be able to configure path to containerd CRI socket file,
`containerd_cri_socket`, for each distro. Its main use case is to
support distros with different CRI socket path, for example,
`/run/docker/libcontainerd/container.sock` for Flatcar. By default it
is `/var/run/containerd/containerd.sock` as it has been in all other
distros.

This PR is split out from
#248, as suggested
by @codenrhoden.
  • Loading branch information
Dongsu Park committed Nov 18, 2020
1 parent 2dfc8ba commit 3840feb
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
runtime-endpoint: unix://{{ containerd_cri_socket }}
2 changes: 1 addition & 1 deletion images/capi/ansible/roles/kubernetes/tasks/kubeadmpull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
mode: 0600

- name: Kubeadm pull images
shell: 'kubeadm config images pull --config /etc/kubeadm.yml'
shell: 'kubeadm config images pull --config /etc/kubeadm.yml --cri-socket {{ containerd_cri_socket }}'

- name: delete kubeadm config
file:
Expand Down
2 changes: 1 addition & 1 deletion images/capi/ansible/roles/kubernetes/tasks/url.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
loop: "{{ kubernetes_imgs }}"

- name: Load Kubernetes images
shell: 'CONTAINERD_NAMESPACE="k8s.io" ctr images import /tmp/{{ item }}'
shell: 'CONTAINERD_NAMESPACE="k8s.io" ctr --address={{ containerd_cri_socket }} images import /tmp/{{ item }}'
loop: "{{ kubernetes_imgs }}"

- name: Remove Kubernetes images
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ kubernetesVersion: {{ kubernetes_semver }}
apiVersion: kubeadm.k8s.io/v1beta1
kind: InitConfiguration
nodeRegistration:
criSocket: "/var/run/containerd/containerd.sock"
criSocket: {{ containerd_cri_socket }}
1 change: 1 addition & 0 deletions images/capi/packer/ami/packer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"containerd_version": null,
"containerd_sha256": null,
"containerd_url": "https://github.com/containerd/containerd/releases/download/v{{user `containerd_version`}}/cri-containerd-cni-{{user `containerd_version`}}-linux-amd64.tar.gz",
"containerd_cri_socket": "/var/run/containerd/containerd.sock",
"crictl_version": null,
"crictl_url": "https://github.com/kubernetes-sigs/cri-tools/releases/download/v{{user `crictl_version`}}/crictl-v{{user `crictl_version`}}-linux-amd64.tar.gz",
"build_timestamp": "{{timestamp}}",
Expand Down
1 change: 1 addition & 0 deletions images/capi/packer/azure/packer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"containerd_version": null,
"containerd_sha256": null,
"containerd_url": "https://github.com/containerd/containerd/releases/download/v{{user `containerd_version`}}/cri-containerd-cni-{{user `containerd_version`}}-linux-amd64.tar.gz",
"containerd_cri_socket": "/var/run/containerd/containerd.sock",
"crictl_version": null,
"crictl_url": "https://github.com/kubernetes-sigs/cri-tools/releases/download/v{{user `crictl_version`}}/crictl-v{{user `crictl_version`}}-linux-amd64.tar.gz",
"distribution": null,
Expand Down
2 changes: 1 addition & 1 deletion images/capi/packer/config/ansible-args.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"ansible_common_vars": "containerd_url={{user `containerd_url`}} containerd_sha256={{user `containerd_sha256`}} containerd_pause_image={{user `containerd_pause_image`}} containerd_additional_settings={{user `containerd_additional_settings`}} crictl_url={{user `crictl_url`}} crictl_sha256={{user `crictl_sha256`}} crictl_source_type={{user `crictl_source_type`}} custom_role={{user `custom_role`}} custom_role_names={{user `custom_role_names`}} disable_public_repos={{user `disable_public_repos`}} extra_debs={{user `extra_debs`}} extra_repos={{user `extra_repos`}} extra_rpms={{user `extra_rpms`}} http_proxy={{user `http_proxy`}} https_proxy={{user `https_proxy`}} kubeadm_template={{user `kubeadm_template`}} kubernetes_cni_http_source={{user `kubernetes_cni_http_source`}} kubernetes_cni_http_checksum={{user `kubernetes_cni_http_checksum`}} kubernetes_http_source={{user `kubernetes_http_source`}} kubernetes_container_registry={{user `kubernetes_container_registry`}} kubernetes_rpm_repo={{user `kubernetes_rpm_repo`}} kubernetes_rpm_gpg_key={{user `kubernetes_rpm_gpg_key`}} kubernetes_rpm_gpg_check={{user `kubernetes_rpm_gpg_check`}} kubernetes_deb_repo={{user `kubernetes_deb_repo`}} kubernetes_deb_gpg_key={{user `kubernetes_deb_gpg_key`}} kubernetes_cni_deb_version={{user `kubernetes_cni_deb_version`}} kubernetes_cni_rpm_version={{user `kubernetes_cni_rpm_version`}} kubernetes_cni_semver={{user `kubernetes_cni_semver`}} kubernetes_cni_source_type={{user `kubernetes_cni_source_type`}} kubernetes_semver={{user `kubernetes_semver`}} kubernetes_source_type={{user `kubernetes_source_type`}} kubernetes_load_additional_imgs={{user `kubernetes_load_additional_imgs`}} kubernetes_deb_version={{user `kubernetes_deb_version`}} kubernetes_rpm_version={{user `kubernetes_rpm_version`}} no_proxy={{user `no_proxy`}} redhat_epel_rpm={{user `redhat_epel_rpm`}} reenable_public_repos={{user `reenable_public_repos`}} remove_extra_repos={{user `remove_extra_repos`}} "
"ansible_common_vars": "containerd_url={{user `containerd_url`}} containerd_sha256={{user `containerd_sha256`}} containerd_pause_image={{user `containerd_pause_image`}} containerd_additional_settings={{user `containerd_additional_settings`}} containerd_cri_socket={{user `containerd_cri_socket`}} crictl_url={{user `crictl_url`}} crictl_sha256={{user `crictl_sha256`}} crictl_source_type={{user `crictl_source_type`}} custom_role={{user `custom_role`}} custom_role_names={{user `custom_role_names`}} disable_public_repos={{user `disable_public_repos`}} extra_debs={{user `extra_debs`}} extra_repos={{user `extra_repos`}} extra_rpms={{user `extra_rpms`}} http_proxy={{user `http_proxy`}} https_proxy={{user `https_proxy`}} kubeadm_template={{user `kubeadm_template`}} kubernetes_cni_http_source={{user `kubernetes_cni_http_source`}} kubernetes_cni_http_checksum={{user `kubernetes_cni_http_checksum`}} kubernetes_http_source={{user `kubernetes_http_source`}} kubernetes_container_registry={{user `kubernetes_container_registry`}} kubernetes_rpm_repo={{user `kubernetes_rpm_repo`}} kubernetes_rpm_gpg_key={{user `kubernetes_rpm_gpg_key`}} kubernetes_rpm_gpg_check={{user `kubernetes_rpm_gpg_check`}} kubernetes_deb_repo={{user `kubernetes_deb_repo`}} kubernetes_deb_gpg_key={{user `kubernetes_deb_gpg_key`}} kubernetes_cni_deb_version={{user `kubernetes_cni_deb_version`}} kubernetes_cni_rpm_version={{user `kubernetes_cni_rpm_version`}} kubernetes_cni_semver={{user `kubernetes_cni_semver`}} kubernetes_cni_source_type={{user `kubernetes_cni_source_type`}} kubernetes_semver={{user `kubernetes_semver`}} kubernetes_source_type={{user `kubernetes_source_type`}} kubernetes_load_additional_imgs={{user `kubernetes_load_additional_imgs`}} kubernetes_deb_version={{user `kubernetes_deb_version`}} kubernetes_rpm_version={{user `kubernetes_rpm_version`}} no_proxy={{user `no_proxy`}} redhat_epel_rpm={{user `redhat_epel_rpm`}} reenable_public_repos={{user `reenable_public_repos`}} remove_extra_repos={{user `remove_extra_repos`}} "
}
1 change: 1 addition & 0 deletions images/capi/packer/digitalocean/packer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"containerd_version": null,
"containerd_sha256": null,
"containerd_url": "https://github.com/containerd/containerd/releases/download/v{{user `containerd_version`}}/cri-containerd-cni-{{user `containerd_version`}}-linux-amd64.tar.gz",
"containerd_cri_socket": "/var/run/containerd/containerd.sock",
"crictl_version": null,
"crictl_url": "https://github.com/kubernetes-sigs/cri-tools/releases/download/v{{user `crictl_version`}}/crictl-v{{user `crictl_version`}}-linux-amd64.tar.gz",
"kubernetes_cni_rpm_version": null,
Expand Down
1 change: 1 addition & 0 deletions images/capi/packer/gce/packer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"containerd_version": null,
"containerd_sha256": null,
"containerd_url": "https://github.com/containerd/containerd/releases/download/v{{user `containerd_version`}}/cri-containerd-cni-{{user `containerd_version`}}-linux-amd64.tar.gz",
"containerd_cri_socket": "/var/run/containerd/containerd.sock",
"crictl_version": null,
"crictl_url": "https://github.com/kubernetes-sigs/cri-tools/releases/download/v{{user `crictl_version`}}/crictl-v{{user `crictl_version`}}-linux-amd64.tar.gz",
"kubernetes_cni_rpm_version": null,
Expand Down
1 change: 1 addition & 0 deletions images/capi/packer/ova/packer-node.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"containerd_version": null,
"containerd_sha256": null,
"containerd_url": "https://github.com/containerd/containerd/releases/download/v{{user `containerd_version`}}/cri-containerd-cni-{{user `containerd_version`}}-linux-amd64.tar.gz",
"containerd_cri_socket": "/var/run/containerd/containerd.sock",
"crictl_version": null,
"crictl_url": "https://github.com/kubernetes-sigs/cri-tools/releases/download/v{{user `crictl_version`}}/crictl-v{{user `crictl_version`}}-linux-amd64.tar.gz",
"datastore": "",
Expand Down
1 change: 1 addition & 0 deletions images/capi/packer/qemu/packer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"containerd_version": null,
"containerd_sha256": null,
"containerd_url": "https://github.com/containerd/containerd/releases/download/v{{user `containerd_version`}}/cri-containerd-cni-{{user `containerd_version`}}-linux-amd64.tar.gz",
"containerd_cri_socket": "/var/run/containerd/containerd.sock",
"crictl_version": null,
"crictl_url": "https://github.com/kubernetes-sigs/cri-tools/releases/download/v{{user `crictl_version`}}/crictl-v{{user `crictl_version`}}-linux-amd64.tar.gz",
"existing_ansible_ssh_args": "{{env `ANSIBLE_SSH_ARGS`}}",
Expand Down

0 comments on commit 3840feb

Please sign in to comment.