Skip to content
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.

Minor doc fixes #114

Merged
merged 1 commit into from
Jun 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugins/doc_fragments/k8s_name_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ModuleDocFragment(object):
description:
- Use to specify an object namespace. Useful when creating, deleting, or discovering an object without
providing a full resource definition. Use in conjunction with I(api_version), I(kind), and I(name)
to identify a specfic object. If I(resource definition) is provided, the I(metadata.namespace) value
to identify a specific object. If I(resource definition) is provided, the I(metadata.namespace) value
from the I(resource_definition) will override this option.
type: str
'''
22 changes: 11 additions & 11 deletions plugins/modules/helm.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
__metaclass__ = type


DOCUMENTATION = '''
DOCUMENTATION = r'''
---
module: helm

Expand Down Expand Up @@ -120,62 +120,62 @@
type: str
'''

EXAMPLES = '''
EXAMPLES = r'''
- name: Create helm namespace as HELM 3 doesn't create it automatically
k8s:
community.kubernetes.k8s:
api_version: v1
kind: Namespace
name: "monitoring"
wait: true

# From repository
- name: Add stable chart repo
helm_repository:
community.kubernetes.helm_repository:
name: stable
repo_url: "https://kubernetes-charts.storage.googleapis.com"

- name: Deploy latest version of Grafana chart inside monitoring namespace with values
helm:
community.kubernetes.helm:
name: test
chart_ref: stable/grafana
release_namespace: monitoring
values:
replicas: 2

- name: Deploy Grafana chart on 5.0.12 with values loaded from template
helm:
community.kubernetes.helm:
name: test
chart_ref: stable/grafana
chart_version: 5.0.12
values: "{{ lookup('template', 'somefile.yaml') | from_yaml }}"

- name: Remove test release and waiting suppression ending
helm:
community.kubernetes.helm:
name: test
state: absent
wait: true

# From git
- name: Git clone stable repo on HEAD
git:
ansible.builtin.git:
repo: "http://github.com/helm/charts.git"
dest: /tmp/helm_repo

- name: Deploy Grafana chart from local path
helm:
community.kubernetes.helm:
name: test
chart_ref: /tmp/helm_repo/stable/grafana
release_namespace: monitoring

# From url
- name: Deploy Grafana chart on 5.0.12 from url
helm:
community.kubernetes.helm:
name: test
chart_ref: "https://kubernetes-charts.storage.googleapis.com/grafana-5.0.12.tgz"
release_namespace: monitoring
'''

RETURN = """
RETURN = r"""
status:
type: complex
description: A dictionary of status output
Expand Down
12 changes: 6 additions & 6 deletions plugins/modules/helm_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
__metaclass__ = type


DOCUMENTATION = '''
DOCUMENTATION = r'''
---
module: helm_info

short_description: Get informations from Helm package deployed inside the cluster
short_description: Get information from Helm package deployed inside the cluster

version_added: "0.11.0"

Expand All @@ -23,7 +23,7 @@
- "yaml (https://pypi.org/project/PyYAML/)"

description:
- Get informations (values, states, ...) from Helm package deployed inside the cluster
- Get information (values, states, ...) from Helm package deployed inside the cluster

options:
binary_path:
Expand Down Expand Up @@ -56,14 +56,14 @@
aliases: [ kubeconfig ]
'''

EXAMPLES = '''
EXAMPLES = r'''
- name: Deploy latest version of Grafana chart inside monitoring namespace
helm_info:
community.kubernetes.helm_info:
name: test
release_namespace: monitoring
'''

RETURN = """
RETURN = r"""
status:
type: complex
description: A dictionary of status output
Expand Down
10 changes: 5 additions & 5 deletions plugins/modules/helm_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
__metaclass__ = type


DOCUMENTATION = '''
DOCUMENTATION = r'''
---
module: helm_repository

Expand Down Expand Up @@ -59,21 +59,21 @@
repo_state:
choices: ['present', 'absent']
description:
- Desirated state of repositoriy.
- Desirated state of repository.
required: false
default: present
aliases: [ state ]
type: str
'''

EXAMPLES = '''
EXAMPLES = r'''
- name: Add default repository
helm_repository:
community.kubernetes.helm_repository:
name: stable
repo_url: https://kubernetes-charts.storage.googleapis.com
'''

RETURN = ''' # '''
RETURN = r''' # '''

import traceback

Expand Down
22 changes: 11 additions & 11 deletions plugins/modules/k8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
__metaclass__ = type


DOCUMENTATION = '''
DOCUMENTATION = r'''

module: k8s

Expand Down Expand Up @@ -147,16 +147,16 @@
- "PyYAML >= 3.11"
'''

EXAMPLES = '''
EXAMPLES = r'''
- name: Create a k8s namespace
k8s:
community.kubernetes.k8s:
name: testing
api_version: v1
kind: Namespace
state: present

- name: Create a Service object from an inline definition
k8s:
community.kubernetes.k8s:
state: present
definition:
apiVersion: v1
Expand All @@ -178,7 +178,7 @@
port: 8000

- name: Remove an existing Service object
k8s:
community.kubernetes.k8s:
state: absent
api_version: v1
kind: Service
Expand All @@ -188,39 +188,39 @@
# Passing the object definition from a file

- name: Create a Deployment by reading the definition from a local file
k8s:
community.kubernetes.k8s:
state: present
src: /testing/deployment.yml

- name: >-
Read definition file from the Ansible controller file system.
If the definition file has been encrypted with Ansible Vault it will automatically be decrypted.
k8s:
community.kubernetes.k8s:
state: present
definition: "{{ lookup('file', '/testing/deployment.yml') | from_yaml }}"

- name: Read definition file from the Ansible controller file system after Jinja templating
k8s:
community.kubernetes.k8s:
state: present
definition: "{{ lookup('template', '/testing/deployment.yml') | from_yaml }}"

- name: fail on validation errors
k8s:
community.kubernetes.k8s:
state: present
definition: "{{ lookup('template', '/testing/deployment.yml') | from_yaml }}"
validate:
fail_on_error: yes

- name: warn on validation errors, check for unexpected properties
k8s:
community.kubernetes.k8s:
state: present
definition: "{{ lookup('template', '/testing/deployment.yml') | from_yaml }}"
validate:
fail_on_error: no
strict: yes
'''

RETURN = '''
RETURN = r'''
result:
description:
- The created, patched, or otherwise present object. Will be empty in the case of a deletion.
Expand Down
12 changes: 6 additions & 6 deletions plugins/modules/k8s_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
__metaclass__ = type


DOCUMENTATION = '''
DOCUMENTATION = r'''

module: k8s_auth

Expand Down Expand Up @@ -75,7 +75,7 @@
- requests-oauthlib
'''

EXAMPLES = '''
EXAMPLES = r'''
- hosts: localhost
module_defaults:
group/k8s:
Expand All @@ -88,31 +88,31 @@
- include_vars: k8s_passwords.yml

- name: Log in (obtain access token)
k8s_auth:
community.kubernetes.k8s_auth:
username: admin
password: "{{ k8s_admin_password }}"
register: k8s_auth_results

# Previous task provides the token/api_key, while all other parameters
# are taken from module_defaults
- name: Get a list of all pods from any namespace
k8s_info:
community.kubernetes.k8s_info:
api_key: "{{ k8s_auth_results.k8s_auth.api_key }}"
kind: Pod
register: pod_list

always:
- name: If login succeeded, try to log out (revoke access token)
when: k8s_auth_results.k8s_auth.api_key is defined
k8s_auth:
community.kubernetes.k8s_auth:
state: absent
api_key: "{{ k8s_auth_results.k8s_auth.api_key }}"
'''

# Returned value names need to match k8s modules parameter names, to make it
# easy to pass returned values of k8s_auth to other k8s modules.
# Discussion: https://github.com/ansible/ansible/pull/50807#discussion_r248827899
RETURN = '''
RETURN = r'''
k8s_auth:
description: Kubernetes authentication facts.
returned: success
Expand Down
8 changes: 4 additions & 4 deletions plugins/modules/k8s_exec.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
__metaclass__ = type


DOCUMENTATION = '''
DOCUMENTATION = r'''

module: k8s_exec

Expand Down Expand Up @@ -58,15 +58,15 @@
required: yes
'''

EXAMPLES = '''
EXAMPLES = r'''
- name: Execute a command
k8s_exec:
community.kubernetes.k8s_exec:
namespace: myproject
pod: zuul-scheduler
command: zuul-scheduler full-reconfigure
'''

RETURN = '''
RETURN = r'''
result:
description:
- The command object
Expand Down
6 changes: 3 additions & 3 deletions plugins/modules/k8s_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
__metaclass__ = type


DOCUMENTATION = '''
DOCUMENTATION = r'''
module: k8s_info

short_description: Describe Kubernetes (K8s) objects
Expand Down Expand Up @@ -68,7 +68,7 @@
- "PyYAML >= 3.11"
'''

EXAMPLES = '''
EXAMPLES = r'''
- name: Get an existing Service object
k8s_info:
api_version: v1
Expand Down Expand Up @@ -103,7 +103,7 @@
- status.phase=Running
'''

RETURN = '''
RETURN = r'''
resources:
description:
- The object(s) that exists
Expand Down