From 192f4c4e96693922e468201af88c0ddc52d40a48 Mon Sep 17 00:00:00 2001 From: Kaoet Date: Thu, 14 Feb 2019 19:51:38 +0800 Subject: [PATCH] Allow customizing container image path used in NVIDIA GPU addon. (#4229) --- inventory/sample/group_vars/k8s-cluster/k8s-cluster.yml | 5 +++++ .../nvidia_gpu/defaults/main.yml | 5 ++++- .../templates/k8s-device-plugin-nvidia-daemonset.yml.j2 | 2 +- .../templates/nvidia-driver-install-daemonset.yml.j2 | 8 ++++---- .../nvidia_gpu/vars/centos-7.yml | 2 +- .../nvidia_gpu/vars/ubuntu-16.yml | 2 +- .../nvidia_gpu/vars/ubuntu-18.yml | 2 +- 7 files changed, 17 insertions(+), 9 deletions(-) diff --git a/inventory/sample/group_vars/k8s-cluster/k8s-cluster.yml b/inventory/sample/group_vars/k8s-cluster/k8s-cluster.yml index cf1fb1776..73e55214f 100644 --- a/inventory/sample/group_vars/k8s-cluster/k8s-cluster.yml +++ b/inventory/sample/group_vars/k8s-cluster/k8s-cluster.yml @@ -210,3 +210,8 @@ persistent_volumes_enabled: false # nvidia_driver_version: "384.111" ## flavor can be tesla or gtx # nvidia_gpu_flavor: gtx +## NVIDIA driver installer images. Change them if you have trouble accessing gcr.io. +# nvidia_driver_install_centos_container: atzedevries/nvidia-centos-driver-installer:2 +# nvidia_driver_install_ubuntu_container: gcr.io/google-containers/ubuntu-nvidia-driver-installer@sha256:eea7309dc4fa4a5c9d716157e74b90826e0a853aa26c7219db4710ddcd1ad8bc +## NVIDIA GPU device plugin image. +# nvidia_gpu_device_plugin_container: "k8s.gcr.io/nvidia-gpu-device-plugin@sha256:0842734032018be107fa2490c98156992911e3e1f2a21e059ff0105b07dd8e9e" diff --git a/roles/kubernetes-apps/container_engine_accelerator/nvidia_gpu/defaults/main.yml b/roles/kubernetes-apps/container_engine_accelerator/nvidia_gpu/defaults/main.yml index 34aea1c47..5e4db4143 100644 --- a/roles/kubernetes-apps/container_engine_accelerator/nvidia_gpu/defaults/main.yml +++ b/roles/kubernetes-apps/container_engine_accelerator/nvidia_gpu/defaults/main.yml @@ -4,7 +4,10 @@ nvidia_driver_version: "390.87" nvidia_gpu_tesla_base_url: https://us.download.nvidia.com/tesla/ nvidia_gpu_gtx_base_url: http://us.download.nvidia.com/XFree86/Linux-x86_64/ nvidia_gpu_flavor: tesla -nvidia_url_end: "{{nvidia_driver_version}}/NVIDIA-Linux-x86_64-{{nvidia_driver_version}}.run" +nvidia_url_end: "{{ nvidia_driver_version }}/NVIDIA-Linux-x86_64-{{ nvidia_driver_version }}.run" nvidia_driver_install_container: false +nvidia_driver_install_centos_container: atzedevries/nvidia-centos-driver-installer:2 +nvidia_driver_install_ubuntu_container: gcr.io/google-containers/ubuntu-nvidia-driver-installer@sha256:eea7309dc4fa4a5c9d716157e74b90826e0a853aa26c7219db4710ddcd1ad8bc nvidia_driver_install_supported: false +nvidia_gpu_device_plugin_container: "k8s.gcr.io/nvidia-gpu-device-plugin@sha256:0842734032018be107fa2490c98156992911e3e1f2a21e059ff0105b07dd8e9e" nvidia_gpu_nodes: [] diff --git a/roles/kubernetes-apps/container_engine_accelerator/nvidia_gpu/templates/k8s-device-plugin-nvidia-daemonset.yml.j2 b/roles/kubernetes-apps/container_engine_accelerator/nvidia_gpu/templates/k8s-device-plugin-nvidia-daemonset.yml.j2 index 5fd84012c..f0fcb1ea9 100644 --- a/roles/kubernetes-apps/container_engine_accelerator/nvidia_gpu/templates/k8s-device-plugin-nvidia-daemonset.yml.j2 +++ b/roles/kubernetes-apps/container_engine_accelerator/nvidia_gpu/templates/k8s-device-plugin-nvidia-daemonset.yml.j2 @@ -38,7 +38,7 @@ spec: hostPath: path: /dev containers: - - image: "k8s.gcr.io/nvidia-gpu-device-plugin@sha256:0842734032018be107fa2490c98156992911e3e1f2a21e059ff0105b07dd8e9e" + - image: "{{ nvidia_gpu_device_plugin_container }}" command: ["/usr/bin/nvidia-gpu-device-plugin", "-logtostderr"] name: nvidia-gpu-device-plugin resources: diff --git a/roles/kubernetes-apps/container_engine_accelerator/nvidia_gpu/templates/nvidia-driver-install-daemonset.yml.j2 b/roles/kubernetes-apps/container_engine_accelerator/nvidia_gpu/templates/nvidia-driver-install-daemonset.yml.j2 index 5dda82189..71cee062e 100644 --- a/roles/kubernetes-apps/container_engine_accelerator/nvidia_gpu/templates/nvidia-driver-install-daemonset.yml.j2 +++ b/roles/kubernetes-apps/container_engine_accelerator/nvidia_gpu/templates/nvidia-driver-install-daemonset.yml.j2 @@ -48,7 +48,7 @@ spec: hostPath: path: / initContainers: - - image: "{{nvidia_driver_install_container}}" + - image: "{{ nvidia_driver_install_container }}" name: nvidia-driver-installer resources: requests: @@ -63,9 +63,9 @@ spec: - name: ROOT_MOUNT_DIR value: /root - name: NVIDIA_DRIVER_VERSION - value: "{{nvidia_driver_version}}" + value: "{{ nvidia_driver_version }}" - name: NVIDIA_DRIVER_DOWNLOAD_URL - value: "{{nvidia_driver_download_url_default}}" + value: "{{ nvidia_driver_download_url_default }}" volumeMounts: - name: nvidia-install-dir-host mountPath: /usr/local/nvidia @@ -74,5 +74,5 @@ spec: - name: root-mount mountPath: /root containers: - - image: "gcr.io/google-containers/pause:2.0" + - image: "{{ pod_infra_image_repo }}" name: pause diff --git a/roles/kubernetes-apps/container_engine_accelerator/nvidia_gpu/vars/centos-7.yml b/roles/kubernetes-apps/container_engine_accelerator/nvidia_gpu/vars/centos-7.yml index 5f6adfde7..b1ea65ba7 100644 --- a/roles/kubernetes-apps/container_engine_accelerator/nvidia_gpu/vars/centos-7.yml +++ b/roles/kubernetes-apps/container_engine_accelerator/nvidia_gpu/vars/centos-7.yml @@ -1,3 +1,3 @@ --- -nvidia_driver_install_container: atzedevries/nvidia-centos-driver-installer:2 +nvidia_driver_install_container: "{{ nvidia_driver_install_centos_container }}" nvidia_driver_install_supported: true diff --git a/roles/kubernetes-apps/container_engine_accelerator/nvidia_gpu/vars/ubuntu-16.yml b/roles/kubernetes-apps/container_engine_accelerator/nvidia_gpu/vars/ubuntu-16.yml index 04b9e0ac9..f1bfdfcbb 100644 --- a/roles/kubernetes-apps/container_engine_accelerator/nvidia_gpu/vars/ubuntu-16.yml +++ b/roles/kubernetes-apps/container_engine_accelerator/nvidia_gpu/vars/ubuntu-16.yml @@ -1,3 +1,3 @@ --- -nvidia_driver_install_container: gcr.io/google-containers/ubuntu-nvidia-driver-installer@sha256:eea7309dc4fa4a5c9d716157e74b90826e0a853aa26c7219db4710ddcd1ad8bc +nvidia_driver_install_container: "{{ nvidia_driver_install_ubuntu_container }}" nvidia_driver_install_supported: true diff --git a/roles/kubernetes-apps/container_engine_accelerator/nvidia_gpu/vars/ubuntu-18.yml b/roles/kubernetes-apps/container_engine_accelerator/nvidia_gpu/vars/ubuntu-18.yml index 04b9e0ac9..f1bfdfcbb 100644 --- a/roles/kubernetes-apps/container_engine_accelerator/nvidia_gpu/vars/ubuntu-18.yml +++ b/roles/kubernetes-apps/container_engine_accelerator/nvidia_gpu/vars/ubuntu-18.yml @@ -1,3 +1,3 @@ --- -nvidia_driver_install_container: gcr.io/google-containers/ubuntu-nvidia-driver-installer@sha256:eea7309dc4fa4a5c9d716157e74b90826e0a853aa26c7219db4710ddcd1ad8bc +nvidia_driver_install_container: "{{ nvidia_driver_install_ubuntu_container }}" nvidia_driver_install_supported: true