mirror of
https://github.com/ansible-collections/kubernetes.core.git
synced 2026-05-08 05:52:37 +00:00
helm: Add support for K8S_AUTH_CONTEXT, K8S_AUTH_KUBECONFIG env (#141)
Added support for K8S_AUTH_CONTEXT, K8S_AUTH_KUBECONFIG env
This commit is contained in:
3
changelogs/fragments/140_kubeconfig_env.yaml
Normal file
3
changelogs/fragments/140_kubeconfig_env.yaml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
minor_changes:
|
||||||
|
- helm - add support for K8S_AUTH_KUBECONFIG and K8S_AUTH_CONTEXT environment variable (https://github.com/ansible-collections/community.kubernetes/issues/140).
|
||||||
|
- helm_info - add support for K8S_AUTH_KUBECONFIG and K8S_AUTH_CONTEXT environment variable (https://github.com/ansible-collections/community.kubernetes/issues/140).
|
||||||
@@ -98,10 +98,12 @@ options:
|
|||||||
kube_context:
|
kube_context:
|
||||||
description:
|
description:
|
||||||
- Helm option to specify which kubeconfig context to use.
|
- Helm option to specify which kubeconfig context to use.
|
||||||
|
- If the value is not specified in the task, the value of environment variable C(K8S_AUTH_CONTEXT) will be used instead.
|
||||||
type: str
|
type: str
|
||||||
kubeconfig_path:
|
kubeconfig_path:
|
||||||
description:
|
description:
|
||||||
- Helm option to specify kubeconfig path to use.
|
- Helm option to specify kubeconfig path to use.
|
||||||
|
- If the value is not specified in the task, the value of environment variable C(K8S_AUTH_KUBECONFIG) will be used instead.
|
||||||
type: path
|
type: path
|
||||||
aliases: [ kubeconfig ]
|
aliases: [ kubeconfig ]
|
||||||
purge:
|
purge:
|
||||||
@@ -245,7 +247,7 @@ except ImportError:
|
|||||||
IMP_YAML_ERR = traceback.format_exc()
|
IMP_YAML_ERR = traceback.format_exc()
|
||||||
IMP_YAML = False
|
IMP_YAML = False
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
from ansible.module_utils.basic import AnsibleModule, missing_required_lib, env_fallback
|
||||||
|
|
||||||
module = None
|
module = None
|
||||||
|
|
||||||
@@ -395,8 +397,8 @@ def main():
|
|||||||
# Helm options
|
# Helm options
|
||||||
disable_hook=dict(type='bool', default=False),
|
disable_hook=dict(type='bool', default=False),
|
||||||
force=dict(type='bool', default=False),
|
force=dict(type='bool', default=False),
|
||||||
kube_context=dict(type='str'),
|
kube_context=dict(type='str', fallback=(env_fallback, ['K8S_AUTH_CONTEXT'])),
|
||||||
kubeconfig_path=dict(type='path', aliases=['kubeconfig']),
|
kubeconfig_path=dict(type='path', aliases=['kubeconfig'], fallback=(env_fallback, ['K8S_AUTH_KUBECONFIG'])),
|
||||||
purge=dict(type='bool', default=True),
|
purge=dict(type='bool', default=True),
|
||||||
wait=dict(type='bool', default=False),
|
wait=dict(type='bool', default=False),
|
||||||
wait_timeout=dict(type='str'),
|
wait_timeout=dict(type='str'),
|
||||||
|
|||||||
@@ -48,10 +48,12 @@ options:
|
|||||||
kube_context:
|
kube_context:
|
||||||
description:
|
description:
|
||||||
- Helm option to specify which kubeconfig context to use.
|
- Helm option to specify which kubeconfig context to use.
|
||||||
|
- If the value is not specified in the task, the value of environment variable C(K8S_AUTH_CONTEXT) will be used instead.
|
||||||
type: str
|
type: str
|
||||||
kubeconfig_path:
|
kubeconfig_path:
|
||||||
description:
|
description:
|
||||||
- Helm option to specify kubeconfig path to use.
|
- Helm option to specify kubeconfig path to use.
|
||||||
|
- If the value is not specified in the task, the value of environment variable C(K8S_AUTH_KUBECONFIG) will be used instead.
|
||||||
type: path
|
type: path
|
||||||
aliases: [ kubeconfig ]
|
aliases: [ kubeconfig ]
|
||||||
'''
|
'''
|
||||||
@@ -112,7 +114,7 @@ except ImportError:
|
|||||||
IMP_YAML_ERR = traceback.format_exc()
|
IMP_YAML_ERR = traceback.format_exc()
|
||||||
IMP_YAML = False
|
IMP_YAML = False
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
from ansible.module_utils.basic import AnsibleModule, missing_required_lib, env_fallback
|
||||||
|
|
||||||
module = None
|
module = None
|
||||||
|
|
||||||
@@ -177,8 +179,8 @@ def main():
|
|||||||
release_namespace=dict(type='str', required=True, aliases=['namespace']),
|
release_namespace=dict(type='str', required=True, aliases=['namespace']),
|
||||||
|
|
||||||
# Helm options
|
# Helm options
|
||||||
kube_context=dict(type='str'),
|
kube_context=dict(type='str', fallback=(env_fallback, ['K8S_AUTH_CONTEXT'])),
|
||||||
kubeconfig_path=dict(type='path', aliases=['kubeconfig']),
|
kubeconfig_path=dict(type='path', aliases=['kubeconfig'], fallback=(env_fallback, ['K8S_AUTH_KUBECONFIG'])),
|
||||||
),
|
),
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user