Kubernetes version check added to have a minimum of 1.21
Strimzi kafka operator version set to 0.39.0 (It supports Kafka 3.5.0)
Issue-ID: NONRTRIC-993
Change-Id: I5de39606de7fb3f643cf44105f871262e973ff45
Signed-off-by: aravind.est <aravindhan.a@est.tech>
# ============LICENSE_START===============================================
# Copyright (C) 2023 Nordix Foundation. All rights reserved.
# ============LICENSE_START===============================================
# Copyright (C) 2023 Nordix Foundation. All rights reserved.
+# Copyright (C) 2024 OpenInfra Foundation Europe. All rights reserved.
# ========================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# ========================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# Constants
SAMELINE="\033[0K\r"
# Constants
SAMELINE="\033[0K\r"
+EXPECTEDMAJORKUBERNETESVERSION="1"
+EXPECTEDMINORKUBERNETESVERSION="21"
+STRIMZIKAFKAOPERATORVERSION="0.39.0"
# Variables
export KUBERNETESHOST=$(kube_get_controlplane_host)
# Variables
export KUBERNETESHOST=$(kube_get_controlplane_host)
+KUBERNETESVERSIONINFO=$(kubectl version --short 2>/dev/null || kubectl version 2>/dev/null)
+export KUBERNETESVERSION=$(echo $KUBERNETESVERSIONINFO | grep 'Server Version' | awk '{print $3}')
+if [ $? -ne 0 ]; then
+ echo $KUBERNETESVERSION
+ echo "Exiting"
+ exit 1
+fi
+
+KUBERNETESMAJORVERSION=$(echo ${KUBERNETESVERSION#v} | cut -d. -f1)
+KUBERNETESMINORVERSION=$(echo $KUBERNETESVERSION | cut -d. -f2)
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo "Kubernetes control plane host: $KUBERNETESHOST"
echo "Host obtained from current kubectl context"
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo "Kubernetes control plane host: $KUBERNETESHOST"
echo "Host obtained from current kubectl context"
+echo "Kubernetes version : $KUBERNETESVERSION"
+if ((KUBERNETESMAJORVERSION < EXPECTEDMAJORKUBERNETESVERSION)) || ((KUBERNETESMINORVERSION < EXPECTEDMINORKUBERNETESVERSION)); then
+ echo "Required minimum Kubernetes version : $EXPECTEDMAJORKUBERNETESVERSION.$EXPECTEDMINORKUBERNETESVERSION"
+ echo "Aborting..."
+ exit 1
+fi
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
helm repo add strimzi https://strimzi.io/charts/
helm repo add strimzi https://strimzi.io/charts/
-helm install --wait strimzi-kafka-crds -n nonrtric strimzi/strimzi-kafka-operator
+echo "Installing Strimzi Kafka operator version: $STRIMZIKAFKAOPERATORVERSION"
+helm install --wait strimzi-kafka-crds -n nonrtric strimzi/strimzi-kafka-operator --version $STRIMZIKAFKAOPERATORVERSION
cp opa-rules/bundle.tar.gz helm/nrt-base-1/charts/opa-rule-db/data
cp opa-rules/bundle.tar.gz helm/nrt-base-1/charts/opa-rule-db/data