diff --git a/ansible/roles/k8s_gpu_intel/files/base/intel-gpu-plugin.yaml b/ansible/roles/k8s_gpu_intel/files/base/intel-gpu-plugin.yaml new file mode 100644 index 0000000..c58c2f4 --- /dev/null +++ b/ansible/roles/k8s_gpu_intel/files/base/intel-gpu-plugin.yaml @@ -0,0 +1,66 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: intel-gpu-plugin + labels: + app: intel-gpu-plugin +spec: + selector: + matchLabels: + app: intel-gpu-plugin + template: + metadata: + labels: + app: intel-gpu-plugin + spec: + initContainers: + - name: intel-gpu-initcontainer + image: intel/intel-gpu-initcontainer:0.26.0 + imagePullPolicy: IfNotPresent + securityContext: + seLinuxOptions: + type: "container_device_plugin_init_t" + readOnlyRootFilesystem: true + allowPrivilegeEscalation: false + volumeMounts: + - mountPath: /etc/kubernetes/node-feature-discovery/source.d/ + name: nfd-source-hooks + containers: + - name: intel-gpu-plugin + env: + - name: NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + image: intel/intel-gpu-plugin:0.26.0 + imagePullPolicy: IfNotPresent + securityContext: + seLinuxOptions: + type: "container_device_plugin_t" + readOnlyRootFilesystem: true + allowPrivilegeEscalation: false + volumeMounts: + - name: devfs + mountPath: /dev/dri + readOnly: true + - name: sysfs + mountPath: /sys/class/drm + readOnly: true + - name: kubeletsockets + mountPath: /var/lib/kubelet/device-plugins + volumes: + - name: devfs + hostPath: + path: /dev/dri + - name: sysfs + hostPath: + path: /sys/class/drm + - name: kubeletsockets + hostPath: + path: /var/lib/kubelet/device-plugins + - name: nfd-source-hooks + hostPath: + path: /etc/kubernetes/node-feature-discovery/source.d/ + type: DirectoryOrCreate + nodeSelector: + kubernetes.io/arch: amd64 diff --git a/ansible/roles/k8s_gpu_intel/files/base/kustomization.yaml b/ansible/roles/k8s_gpu_intel/files/base/kustomization.yaml new file mode 100644 index 0000000..f51925e --- /dev/null +++ b/ansible/roles/k8s_gpu_intel/files/base/kustomization.yaml @@ -0,0 +1,2 @@ +resources: + - intel-gpu-plugin.yaml diff --git a/ansible/roles/k8s_gpu_intel/files/kustomization.yaml b/ansible/roles/k8s_gpu_intel/files/kustomization.yaml new file mode 100644 index 0000000..f191f3a --- /dev/null +++ b/ansible/roles/k8s_gpu_intel/files/kustomization.yaml @@ -0,0 +1,2 @@ +bases: + - base diff --git a/ansible/roles/k8s_gpu_intel/files/overlays/fractional_resources/add-args.yaml b/ansible/roles/k8s_gpu_intel/files/overlays/fractional_resources/add-args.yaml new file mode 100644 index 0000000..a438bab --- /dev/null +++ b/ansible/roles/k8s_gpu_intel/files/overlays/fractional_resources/add-args.yaml @@ -0,0 +1,12 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: intel-gpu-plugin +spec: + template: + spec: + containers: + - name: intel-gpu-plugin + args: + - "-shared-dev-num=300" + - "-resource-manager" diff --git a/ansible/roles/k8s_gpu_intel/files/overlays/fractional_resources/add-nodeselector-intel-gpu.yaml b/ansible/roles/k8s_gpu_intel/files/overlays/fractional_resources/add-nodeselector-intel-gpu.yaml new file mode 100644 index 0000000..5f0fe70 --- /dev/null +++ b/ansible/roles/k8s_gpu_intel/files/overlays/fractional_resources/add-nodeselector-intel-gpu.yaml @@ -0,0 +1,9 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: intel-gpu-plugin +spec: + template: + spec: + nodeSelector: + intel.feature.node.kubernetes.io/gpu: "true" diff --git a/ansible/roles/k8s_gpu_intel/files/overlays/fractional_resources/add-podresource-mount.yaml b/ansible/roles/k8s_gpu_intel/files/overlays/fractional_resources/add-podresource-mount.yaml new file mode 100644 index 0000000..d127334 --- /dev/null +++ b/ansible/roles/k8s_gpu_intel/files/overlays/fractional_resources/add-podresource-mount.yaml @@ -0,0 +1,17 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: intel-gpu-plugin +spec: + template: + spec: + containers: + - name: intel-gpu-plugin + volumeMounts: + - name: podresources + mountPath: /var/lib/kubelet/pod-resources + volumes: + - name: podresources + hostPath: + path: /var/lib/kubelet/pod-resources + \ No newline at end of file diff --git a/ansible/roles/k8s_gpu_intel/files/overlays/fractional_resources/add-serviceaccount.yaml b/ansible/roles/k8s_gpu_intel/files/overlays/fractional_resources/add-serviceaccount.yaml new file mode 100644 index 0000000..396363a --- /dev/null +++ b/ansible/roles/k8s_gpu_intel/files/overlays/fractional_resources/add-serviceaccount.yaml @@ -0,0 +1,8 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: intel-gpu-plugin +spec: + template: + spec: + serviceAccountName: gpu-manager-sa diff --git a/ansible/roles/k8s_gpu_intel/files/overlays/fractional_resources/gpu-manager-role.yaml b/ansible/roles/k8s_gpu_intel/files/overlays/fractional_resources/gpu-manager-role.yaml new file mode 100644 index 0000000..17bca25 --- /dev/null +++ b/ansible/roles/k8s_gpu_intel/files/overlays/fractional_resources/gpu-manager-role.yaml @@ -0,0 +1,8 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: gpu-manager-role +rules: +- apiGroups: [""] + resources: ["pods"] + verbs: ["list"] diff --git a/ansible/roles/k8s_gpu_intel/files/overlays/fractional_resources/gpu-manager-rolebinding.yaml b/ansible/roles/k8s_gpu_intel/files/overlays/fractional_resources/gpu-manager-rolebinding.yaml new file mode 100644 index 0000000..444fc67 --- /dev/null +++ b/ansible/roles/k8s_gpu_intel/files/overlays/fractional_resources/gpu-manager-rolebinding.yaml @@ -0,0 +1,12 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: gpu-manager-rolebinding +subjects: +- kind: ServiceAccount + name: gpu-manager-sa + namespace: default +roleRef: + kind: ClusterRole + name: gpu-manager-role + apiGroup: rbac.authorization.k8s.io diff --git a/ansible/roles/k8s_gpu_intel/files/overlays/fractional_resources/gpu-manager-sa.yaml b/ansible/roles/k8s_gpu_intel/files/overlays/fractional_resources/gpu-manager-sa.yaml new file mode 100644 index 0000000..76b459d --- /dev/null +++ b/ansible/roles/k8s_gpu_intel/files/overlays/fractional_resources/gpu-manager-sa.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: gpu-manager-sa diff --git a/ansible/roles/k8s_gpu_intel/files/overlays/fractional_resources/kustomization.yaml b/ansible/roles/k8s_gpu_intel/files/overlays/fractional_resources/kustomization.yaml new file mode 100644 index 0000000..702053d --- /dev/null +++ b/ansible/roles/k8s_gpu_intel/files/overlays/fractional_resources/kustomization.yaml @@ -0,0 +1,11 @@ +bases: + - ../../base +resources: + - gpu-manager-rolebinding.yaml + - gpu-manager-role.yaml + - gpu-manager-sa.yaml +patches: + - path: add-serviceaccount.yaml + - path: add-podresource-mount.yaml + - path: add-args.yaml + - path: add-nodeselector-intel-gpu.yaml diff --git a/ansible/roles/k8s_gpu_intel/files/overlays/monitoring_shared-dev_nfd/add-args.yaml b/ansible/roles/k8s_gpu_intel/files/overlays/monitoring_shared-dev_nfd/add-args.yaml new file mode 100644 index 0000000..12eaeb4 --- /dev/null +++ b/ansible/roles/k8s_gpu_intel/files/overlays/monitoring_shared-dev_nfd/add-args.yaml @@ -0,0 +1,13 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: intel-gpu-plugin +spec: + template: + spec: + containers: + - name: intel-gpu-plugin + args: + - "-shared-dev-num=30" + - "-enable-monitoring" + - "-v=2" diff --git a/ansible/roles/k8s_gpu_intel/files/overlays/monitoring_shared-dev_nfd/add-nodeselector-intel-gpu.yaml b/ansible/roles/k8s_gpu_intel/files/overlays/monitoring_shared-dev_nfd/add-nodeselector-intel-gpu.yaml new file mode 100644 index 0000000..5f0fe70 --- /dev/null +++ b/ansible/roles/k8s_gpu_intel/files/overlays/monitoring_shared-dev_nfd/add-nodeselector-intel-gpu.yaml @@ -0,0 +1,9 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: intel-gpu-plugin +spec: + template: + spec: + nodeSelector: + intel.feature.node.kubernetes.io/gpu: "true" diff --git a/ansible/roles/k8s_gpu_intel/files/overlays/monitoring_shared-dev_nfd/kustomization.yaml b/ansible/roles/k8s_gpu_intel/files/overlays/monitoring_shared-dev_nfd/kustomization.yaml new file mode 100644 index 0000000..62fa100 --- /dev/null +++ b/ansible/roles/k8s_gpu_intel/files/overlays/monitoring_shared-dev_nfd/kustomization.yaml @@ -0,0 +1,5 @@ +bases: + - ../../base +patches: + - path: add-args.yaml + - path: add-nodeselector-intel-gpu.yaml diff --git a/ansible/roles/k8s_gpu_intel/files/overlays/namespace_kube-system/add-namespace-kube-system.yaml b/ansible/roles/k8s_gpu_intel/files/overlays/namespace_kube-system/add-namespace-kube-system.yaml new file mode 100644 index 0000000..0a50220 --- /dev/null +++ b/ansible/roles/k8s_gpu_intel/files/overlays/namespace_kube-system/add-namespace-kube-system.yaml @@ -0,0 +1,5 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: intel-gpu-plugin + namespace: kube-system diff --git a/ansible/roles/k8s_gpu_intel/files/overlays/namespace_kube-system/kustomization.yaml b/ansible/roles/k8s_gpu_intel/files/overlays/namespace_kube-system/kustomization.yaml new file mode 100644 index 0000000..574b82a --- /dev/null +++ b/ansible/roles/k8s_gpu_intel/files/overlays/namespace_kube-system/kustomization.yaml @@ -0,0 +1,4 @@ +bases: + - ../../base +patches: + - path: add-namespace-kube-system.yaml diff --git a/ansible/roles/k8s_gpu_intel/files/overlays/nfd_labeled_nodes/add-nodeselector-intel-gpu.yaml b/ansible/roles/k8s_gpu_intel/files/overlays/nfd_labeled_nodes/add-nodeselector-intel-gpu.yaml new file mode 100644 index 0000000..5f0fe70 --- /dev/null +++ b/ansible/roles/k8s_gpu_intel/files/overlays/nfd_labeled_nodes/add-nodeselector-intel-gpu.yaml @@ -0,0 +1,9 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: intel-gpu-plugin +spec: + template: + spec: + nodeSelector: + intel.feature.node.kubernetes.io/gpu: "true" diff --git a/ansible/roles/k8s_gpu_intel/files/overlays/nfd_labeled_nodes/kustomization.yaml b/ansible/roles/k8s_gpu_intel/files/overlays/nfd_labeled_nodes/kustomization.yaml new file mode 100644 index 0000000..a29f7bc --- /dev/null +++ b/ansible/roles/k8s_gpu_intel/files/overlays/nfd_labeled_nodes/kustomization.yaml @@ -0,0 +1,4 @@ +bases: + - ../../base +patches: + - path: add-nodeselector-intel-gpu.yaml