mirror of
https://github.com/ansible-collections/kubernetes.core.git
synced 2026-04-11 11:20:54 +00:00
Update kustomize.py add --enable-helm support (#592)
Update kustomize.py add --enable-helm support Add --enable-helm support SUMMARY Fixes #568 ISSUE TYPE Feature Pull Request COMPONENT NAME Lookup plugin: kubernetes.core.kustomize ADDITIONAL INFORMATION Current and maintained arg: lookup('kubernetes.core.kustomize', dir=item) Additional feature args: lookup('kubernetes.core.kustomize', dir=item, enable_helm=false) lookup('kubernetes.core.kustomize', dir=item, enable_helm=true) Reviewed-by: Mike Graves <mgraves@redhat.com>
This commit is contained in:
3
changelogs/fragments/592-kustomize-helm-support.yml
Normal file
3
changelogs/fragments/592-kustomize-helm-support.yml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
minor_changes:
|
||||||
|
- kustomize - new parameter added to --enable-helm (https://github.com/ansible-collections/kubernetes.core/issues/568)
|
||||||
@@ -77,6 +77,24 @@ Parameters
|
|||||||
<div>If omitted, '.' is assumed.</div>
|
<div>If omitted, '.' is assumed.</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="1">
|
||||||
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
|
<b>enable_helm</b>
|
||||||
|
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||||
|
<div style="font-size: small">
|
||||||
|
<span style="color: purple">-</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<b>Default:</b><br/><div style="color: blue">"False"</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>Enable the helm chart inflation generator</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1">
|
<td colspan="1">
|
||||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||||
@@ -112,16 +130,20 @@ Examples
|
|||||||
.. code-block:: yaml
|
.. code-block:: yaml
|
||||||
|
|
||||||
- name: Run lookup using kustomize
|
- name: Run lookup using kustomize
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
resources: "{{ lookup('kubernetes.core.kustomize', binary_path='/path/to/kustomize') }}"
|
resources: "{{ lookup('kubernetes.core.kustomize', binary_path='/path/to/kustomize') }}"
|
||||||
|
|
||||||
- name: Run lookup using kubectl kustomize
|
- name: Run lookup using kubectl kustomize
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
resources: "{{ lookup('kubernetes.core.kustomize', binary_path='/path/to/kubectl') }}"
|
resources: "{{ lookup('kubernetes.core.kustomize', binary_path='/path/to/kubectl') }}"
|
||||||
|
|
||||||
- name: Create kubernetes resources for lookup output
|
- name: Create kubernetes resources for lookup output
|
||||||
k8s:
|
kubernetes.core.k8s:
|
||||||
definition: "{{ lookup('kubernetes.core.kustomize', dir='/path/to/kustomization') }}"
|
definition: "{{ lookup('kubernetes.core.kustomize', dir='/path/to/kustomization') }}"
|
||||||
|
|
||||||
|
- name: Create kubernetes resources for lookup output with `--enable-helm` set
|
||||||
|
kubernetes.core.k8s:
|
||||||
|
definition: "{{ lookup('kubernetes.core.kustomize', dir='/path/to/kustomization', enable_helm=True) }}"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,10 @@ DOCUMENTATION = """
|
|||||||
opt_dirs:
|
opt_dirs:
|
||||||
description:
|
description:
|
||||||
- An optional list of directories to search for the executable in addition to PATH.
|
- An optional list of directories to search for the executable in addition to PATH.
|
||||||
|
enable_helm:
|
||||||
|
description:
|
||||||
|
- Enable the helm chart inflation generator
|
||||||
|
default: "False"
|
||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
- "python >= 3.6"
|
- "python >= 3.6"
|
||||||
@@ -37,16 +41,20 @@ DOCUMENTATION = """
|
|||||||
|
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
- name: Run lookup using kustomize
|
- name: Run lookup using kustomize
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
resources: "{{ lookup('kubernetes.core.kustomize', binary_path='/path/to/kustomize') }}"
|
resources: "{{ lookup('kubernetes.core.kustomize', binary_path='/path/to/kustomize') }}"
|
||||||
|
|
||||||
- name: Run lookup using kubectl kustomize
|
- name: Run lookup using kubectl kustomize
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
resources: "{{ lookup('kubernetes.core.kustomize', binary_path='/path/to/kubectl') }}"
|
resources: "{{ lookup('kubernetes.core.kustomize', binary_path='/path/to/kubectl') }}"
|
||||||
|
|
||||||
- name: Create kubernetes resources for lookup output
|
- name: Create kubernetes resources for lookup output
|
||||||
k8s:
|
kubernetes.core.k8s:
|
||||||
definition: "{{ lookup('kubernetes.core.kustomize', dir='/path/to/kustomization') }}"
|
definition: "{{ lookup('kubernetes.core.kustomize', dir='/path/to/kustomization') }}"
|
||||||
|
|
||||||
|
- name: Create kubernetes resources for lookup output with `--enable-helm` set
|
||||||
|
kubernetes.core.k8s:
|
||||||
|
definition: "{{ lookup('kubernetes.core.kustomize', dir='/path/to/kustomization', enable_helm=True) }}"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
RETURN = """
|
RETURN = """
|
||||||
@@ -91,7 +99,14 @@ def run_command(command):
|
|||||||
|
|
||||||
class LookupModule(LookupBase):
|
class LookupModule(LookupBase):
|
||||||
def run(
|
def run(
|
||||||
self, terms, variables=None, dir=".", binary_path=None, opt_dirs=None, **kwargs
|
self,
|
||||||
|
terms,
|
||||||
|
variables=None,
|
||||||
|
dir=".",
|
||||||
|
binary_path=None,
|
||||||
|
opt_dirs=None,
|
||||||
|
enable_helm=False,
|
||||||
|
**kwargs
|
||||||
):
|
):
|
||||||
executable_path = binary_path
|
executable_path = binary_path
|
||||||
if executable_path is None:
|
if executable_path is None:
|
||||||
@@ -122,6 +137,9 @@ class LookupModule(LookupBase):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if enable_helm:
|
||||||
|
command += ["--enable-helm"]
|
||||||
|
|
||||||
(out, err) = run_command(command)
|
(out, err) = run_command(command)
|
||||||
if err:
|
if err:
|
||||||
raise AnsibleLookupError(
|
raise AnsibleLookupError(
|
||||||
|
|||||||
Reference in New Issue
Block a user