mirror of
https://github.com/ansible-collections/kubernetes.core.git
synced 2026-05-06 04:52:37 +00:00
helm: add pass-credentials key (#282)
helm: add pass-credentials key SUMMARY In helm version v3.6.1 when downloading charts from password protected repositories that served from a different domain than the repository, need to use --pass-credentials key. Add possibility to use the pass-credentials key in helm_repository.py ISSUE TYPE Feature Pull Request COMPONENT NAME helm_repository Reviewed-by: None <None> Reviewed-by: Abhijeet Kasurde <None> Reviewed-by: Mike Graves <mgraves@redhat.com> Reviewed-by: None <None>
This commit is contained in:
committed by
GitHub
parent
39b6c43ab7
commit
ba5cb30305
@@ -0,0 +1,2 @@
|
||||
minor_changes:
|
||||
- helm_repository - add support for pass-credentials cli parameter (https://github.com/ansible-collections/kubernetes.core/pull/282).
|
||||
@@ -65,6 +65,13 @@ options:
|
||||
default: present
|
||||
aliases: [ state ]
|
||||
type: str
|
||||
pass_credentials:
|
||||
description:
|
||||
- Pass credentials to all domains.
|
||||
required: false
|
||||
default: false
|
||||
type: bool
|
||||
version_added: 2.3.0
|
||||
"""
|
||||
|
||||
EXAMPLES = r"""
|
||||
@@ -157,7 +164,12 @@ def get_repository_status(module, command, repository_name):
|
||||
|
||||
# Install repository
|
||||
def install_repository(
|
||||
command, repository_name, repository_url, repository_username, repository_password
|
||||
command,
|
||||
repository_name,
|
||||
repository_url,
|
||||
repository_username,
|
||||
repository_password,
|
||||
pass_credentials,
|
||||
):
|
||||
install_command = command + " repo add " + repository_name + " " + repository_url
|
||||
|
||||
@@ -165,6 +177,9 @@ def install_repository(
|
||||
install_command += " --username=" + repository_username
|
||||
install_command += " --password=" + repository_password
|
||||
|
||||
if pass_credentials:
|
||||
install_command += " --pass-credentials"
|
||||
|
||||
return install_command
|
||||
|
||||
|
||||
@@ -188,6 +203,7 @@ def main():
|
||||
repo_state=dict(
|
||||
default="present", choices=["present", "absent"], aliases=["state"]
|
||||
),
|
||||
pass_credentials=dict(type="bool", default=False),
|
||||
),
|
||||
required_together=[["repo_username", "repo_password"]],
|
||||
required_if=[("repo_state", "present", ["repo_url"])],
|
||||
@@ -205,6 +221,7 @@ def main():
|
||||
repo_username = module.params.get("repo_username")
|
||||
repo_password = module.params.get("repo_password")
|
||||
repo_state = module.params.get("repo_state")
|
||||
pass_credentials = module.params.get("pass_credentials")
|
||||
|
||||
if bin_path is not None:
|
||||
helm_cmd = bin_path
|
||||
@@ -219,7 +236,12 @@ def main():
|
||||
elif repo_state == "present":
|
||||
if repository_status is None:
|
||||
helm_cmd = install_repository(
|
||||
helm_cmd, repo_name, repo_url, repo_username, repo_password
|
||||
helm_cmd,
|
||||
repo_name,
|
||||
repo_url,
|
||||
repo_username,
|
||||
repo_password,
|
||||
pass_credentials,
|
||||
)
|
||||
changed = True
|
||||
elif repository_status["url"] != repo_url:
|
||||
|
||||
Reference in New Issue
Block a user