From 6d4133b995c1e9ecf757db07fa7bc44f95cd4e89 Mon Sep 17 00:00:00 2001
From: Kenny Ho <Kenny.Ho@amd.com>
Date: Wed, 19 Oct 2022 13:50:43 -0400
Subject: [PATCH] Replace usages of critical-pod annotation with
 priorityClassName

scheduler.alpha.kubernetes.io/critical-pod deprecated since kubernetes v1.16
---
 helm/amd-gpu/Chart.yaml                            | 2 +-
 helm/amd-gpu/templates/deviceplugin-daemonset.yaml | 3 +--
 helm/amd-gpu/templates/labeller.yaml               | 3 +--
 k8s-ds-amdgpu-dp-health.yaml                       | 3 +--
 k8s-ds-amdgpu-dp.yaml                              | 3 +--
 k8s-ds-amdgpu-labeller.yaml                        | 3 +--
 6 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/helm/amd-gpu/Chart.yaml b/helm/amd-gpu/Chart.yaml
index 08f03769..57c21f17 100644
--- a/helm/amd-gpu/Chart.yaml
+++ b/helm/amd-gpu/Chart.yaml
@@ -15,7 +15,7 @@ keywords:
   - gpu
 
 kubeVersion: ">= 1.18.0-0"
-version: 0.3.0
+version: 0.4.0
 appVersion: "1.18.0"
 
 dependencies:
diff --git a/helm/amd-gpu/templates/deviceplugin-daemonset.yaml b/helm/amd-gpu/templates/deviceplugin-daemonset.yaml
index b7c94e03..833f6298 100644
--- a/helm/amd-gpu/templates/deviceplugin-daemonset.yaml
+++ b/helm/amd-gpu/templates/deviceplugin-daemonset.yaml
@@ -9,8 +9,6 @@ spec:
       name: {{ .Chart.Name }}-dp-ds
   template:
     metadata:
-      annotations:
-        scheduler.alpha.kubernetes.io/critical-pod: ""
       labels:
         name: {{ .Chart.Name }}-dp-ds
     spec:
@@ -24,6 +22,7 @@ spec:
         {{- toYaml . | nindent 8 }}
       {{- end }}
       {{- end }}
+      priorityClassName: system-node-critical
       {{- with .Values.tolerations }}
       tolerations:
         {{- toYaml . | nindent 8 }}
diff --git a/helm/amd-gpu/templates/labeller.yaml b/helm/amd-gpu/templates/labeller.yaml
index eec35b9e..caaeec0b 100644
--- a/helm/amd-gpu/templates/labeller.yaml
+++ b/helm/amd-gpu/templates/labeller.yaml
@@ -36,8 +36,6 @@ spec:
       name: amdgpu-lr-ds
   template:
     metadata:
-      annotations:
-        scheduler.alpha.kubernetes.io/critical-pod: ""
       labels:
         name: amdgpu-lr-ds
     spec:
@@ -47,6 +45,7 @@ spec:
         {{- toYaml . | nindent 8 }}
       {{- end }}
       {{- end }}
+      priorityClassName: system-node-critical
       {{- with .Values.tolerations }}
       tolerations:
         {{- toYaml . | nindent 8 }}
diff --git a/k8s-ds-amdgpu-dp-health.yaml b/k8s-ds-amdgpu-dp-health.yaml
index 6e3beb22..f3224e9f 100644
--- a/k8s-ds-amdgpu-dp-health.yaml
+++ b/k8s-ds-amdgpu-dp-health.yaml
@@ -15,11 +15,10 @@ spec:
       name: amdgpu-dp-ds
   template:
     metadata:
-      annotations:
-        scheduler.alpha.kubernetes.io/critical-pod: ""
       labels:
         name: amdgpu-dp-ds
     spec:
+      priorityClassName: system-node-critical
       tolerations:
       - key: CriticalAddonsOnly
         operator: Exists
diff --git a/k8s-ds-amdgpu-dp.yaml b/k8s-ds-amdgpu-dp.yaml
index 6a72c26a..cfa5de54 100644
--- a/k8s-ds-amdgpu-dp.yaml
+++ b/k8s-ds-amdgpu-dp.yaml
@@ -9,11 +9,10 @@ spec:
       name: amdgpu-dp-ds
   template:
     metadata:
-      annotations:
-        scheduler.alpha.kubernetes.io/critical-pod: ""
       labels:
         name: amdgpu-dp-ds
     spec:
+      priorityClassName: system-node-critical
       tolerations:
       - key: CriticalAddonsOnly
         operator: Exists
diff --git a/k8s-ds-amdgpu-labeller.yaml b/k8s-ds-amdgpu-labeller.yaml
index 55b01c36..5da80b79 100644
--- a/k8s-ds-amdgpu-labeller.yaml
+++ b/k8s-ds-amdgpu-labeller.yaml
@@ -38,11 +38,10 @@ spec:
       name: amdgpu-lr-ds
   template:
     metadata:
-      annotations:
-        scheduler.alpha.kubernetes.io/critical-pod: ""
       labels:
         name: amdgpu-lr-ds
     spec:
+      priorityClassName: system-node-critical
       tolerations:
       - key: CriticalAddonsOnly
         operator: Exists
-- 
GitLab