def create_configmap(
        name,
        namespace,
        data,
        source=None,
        template=None,
        saltenv='base',
        **kwargs):
    '''
    Creates the kubernetes configmap as defined by the user.

    CLI Examples::

        salt 'minion1' kubernetes.create_configmap \
            settings default '{"example.conf": "# example file"}'

        salt 'minion2' kubernetes.create_configmap \
            name=settings namespace=default data='{"example.conf": "# example file"}'
    '''
    if source:
        data = __read_and_render_yaml_file(source, template, saltenv)
    elif data is None:
        data = {}

    data = __enforce_only_strings_dict(data)

    body = kubernetes.client.V1ConfigMap(
        metadata=__dict_to_object_meta(name, namespace, {}),
        data=data)

    cfg = _setup_conn(**kwargs)

    try:
        api_instance = kubernetes.client.CoreV1Api()
        api_response = api_instance.create_namespaced_config_map(
            namespace, body)

        return api_response.to_dict()
    except (ApiException, HTTPError) as exc:
        if isinstance(exc, ApiException) and exc.status == 404:
            return None
        else:
            log.exception(
                'Exception when calling '
                'CoreV1Api->create_namespaced_config_map'
            )
            raise CommandExecutionError(exc)
    finally:
        _cleanup(**cfg)
def create_configmap ( name , namespace , data , source = None , template = None , saltenv = 'base' , ** kwargs ) : if source : data = __read_and_render_yaml_file ( source , template , saltenv ) elif data is None : data = { } data = __enforce_only_strings_dict ( data ) body = kubernetes . client . V1ConfigMap ( metadata = __dict_to_object_meta ( name , namespace , { } ) , data = data ) cfg = _setup_conn ( ** kwargs ) try : api_instance = kubernetes . client . CoreV1Api ( ) api_response = api_instance . create_namespaced_config_map ( namespace , body ) return api_response . to_dict ( ) except ( ApiException , HTTPError ) as exc : if isinstance ( exc , ApiException ) and exc . status == 404 : return None else : log . exception ( 'Exception when calling ' 'CoreV1Api->create_namespaced_config_map' ) raise CommandExecutionError ( exc ) finally : _cleanup ( ** cfg )
Creates the kubernetes configmap as defined by the user.

    CLI Examples::

        salt 'minion1' kubernetes.create_configmap \
            settings default '{"example.conf": "# example file"}'

        salt 'minion2' kubernetes.create_configmap \
            name=settings namespace=default data='{"example.conf": "# example file"}'