def check(self): config.load_kube_config(config_file=self.kubeconfig) scale_function.check_namespace_exists() scale_function.check_deployment_exists() scale_function.check_cluster_role_exists("ibm-spectrum-scale-csi-operator") scale_function.check_service_account_exists("ibm-spectrum-scale-csi-operator") scale_function.check_cluster_role_binding_exists("ibm-spectrum-scale-csi-operator") scale_function.check_crd_exists(self.crd_version)
def create(self, namespace_value, conf): config.load_kube_config(config_file=self.kubeconfig) scale_function.set_global_namespace_value(namespace_value) if not (scale_function.check_namespace_exists()): scale_function.create_namespace() if not (scale_function.check_deployment_exists()): scale_function.create_deployment() if not (scale_function.check_cluster_role_exists( "ibm-spectrum-scale-csi-operator")): scale_function.create_cluster_role() if not (scale_function.check_service_account_exists( "ibm-spectrum-scale-csi-operator")): scale_function.create_service_account() if not (scale_function.check_cluster_role_binding_exists( "ibm-spectrum-scale-csi-operator")): scale_function.create_cluster_role_binding() if not (scale_function.check_crd_exists()): scale_function.create_crd()
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()
def create(self): config.load_kube_config(config_file=self.kubeconfig) body = self.get_operator_body() if not (scale_function.check_namespace_exists()): scale_function.create_namespace() if not (scale_function.check_deployment_exists()): scale_function.create_deployment(body['Deployment']) if not (scale_function.check_cluster_role_exists( "ibm-spectrum-scale-csi-operator")): scale_function.create_cluster_role(body['ClusterRole']) if not (scale_function.check_service_account_exists( "ibm-spectrum-scale-csi-operator")): scale_function.create_service_account(body['ServiceAccount']) if not (scale_function.check_cluster_role_binding_exists( "ibm-spectrum-scale-csi-operator")): scale_function.create_cluster_role_binding( body['ClusterRoleBinding']) if not (scale_function.check_crd_exists()): scale_function.create_crd(body['CustomResourceDefinition'])