From 86c5c446ddc634021ae3568a89b9f5230ea60c66 Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Wed, 3 Feb 2021 13:45:25 +0530 Subject: [PATCH] Make unused release_namespace parameter as optional (#358) --- changelogs/fragments/357_helm_plugin.yml | 3 +++ molecule/default/roles/helm/tasks/tests_helm_plugin.yml | 7 ------- plugins/modules/helm_plugin.py | 4 ++-- plugins/modules/helm_plugin_info.py | 4 ++-- 4 files changed, 7 insertions(+), 11 deletions(-) create mode 100644 changelogs/fragments/357_helm_plugin.yml diff --git a/changelogs/fragments/357_helm_plugin.yml b/changelogs/fragments/357_helm_plugin.yml new file mode 100644 index 00000000..a5c178e7 --- /dev/null +++ b/changelogs/fragments/357_helm_plugin.yml @@ -0,0 +1,3 @@ +bugfixes: +- helm_plugin - make unused ``release_namespace`` parameter as optional (https://github.com/ansible-collections/community.kubernetes/issues/357). +- helm_plugin_info - make unused ``release_namespace`` parameter as optional (https://github.com/ansible-collections/community.kubernetes/issues/357). diff --git a/molecule/default/roles/helm/tasks/tests_helm_plugin.yml b/molecule/default/roles/helm/tasks/tests_helm_plugin.yml index 720a06d5..3582dcc4 100644 --- a/molecule/default/roles/helm/tasks/tests_helm_plugin.yml +++ b/molecule/default/roles/helm/tasks/tests_helm_plugin.yml @@ -2,7 +2,6 @@ - name: Install env plugin in check mode helm_plugin: binary_path: "{{ helm_binary }}" - namespace: "{{ helm_namespace }}" state: present plugin_path: https://github.com/adamreese/helm-env register: check_install_env @@ -15,7 +14,6 @@ - name: Install env plugin helm_plugin: binary_path: "{{ helm_binary }}" - namespace: "{{ helm_namespace }}" state: present plugin_path: https://github.com/adamreese/helm-env register: install_env @@ -27,7 +25,6 @@ - name: Gather info about all plugin helm_plugin_info: binary_path: "{{ helm_binary }}" - namespace: "{{ helm_namespace }}" register: plugin_info - assert: @@ -37,7 +34,6 @@ - name: Install env plugin again helm_plugin: binary_path: "{{ helm_binary }}" - namespace: "{{ helm_namespace }}" state: present plugin_path: https://github.com/adamreese/helm-env register: install_env @@ -49,7 +45,6 @@ - name: Uninstall env plugin in check mode helm_plugin: binary_path: "{{ helm_binary }}" - namespace: "{{ helm_namespace }}" state: absent plugin_name: env register: check_uninstall_env @@ -62,7 +57,6 @@ - name: Uninstall env plugin helm_plugin: binary_path: "{{ helm_binary }}" - namespace: "{{ helm_namespace }}" state: absent plugin_name: env register: uninstall_env @@ -74,7 +68,6 @@ - name: Uninstall env plugin again helm_plugin: binary_path: "{{ helm_binary }}" - namespace: "{{ helm_namespace }}" state: absent plugin_name: env register: uninstall_env diff --git a/plugins/modules/helm_plugin.py b/plugins/modules/helm_plugin.py index e6d55795..d13f039b 100644 --- a/plugins/modules/helm_plugin.py +++ b/plugins/modules/helm_plugin.py @@ -19,10 +19,10 @@ requirements: description: - Manages Helm plugins. options: + # TODO: (akasurde) Remove this in version 2.0 release_namespace: description: - Kubernetes namespace where the helm plugin should be installed. - required: true type: str aliases: [ namespace ] @@ -103,7 +103,7 @@ def main(): module = AnsibleModule( argument_spec=dict( binary_path=dict(type='path'), - release_namespace=dict(type='str', required=True, aliases=['namespace']), + release_namespace=dict(type='str', aliases=['namespace']), state=dict(type='str', default='present', choices=['present', 'absent']), plugin_path=dict(type='str',), plugin_name=dict(type='str',), diff --git a/plugins/modules/helm_plugin_info.py b/plugins/modules/helm_plugin_info.py index 4746643f..8b551838 100644 --- a/plugins/modules/helm_plugin_info.py +++ b/plugins/modules/helm_plugin_info.py @@ -19,10 +19,10 @@ requirements: description: - Gather information about Helm plugins installed in namespace. options: + # TODO: (akasurde) Remove this in version 2.0 release_namespace: description: - Kubernetes namespace where the helm plugins are installed. - required: true type: str aliases: [ namespace ] @@ -84,7 +84,7 @@ def main(): module = AnsibleModule( argument_spec=dict( binary_path=dict(type='path'), - release_namespace=dict(type='str', required=True, aliases=['namespace']), + release_namespace=dict(type='str', aliases=['namespace']), plugin_name=dict(type='str',), # Helm options context=dict(type='str', aliases=['kube_context'], fallback=(env_fallback, ['K8S_AUTH_CONTEXT'])),