def secret_present(
        name,
        namespace='default',
        data=None,
        source=None,
        template=None,
        **kwargs):
    '''
    Ensures that the named secret is present inside of the specified namespace
    with the given data.
    If the secret exists it will be replaced.

    name
        The name of the secret.

    namespace
        The namespace holding the secret. The 'default' one is going to be
        used unless a different one is specified.

    data
        The dictionary holding the secrets.

    source
        A file containing the data of the secret in plain format.

    template
        Template engine to be used to render the source file.
    '''
    ret = {'name': name,
           'changes': {},
           'result': False,
           'comment': ''}

    if data and source:
        return _error(
            ret,
            '\'source\' cannot be used in combination with \'data\''
        )

    secret = __salt__['kubernetes.show_secret'](name, namespace, **kwargs)

    if secret is None:
        if data is None:
            data = {}

        if __opts__['test']:
            ret['result'] = None
            ret['comment'] = 'The secret is going to be created'
            return ret
        res = __salt__['kubernetes.create_secret'](name=name,
                                                   namespace=namespace,
                                                   data=data,
                                                   source=source,
                                                   template=template,
                                                   saltenv=__env__,
                                                   **kwargs)
        ret['changes']['{0}.{1}'.format(namespace, name)] = {
            'old': {},
            'new': res}
    else:
        if __opts__['test']:
            ret['result'] = None
            ret['comment'] = 'The secret is going to be replaced'
            return ret

        # TODO: improve checks  # pylint: disable=fixme
        log.info('Forcing the recreation of the service')
        ret['comment'] = 'The secret is already present. Forcing recreation'
        res = __salt__['kubernetes.replace_secret'](
            name=name,
            namespace=namespace,
            data=data,
            source=source,
            template=template,
            saltenv=__env__,
            **kwargs)

    ret['changes'] = {
        # Omit values from the return. They are unencrypted
        # and can contain sensitive data.
        'data': list(res['data'])
    }
    ret['result'] = True

    return ret
Ensures that the named secret is present inside of the specified namespace
    with the given data.
    If the secret exists it will be replaced.

    name
        The name of the secret.

    namespace
        The namespace holding the secret. The 'default' one is going to be
        used unless a different one is specified.

    data
        The dictionary holding the secrets.

    source
        A file containing the data of the secret in plain format.

    template
        Template engine to be used to render the source file.