Beispiel #1
0
def k8s_delete(context, namespace=None, filename=None):
  if filename is None:
    yaml_template = TemplateSelector().get(os.path.join(CWD, HOKUSAI_CONFIG_DIR, context))
  else:
    yaml_template = TemplateSelector().get(filename)

  if filename is None:
    configmap = ConfigMap(context, namespace=namespace)
    configmap.destroy()
    print_green("Deleted configmap %s-environment" % config.project_name)

  kctl = Kubectl(context, namespace=namespace)
  yaml_spec = YamlSpec(yaml_template).to_file()

  shout(kctl.command("delete -f %s" % yaml_spec), print_output=True)
  print_green("Deleted Kubernetes environment %s" % yaml_template)
Beispiel #2
0
def k8s_delete(context, namespace=None, filename=None):
    if filename is None:
        kubernetes_yml = os.path.join(CWD, HOKUSAI_CONFIG_DIR,
                                      "%s.yml" % context)
    else:
        kubernetes_yml = filename

    if not os.path.isfile(kubernetes_yml):
        raise HokusaiError("Yaml file %s does not exist." % kubernetes_yml)

    if filename is None:
        configmap = ConfigMap(context, namespace=namespace)
        configmap.destroy()
        print_green("Deleted configmap %s-environment" % config.project_name)

    kctl = Kubectl(context, namespace=namespace)
    shout(kctl.command("delete -f %s" % kubernetes_yml), print_output=True)
    print_green("Deleted Kubernetes environment %s" % kubernetes_yml)
Beispiel #3
0
def delete_env(context, namespace=None):
  configmap = ConfigMap(context, namespace=namespace)
  configmap.destroy()
  print_green("Deleted configmap %s-environment" % config.project_name)
Beispiel #4
0
 def test_06_k8s_env_destroy(self, mocked_sys_exit):
     configmap = ConfigMap(TEST_KUBE_CONTEXT)
     configmap.destroy()