ceph: disable admission controller for k8s older than v1.16.0

v1 version of admission controller require minimum v1.16.0
of k8s. So, this commits disable admission controller when
k8s version older than v1.16.0.

Signed-off-by: subhamkrai <srai@redhat.com>
This commit is contained in:
subhamkrai committed 2021-01-22 14:21:03 +05:30
1 parent f167dbbb7b
commit f7d7c2979a
2 files changed
+11 -3

No files matched your search

@@ -4,6 +4,14 @@ BASE_DIR=$(cd "$(dirname "$0")"/../../../..; pwd)
echo "$BASE_DIR"
SERVER_VERSION=$(kubectl version --short | awk -F "." '/Server Version/ {print $2}')
MINIMUM_VERSION=16
if [ ${SERVER_VERSION} -le ${MINIMUM_VERSION} ]; then
echo "required minimum kubernetes version 1.$MINIMUM_VERSION.0"
exit 1
fi
if [ -f "$BASE_DIR"/tests/scripts/deploy_admission_controller.sh ];then
bash "$BASE_DIR"/tests/scripts/deploy_admission_controller.sh
else
+3 -3
View File
@@ -126,7 +126,7 @@ func (h *CephInstaller) CreateCephOperator(namespace string) (err error) {
// disable admission controller for upgrade test as api version v1 require minimum v0.7 controller runtime and upgrade test still using
// older version of controller runtime.
if !utils.IsPlatformOpenShift() && namespace != "upgrade-ns-system" {
if !utils.IsPlatformOpenShift() && h.k8shelper.VersionAtLeast("v1.16.0") && namespace != "upgrade-ns-system" {
err = h.startAdmissionController(namespace)
if err != nil {
return fmt.Errorf("Failed to start admission controllers: %v", err)
@@ -518,7 +518,7 @@ func (h *CephInstaller) InstallRook(namespace, storeType string, usePVC bool, st
}
logger.Infof("installed rook operator and cluster : %s on k8s %s", namespace, h.k8sVersion)
if !utils.IsPlatformOpenShift() && h.k8shelper.VersionAtLeast("v1.15.0") && namespace != "upgrade-ns" {
if !utils.IsPlatformOpenShift() && h.k8shelper.VersionAtLeast("v1.16.0") && namespace != "upgrade-ns" {
if !h.k8shelper.IsPodInExpectedState("rook-ceph-admission-controller", onamespace, "Running") {
assert.Fail(h.T(), "admission controller is not running")
}
@@ -635,7 +635,7 @@ func (h *CephInstaller) UninstallRookFromMultipleNS(systemNamespace string, name
checkError(h.T(), err, "cannot uninstall rook-operator")
}
err = h.k8shelper.Clientset.AdmissionregistrationV1beta1().ValidatingWebhookConfigurations().Delete(ctx, "rook-ceph-webhook", metav1.DeleteOptions{})
err = h.k8shelper.Clientset.AdmissionregistrationV1().ValidatingWebhookConfigurations().Delete(ctx, "rook-ceph-webhook", metav1.DeleteOptions{})
checkError(h.T(), err, "failed to delete webhook configuration")
err = h.k8shelper.Clientset.RbacV1().RoleBindings(systemNamespace).Delete(ctx, "rook-ceph-system", metav1.DeleteOptions{})
checkError(h.T(), err, "failed to delete role binding")