Beispiel #1
0
def k8s_copy_config(context, destination_namespace, name=None):
    source_configmap = ConfigMap(context, name=name)
    destination_configmap = ConfigMap(context,
                                      name=name,
                                      namespace=destination_namespace)
    source_configmap.load()
    destination_configmap.struct['data'] = source_configmap.struct['data']
    destination_configmap.save()
Beispiel #2
0
def set_env(context, environment, namespace=None):
  configmap = ConfigMap(context, namespace=namespace)
  configmap.load()
  for s in environment:
    if '=' not in s:
      raise HokusaiError("Error: environment variables must be of the form 'KEY=VALUE'")
    split = s.split('=', 1)
    configmap.update(split[0], split[1])
  configmap.save()
Beispiel #3
0
def get_env(context, environment, namespace=None):
  configmap = ConfigMap(context, namespace=namespace)
  configmap.load()
  if environment:
    for k, v in configmap.all():
      if k in environment:
        print("%s=%s" % (k, v))
  else:
    for k, v in configmap.all():
      print("%s=%s" % (k, v))
Beispiel #4
0
def unset_env(context, environment, namespace=None):
  configmap = ConfigMap(context, namespace=namespace)
  configmap.load()
  for s in environment:
    configmap.delete(s)
  configmap.save()
Beispiel #5
0
def unset_env(context, environment):
  configmap = ConfigMap(context)
  configmap.load()
  for s in environment:
    configmap.delete(s)
  configmap.save()
Beispiel #6
0
def get_env(context, environment, namespace=None):
    configmap = ConfigMap(context, namespace=namespace)
    configmap.load()
    for k, v in sorted(configmap.all().items()):
        if not environment or (environment and k in environment):
            print_smart("%s=%s" % (k, v))