Exemplo n.º 1
0
    def delete(self, condition=False):

        config.load_kube_config(config_file=self.kubeconfig)
        if ob.check_scaleoperatorobject_is_deployed():   # for edge cases if custom object is not deleted
            ob.delete_custom_object()
            ob.check_scaleoperatorobject_is_deleted()

        if scale_function.check_crd_exists(self.crd_version):
            scale_function.delete_crd(self.crd_version)
        scale_function.check_crd_deleted(self.crd_version)

        if scale_function.check_service_account_exists("ibm-spectrum-scale-csi-operator"):
            scale_function.delete_service_account("ibm-spectrum-scale-csi-operator")
        scale_function.check_service_account_deleted("ibm-spectrum-scale-csi-operator")

        if scale_function.check_cluster_role_binding_exists("ibm-spectrum-scale-csi-operator"):
            scale_function.delete_cluster_role_binding("ibm-spectrum-scale-csi-operator")
        scale_function.check_cluster_role_binding_deleted("ibm-spectrum-scale-csi-operator")

        if scale_function.check_cluster_role_exists("ibm-spectrum-scale-csi-operator"):
            scale_function.delete_cluster_role("ibm-spectrum-scale-csi-operator")
        scale_function.check_cluster_role_deleted("ibm-spectrum-scale-csi-operator")

        if scale_function.check_deployment_exists():
            scale_function.delete_deployment()
        scale_function.check_deployment_deleted()

        if scale_function.check_namespace_exists() and (condition is False):
            scale_function.delete_namespace()
            scale_function.check_namespace_deleted()
Exemplo n.º 2
0
 def delete_test_ns(self, kubeconfig):
     config.load_kube_config(config_file=kubeconfig)
     scale_function.set_global_namespace_value(self.test_ns)
     if scale_function.check_namespace_exists():
         scale_function.delete_namespace()
     scale_function.check_namespace_deleted()