From c19fb29a9720aa4a8069dea46973f149c4d3ea5f Mon Sep 17 00:00:00 2001
From: npsables <phuongnguyen.ng3010@gmail.com>
Date: Tue, 14 Feb 2023 10:52:32 +0700
Subject: [PATCH 1/7] fix: mount kerberos.keytab to worker when enable

---
 chart/templates/workers/worker-deployment.yaml | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/chart/templates/workers/worker-deployment.yaml b/chart/templates/workers/worker-deployment.yaml
index 95cc7f137b595..118e3e2fadb65 100644
--- a/chart/templates/workers/worker-deployment.yaml
+++ b/chart/templates/workers/worker-deployment.yaml
@@ -217,7 +217,11 @@ spec:
             - name: logs
               mountPath: {{ template "airflow_logs" . }}
 {{- include "airflow_config_mount" . | nindent 12 }}
-            {{- if .Values.workers.kerberosSidecar.enabled }}
+            {{- if .Values.kerberos.enabled }}
+            - name: kerberos-keytab
+              subPath: "kerberos.keytab"
+              mountPath: {{ .Values.kerberos.keytabPath | quote }}
+              readOnly: true
             - name: config
               mountPath: {{ .Values.kerberos.configPath | quote }}
               subPath: krb5.conf

From 5ad2ed16856ecfc7e96ff1cc1961e22120b8440b Mon Sep 17 00:00:00 2001
From: Nguyen Phuong <phuongnguyen.ng3010@gmail.com>
Date: Mon, 27 Feb 2023 15:32:01 +0700
Subject: [PATCH 2/7] add testcase

---
 tests/charts/test_kerberos.py | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/tests/charts/test_kerberos.py b/tests/charts/test_kerberos.py
index ebccfa1000f52..3299805f2af0c 100644
--- a/tests/charts/test_kerberos.py
+++ b/tests/charts/test_kerberos.py
@@ -97,6 +97,26 @@ def test_keberos_sidecar_resources_are_not_added_by_default(self):
         )
         assert jmespath.search("spec.template.spec.containers[0].resources", docs[0]) == {}
 
+    def test_kerberos_keytab_exists_in_worker_when_enable(self):  
+        docs = render_chart(
+            values={
+                "executor": "CeleryExecutor",
+                "kerberos": {
+                    "enabled": True,
+                    "keytabBase64Content": "dGVzdGtleXRhYg==",
+                    "configPath": "/etc/krb5.conf",
+                    "ccacheMountPath": "/var/kerberos-ccache",
+                    "ccacheFileName": "ccache",
+                },
+            },
+            show_only=["templates/workers/worker-deployment.yaml"],
+        )
+
+        assert {'name': 'kerberos-keytab', 
+                'subPath': 'kerberos.keytab', 
+                'mountPath': '/etc/airflow.keytab', 
+                'readOnly': True} in jmespath.search("spec.template.spec.containers[0].volumeMounts", docs[0]) 
+
     def test_kerberos_keytab_secret_available(self):
         docs = render_chart(
             values={

From 9e89d47142b15f22f31c6bdc57a416a42e2839e7 Mon Sep 17 00:00:00 2001
From: Nguyen Phuong <phuongnguyen.ng3010@gmail.com>
Date: Mon, 27 Feb 2023 15:53:09 +0700
Subject: [PATCH 3/7] double quotes

---
 tests/charts/test_kerberos.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/charts/test_kerberos.py b/tests/charts/test_kerberos.py
index 3299805f2af0c..d01206c726642 100644
--- a/tests/charts/test_kerberos.py
+++ b/tests/charts/test_kerberos.py
@@ -112,10 +112,10 @@ def test_kerberos_keytab_exists_in_worker_when_enable(self):
             show_only=["templates/workers/worker-deployment.yaml"],
         )
 
-        assert {'name': 'kerberos-keytab', 
-                'subPath': 'kerberos.keytab', 
-                'mountPath': '/etc/airflow.keytab', 
-                'readOnly': True} in jmespath.search("spec.template.spec.containers[0].volumeMounts", docs[0]) 
+        assert {"name": "kerberos-keytab",
+                "subPath": "kerberos.keytab",
+                "mountPath": "/etc/airflow.keytab",
+                "readOnly": True} in jmespath.search("spec.template.spec.containers[0].volumeMounts", docs[0])
 
     def test_kerberos_keytab_secret_available(self):
         docs = render_chart(

From bf1f036413706c5fe4ffacafb6985c12f3268998 Mon Sep 17 00:00:00 2001
From: npsables <phuongnguyen.ng3010@gmail.com>
Date: Tue, 14 Feb 2023 10:52:32 +0700
Subject: [PATCH 4/7] fix: mount kerberos.keytab to worker when enable

---
 chart/templates/workers/worker-deployment.yaml | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/chart/templates/workers/worker-deployment.yaml b/chart/templates/workers/worker-deployment.yaml
index 95cc7f137b595..118e3e2fadb65 100644
--- a/chart/templates/workers/worker-deployment.yaml
+++ b/chart/templates/workers/worker-deployment.yaml
@@ -217,7 +217,11 @@ spec:
             - name: logs
               mountPath: {{ template "airflow_logs" . }}
 {{- include "airflow_config_mount" . | nindent 12 }}
-            {{- if .Values.workers.kerberosSidecar.enabled }}
+            {{- if .Values.kerberos.enabled }}
+            - name: kerberos-keytab
+              subPath: "kerberos.keytab"
+              mountPath: {{ .Values.kerberos.keytabPath | quote }}
+              readOnly: true
             - name: config
               mountPath: {{ .Values.kerberos.configPath | quote }}
               subPath: krb5.conf

From bee72e30209be4a6ecf71c7a341cd4ea94f1cedc Mon Sep 17 00:00:00 2001
From: Nguyen Phuong <phuongnguyen.ng3010@gmail.com>
Date: Mon, 27 Feb 2023 15:32:01 +0700
Subject: [PATCH 5/7] add testcase

---
 tests/charts/test_kerberos.py | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/tests/charts/test_kerberos.py b/tests/charts/test_kerberos.py
index ebccfa1000f52..3299805f2af0c 100644
--- a/tests/charts/test_kerberos.py
+++ b/tests/charts/test_kerberos.py
@@ -97,6 +97,26 @@ def test_keberos_sidecar_resources_are_not_added_by_default(self):
         )
         assert jmespath.search("spec.template.spec.containers[0].resources", docs[0]) == {}
 
+    def test_kerberos_keytab_exists_in_worker_when_enable(self):  
+        docs = render_chart(
+            values={
+                "executor": "CeleryExecutor",
+                "kerberos": {
+                    "enabled": True,
+                    "keytabBase64Content": "dGVzdGtleXRhYg==",
+                    "configPath": "/etc/krb5.conf",
+                    "ccacheMountPath": "/var/kerberos-ccache",
+                    "ccacheFileName": "ccache",
+                },
+            },
+            show_only=["templates/workers/worker-deployment.yaml"],
+        )
+
+        assert {'name': 'kerberos-keytab', 
+                'subPath': 'kerberos.keytab', 
+                'mountPath': '/etc/airflow.keytab', 
+                'readOnly': True} in jmespath.search("spec.template.spec.containers[0].volumeMounts", docs[0]) 
+
     def test_kerberos_keytab_secret_available(self):
         docs = render_chart(
             values={

From 8a328c9a3922b743ad49b37027eaf788b9b542e2 Mon Sep 17 00:00:00 2001
From: Nguyen Phuong <phuongnguyen.ng3010@gmail.com>
Date: Mon, 27 Feb 2023 15:53:09 +0700
Subject: [PATCH 6/7] double quotes

---
 tests/charts/test_kerberos.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/charts/test_kerberos.py b/tests/charts/test_kerberos.py
index 3299805f2af0c..d01206c726642 100644
--- a/tests/charts/test_kerberos.py
+++ b/tests/charts/test_kerberos.py
@@ -112,10 +112,10 @@ def test_kerberos_keytab_exists_in_worker_when_enable(self):
             show_only=["templates/workers/worker-deployment.yaml"],
         )
 
-        assert {'name': 'kerberos-keytab', 
-                'subPath': 'kerberos.keytab', 
-                'mountPath': '/etc/airflow.keytab', 
-                'readOnly': True} in jmespath.search("spec.template.spec.containers[0].volumeMounts", docs[0]) 
+        assert {"name": "kerberos-keytab",
+                "subPath": "kerberos.keytab",
+                "mountPath": "/etc/airflow.keytab",
+                "readOnly": True} in jmespath.search("spec.template.spec.containers[0].volumeMounts", docs[0])
 
     def test_kerberos_keytab_secret_available(self):
         docs = render_chart(

From 2fde78c9b8f0ae631aab57ba2a92b9735717fd04 Mon Sep 17 00:00:00 2001
From: Nguyen Phuong <phuongnguyen.ng3010@gmail.com>
Date: Sun, 5 Mar 2023 01:02:27 +0700
Subject: [PATCH 7/7] fix static check

---
 tests/charts/test_kerberos.py | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/tests/charts/test_kerberos.py b/tests/charts/test_kerberos.py
index d01206c726642..27b9d02a883f0 100644
--- a/tests/charts/test_kerberos.py
+++ b/tests/charts/test_kerberos.py
@@ -97,7 +97,7 @@ def test_keberos_sidecar_resources_are_not_added_by_default(self):
         )
         assert jmespath.search("spec.template.spec.containers[0].resources", docs[0]) == {}
 
-    def test_kerberos_keytab_exists_in_worker_when_enable(self):  
+    def test_kerberos_keytab_exists_in_worker_when_enable(self):
         docs = render_chart(
             values={
                 "executor": "CeleryExecutor",
@@ -112,10 +112,12 @@ def test_kerberos_keytab_exists_in_worker_when_enable(self):
             show_only=["templates/workers/worker-deployment.yaml"],
         )
 
-        assert {"name": "kerberos-keytab",
-                "subPath": "kerberos.keytab",
-                "mountPath": "/etc/airflow.keytab",
-                "readOnly": True} in jmespath.search("spec.template.spec.containers[0].volumeMounts", docs[0])
+        assert {
+            "name": "kerberos-keytab",
+            "subPath": "kerberos.keytab",
+            "mountPath": "/etc/airflow.keytab",
+            "readOnly": True,
+        } in jmespath.search("spec.template.spec.containers[0].volumeMounts", docs[0])
 
     def test_kerberos_keytab_secret_available(self):
         docs = render_chart(
