Skip to content

Latest commit

 

History

History
251 lines (212 loc) · 8.59 KB

kubernetes.core.kustomize_lookup.rst

File metadata and controls

251 lines (212 loc) · 8.59 KB

kubernetes.core.kustomize

Build a set of kubernetes resources using a 'kustomization.yaml' file.

Version added: 2.2.0

  • Uses the kustomize or the kubectl tool.
  • Return the result of kustomize build or kubectl kustomize.

The below requirements are needed on the local Ansible controller node that executes this lookup.

  • python >= 3.6
Parameter Choices/Defaults Configuration Comments
binary_path
-
The path of a kustomize or kubectl binary to use.
dir
-
Default:
"."
The directory path containing 'kustomization.yaml', or a git repository URL with a path suffix specifying same with respect to the repository root.
If omitted, '.' is assumed.
opt_dirs
-
An optional list of directories to search for the executable in addition to PATH.

Note

  • If both kustomize and kubectl are part of the PATH, kustomize will be used by the plugin.
- name: Run lookup using kustomize
  set_fact:
    resources: "{{ lookup('kubernetes.core.kustomize', binary_path='/path/to/kustomize') }}"

- name: Run lookup using kubectl kustomize
  set_fact:
    resources: "{{ lookup('kubernetes.core.kustomize', binary_path='/path/to/kubectl') }}"

- name: Create kubernetes resources for lookup output
  k8s:
    definition: "{{ lookup('kubernetes.core.kustomize', dir='/path/to/kustomization') }}"

Common return values are documented here, the following are the fields unique to this lookup:

Key Returned Description
_list
complex
One ore more object definitions returned from the tool execution.

 
api_version
string
success
The versioned schema of this representation of an object.

 
kind
string
success
Represents the REST resource this object represents.

 
metadata
complex
success
Standard object metadata. Includes name, namespace, annotations, labels, etc.

 
spec
complex
success
Specific attributes of the object. Will vary based on the api_version and kind.

 
status
complex
success
Current status details for the object.



Authors

  • Aubin Bikouo <@abikouo>

Hint

Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.