def delete(self): config.load_kube_config(config_file=self.kubeconfig) if ob.check_scaleoperatorobject_is_deployed(): ob.delete_custom_object() ob.check_scaleoperatorobject_is_deleted() if ob.check_secret_exists(self.secret_name): ob.delete_secret(self.secret_name) ob.check_secret_is_deleted(self.secret_name) for remote_secret_name in self.temp["remote_secret_names"]: if ob.check_secret_exists(remote_secret_name): ob.delete_secret(remote_secret_name) ob.check_secret_is_deleted(remote_secret_name) if check_key(self.temp, "local_cacert_name"): if ob.check_configmap_exists(self.temp["local_cacert_name"]): ob.delete_configmap(self.temp["local_cacert_name"]) ob.check_configmap_is_deleted(self.temp["local_cacert_name"]) for remote_cacert_name in self.temp["remote_cacert_names"]: if ob.check_configmap_exists(remote_cacert_name): ob.delete_configmap(remote_cacert_name) ob.check_configmap_is_deleted(remote_cacert_name)
def delete(self, kubeconfig): config.load_kube_config(config_file=kubeconfig) if ob.check_scaleoperatorobject_is_deployed(): ob.delete_custom_object() ob.check_scaleoperatorobject_is_deleted() if ob.check_secret_exists(self.secret_name): ob.delete_secret(self.secret_name) ob.check_secret_is_deleted(self.secret_name) if check_key(self.temp, "remote"): if ob.check_secret_exists(self.remote_secret_name): ob.delete_secret(self.remote_secret_name) ob.check_secret_is_deleted(self.remote_secret_name) if check_key(self.temp, "cacert_name"): if ob.check_configmap_exists(self.cacert_name): ob.delete_configmap(self.cacert_name) ob.check_configmap_is_deleted(self.cacert_name) if check_key(self.temp, "remote_cacert_name"): if ob.check_configmap_exists(self.remote_cacert_name): ob.delete_configmap(self.remote_cacert_name) ob.check_configmap_is_deleted(self.remote_cacert_name)
def create(self): config.load_kube_config(config_file=self.kubeconfig) LOGGER.info(str(self.temp["custom_object_body"]["spec"])) if not(ob.check_secret_exists(self.secret_name)): ob.create_secret(self.secret_data, self.secret_name) else: ob.delete_secret(self.secret_name) ob.check_secret_is_deleted(self.secret_name) ob.create_secret(self.secret_data, self.secret_name) for remote_secret_name in self.temp["remote_secret_names"]: remote_secret_data = {"username": self.temp["remote_username"][remote_secret_name], "password": self.temp["remote_password"][remote_secret_name]} if not(ob.check_secret_exists(remote_secret_name)): ob.create_secret(remote_secret_data, remote_secret_name) else: ob.delete_secret(remote_secret_name) ob.check_secret_is_deleted(remote_secret_name) ob.create_secret(remote_secret_data, remote_secret_name) if check_key(self.temp, "local_cacert_name"): cacert_name = self.temp["local_cacert_name"] if not(check_key(self.temp, "make_cacert_wrong")): self.temp["make_cacert_wrong"] = False if not(ob.check_configmap_exists(cacert_name)): ob.create_configmap( self.temp["cacert_path"], self.temp["make_cacert_wrong"], cacert_name) else: ob.delete_configmap(cacert_name) ob.check_configmap_is_deleted(cacert_name) ob.create_configmap( self.temp["cacert_path"], self.temp["make_cacert_wrong"], cacert_name) for remote_cacert_name in self.temp["remote_cacert_names"]: if not(check_key(self.temp, "make_remote_cacert_wrong")): self.temp["make_remote_cacert_wrong"] = False if not(ob.check_configmap_exists(remote_cacert_name)): ob.create_configmap( self.temp["remote_cacert_path"][remote_cacert_name], self.temp["make_remote_cacert_wrong"], remote_cacert_name) else: ob.delete_configmap(remote_cacert_name) ob.check_configmap_is_deleted(remote_cacert_name) ob.create_configmap( self.temp["remote_cacert_path"][remote_cacert_name], self.temp["make_remote_cacert_wrong"], remote_cacert_name) if not(ob.check_scaleoperatorobject_is_deployed()): ob.create_custom_object(self.temp["custom_object_body"], self.stateful_set_not_created) else: ob.delete_custom_object() ob.check_scaleoperatorobject_is_deleted() ob.create_custom_object(self.temp["custom_object_body"], self.stateful_set_not_created)
def create(self, kubeconfig): config.load_kube_config(config_file=kubeconfig) LOGGER.info(str(self.custom_object_spec)) if not (ob.check_secret_exists(self.secret_name)): ob.create_secret(self.secret_data, self.secret_name) else: ob.delete_secret(self.secret_name) ob.check_secret_is_deleted(self.secret_name) ob.create_secret(self.secret_data, self.secret_name) if check_key(self.temp, "remote"): if not (ob.check_secret_exists(self.remote_secret_name)): ob.create_secret(self.remote_secret_data, self.remote_secret_name) else: ob.delete_secret(self.remote_secret_name) ob.check_secret_is_deleted(self.remote_secret_name) ob.create_secret(self.remote_secret_data, self.remote_secret_name) if check_key(self.temp, "cacert_name"): if not (check_key(self.temp, "make_cacert_wrong")): self.temp["make_cacert_wrong"] = False if not (ob.check_configmap_exists(self.cacert_name)): ob.create_configmap(self.temp["cacert_path"], self.temp["make_cacert_wrong"], self.cacert_name) else: ob.delete_configmap(self.cacert_name) ob.check_configmap_is_deleted(self.cacert_name) ob.create_configmap(self.temp["cacert_path"], self.temp["make_cacert_wrong"], self.cacert_name) if check_key(self.temp, "remote_cacert_name"): if not (check_key(self.temp, "make_remote_cacert_wrong")): self.temp["make_remote_cacert_wrong"] = False if not (ob.check_configmap_exists(self.remote_cacert_name)): ob.create_configmap(self.temp["remote_cacert_path"], self.temp["make_remote_cacert_wrong"], self.remote_cacert_name) else: ob.delete_configmap(self.remote_cacert_name) ob.check_configmap_is_deleted(self.remote_cacert_name) ob.create_configmap(self.temp["remote_cacert_path"], self.temp["make_remote_cacert_wrong"], self.remote_cacert_name) if not (ob.check_scaleoperatorobject_is_deployed()): ob.create_custom_object(self.custom_object_spec, self.stateful_set_not_created) else: ob.delete_custom_object() ob.check_scaleoperatorobject_is_deleted() ob.create_custom_object(self.custom_object_spec, self.stateful_set_not_created)