Skip to content

Commit 65af1ac

Browse files
authored
Handle kube version errors (kadalu#669)
Fixes: kadalu#601, kadalu#617 Credits: Amar Tumballi <[email protected]> Signed-off-by: Shree Vatsa N <[email protected]>
1 parent 90cb946 commit 65af1ac

File tree

4 files changed

+23
-5
lines changed

4 files changed

+23
-5
lines changed

.github/workflows/on-pr-submit.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ jobs:
4848
run: make pylint
4949

5050
run-on-minikube:
51-
name: kube 1.20.0
51+
name: kube 1.22.0
5252
runs-on: ubuntu-latest
5353
needs: get-info
5454
env:
55-
KUBE_VERSION: v1.20.0
55+
KUBE_VERSION: v1.22.0
5656
# Current conditions in minikube.sh which are using commit message:
5757
# [helm skip]: If contained in COMMIT MESSAGE, validating helm is skipped
5858
COMMIT_MSG: ${{needs.get-info.outputs.msg}}

operator/Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ COPY templates/server.yaml.j2 /kadalu/templates/server.yaml.j2
3636
COPY templates/csi.yaml.j2 /kadalu/templates/csi.yaml.j2
3737
COPY templates/csi-driver-crd.yaml.j2 /kadalu/templates/csi-driver-crd.yaml.j2
3838
COPY templates/csi-driver-object.yaml.j2 /kadalu/templates/csi-driver-object.yaml.j2
39-
COPY templates/configmap.yaml.j2 /kadalu/templates/configmap.yaml.j2
39+
COPY templates/csi-driver-object-v1.yaml.j2 /kadalu/templates/csi-driver-object-v1.yaml.j2
40+
COPY templates/configmap.yaml.j2 /kadalu/templates/configmap.yaml.j2
4041
COPY templates/storageclass-kadalu.custom.yaml.j2 /kadalu/templates/storageclass-kadalu.custom.yaml.j2
4142
COPY templates/external-storageclass.yaml.j2 /kadalu/templates/external-storageclass.yaml.j2
4243
COPY lib/kadalulib.py /kadalu/kadalulib.py

operator/main.py

+12-2
Original file line numberDiff line numberDiff line change
@@ -894,11 +894,21 @@ def deploy_csi_pods(core_v1_client):
894894

895895
# Deploy CSI Pods
896896
api_instance = client.VersionApi().get_code()
897-
if api_instance.major > "1" or api_instance.major == "1" and \
898-
api_instance.minor >= "14":
897+
int_api_instance_major = int(api_instance.major)
898+
int_api_instance_minor = int(api_instance.minor)
899+
900+
if int_api_instance_major > 1 or int_api_instance_major == 1 and \
901+
int_api_instance_minor >= 22:
902+
filename = os.path.join(MANIFESTS_DIR, "csi-driver-object-v1.yaml")
903+
template(filename, namespace=NAMESPACE, kadalu_version=VERSION)
904+
lib_execute(KUBECTL_CMD, APPLY_CMD, "-f", filename)
905+
906+
elif int_api_instance_major > 1 or int_api_instance_major == 1 and \
907+
int_api_instance_minor >= 14:
899908
filename = os.path.join(MANIFESTS_DIR, "csi-driver-object.yaml")
900909
template(filename, namespace=NAMESPACE, kadalu_version=VERSION)
901910
lib_execute(KUBECTL_CMD, APPLY_CMD, "-f", filename)
911+
902912
else:
903913
filename = os.path.join(MANIFESTS_DIR, "csi-driver-crd.yaml")
904914
template(filename, namespace=NAMESPACE, kadalu_version=VERSION)
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: storage.k8s.io/v1
2+
kind: CSIDriver
3+
metadata:
4+
name: kadalu
5+
spec:
6+
attachRequired: true
7+
podInfoOnMount: true

0 commit comments

Comments
 (0)