mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
kubevirt: cleanup module docs (#54119)
This commit is contained in:
parent
5d32dbd532
commit
53b56825cd
6 changed files with 50 additions and 56 deletions
|
@ -24,20 +24,20 @@ API_GROUP = 'kubevirt.io'
|
|||
|
||||
|
||||
VM_COMMON_ARG_SPEC = {
|
||||
'name': {},
|
||||
'name': {'required': True},
|
||||
'namespace': {'required': True},
|
||||
'state': {
|
||||
'default': 'present',
|
||||
'choices': ['present', 'absent'],
|
||||
},
|
||||
'force': {
|
||||
'type': 'bool',
|
||||
'default': False,
|
||||
},
|
||||
'resource_definition': {
|
||||
'type': list_dict_str,
|
||||
'type': 'dict',
|
||||
'aliases': ['definition', 'inline']
|
||||
},
|
||||
'src': {
|
||||
'type': 'path',
|
||||
},
|
||||
'namespace': {},
|
||||
'api_version': {'type': 'str', 'default': '%s/%s' % (API_GROUP, MAX_SUPPORTED_API_VERSION), 'aliases': ['api', 'version']},
|
||||
'merge_type': {'type': 'list', 'choices': ['json', 'merge', 'strategic-merge']},
|
||||
'wait': {'type': 'bool', 'default': True},
|
||||
'wait_timeout': {'type': 'int', 'default': 120},
|
||||
|
|
|
@ -51,7 +51,6 @@ options:
|
|||
|
||||
extends_documentation_fragment:
|
||||
- k8s_auth_options
|
||||
- k8s_resource_options
|
||||
- kubevirt_vm_options
|
||||
- kubevirt_common_options
|
||||
|
||||
|
@ -93,7 +92,7 @@ import copy
|
|||
import traceback
|
||||
|
||||
|
||||
from ansible.module_utils.k8s.common import AUTH_ARG_SPEC, COMMON_ARG_SPEC
|
||||
from ansible.module_utils.k8s.common import AUTH_ARG_SPEC
|
||||
|
||||
from ansible.module_utils.kubevirt import (
|
||||
virtdict,
|
||||
|
@ -113,8 +112,7 @@ class KubeVirtVMPreset(KubeVirtRawModule):
|
|||
@property
|
||||
def argspec(self):
|
||||
""" argspec property builder """
|
||||
argument_spec = copy.deepcopy(COMMON_ARG_SPEC)
|
||||
argument_spec.update(copy.deepcopy(AUTH_ARG_SPEC))
|
||||
argument_spec = copy.deepcopy(AUTH_ARG_SPEC)
|
||||
argument_spec.update(VM_COMMON_ARG_SPEC)
|
||||
argument_spec.update(VMP_ARG_SPEC)
|
||||
return argument_spec
|
||||
|
|
|
@ -57,7 +57,6 @@ options:
|
|||
|
||||
extends_documentation_fragment:
|
||||
- k8s_auth_options
|
||||
- k8s_resource_options
|
||||
- kubevirt_vm_options
|
||||
- kubevirt_common_options
|
||||
|
||||
|
@ -112,7 +111,7 @@ import copy
|
|||
import traceback
|
||||
|
||||
|
||||
from ansible.module_utils.k8s.common import AUTH_ARG_SPEC, COMMON_ARG_SPEC
|
||||
from ansible.module_utils.k8s.common import AUTH_ARG_SPEC
|
||||
|
||||
try:
|
||||
from openshift.dynamic.client import ResourceInstance
|
||||
|
@ -139,8 +138,7 @@ class KubeVirtVMIRS(KubeVirtRawModule):
|
|||
@property
|
||||
def argspec(self):
|
||||
""" argspec property builder """
|
||||
argument_spec = copy.deepcopy(COMMON_ARG_SPEC)
|
||||
argument_spec.update(copy.deepcopy(AUTH_ARG_SPEC))
|
||||
argument_spec = copy.deepcopy(AUTH_ARG_SPEC)
|
||||
argument_spec.update(copy.deepcopy(VM_COMMON_ARG_SPEC))
|
||||
argument_spec.update(copy.deepcopy(VMIR_ARG_SPEC))
|
||||
return argument_spec
|
||||
|
|
|
@ -26,6 +26,16 @@ version_added: "2.8"
|
|||
author: KubeVirt Team (@kubevirt)
|
||||
|
||||
options:
|
||||
name:
|
||||
description:
|
||||
- Name of the Template object.
|
||||
required: true
|
||||
type: str
|
||||
namespace:
|
||||
description:
|
||||
- Namespace where the Template object exists.
|
||||
required: true
|
||||
type: str
|
||||
objects:
|
||||
description:
|
||||
- List of any valid API objects, such as a I(DeploymentConfig), I(Service), etc. The object
|
||||
|
@ -129,9 +139,7 @@ options:
|
|||
|
||||
extends_documentation_fragment:
|
||||
- k8s_auth_options
|
||||
- k8s_resource_options
|
||||
- k8s_state_options
|
||||
- k8s_name_options
|
||||
|
||||
requirements:
|
||||
- python >= 2.7
|
||||
|
@ -197,7 +205,7 @@ kubevirt_template:
|
|||
import copy
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.k8s.common import AUTH_ARG_SPEC, COMMON_ARG_SPEC
|
||||
from ansible.module_utils.k8s.common import AUTH_ARG_SPEC
|
||||
|
||||
from ansible.module_utils.kubevirt import (
|
||||
virtdict,
|
||||
|
@ -207,12 +215,15 @@ from ansible.module_utils.kubevirt import (
|
|||
|
||||
|
||||
TEMPLATE_ARG_SPEC = {
|
||||
'name': {'required': True},
|
||||
'namespace': {'required': True},
|
||||
'state': {
|
||||
'type': 'str',
|
||||
'choices': [
|
||||
'present', 'absent'
|
||||
],
|
||||
'default': 'present'
|
||||
'default': 'present',
|
||||
'choices': ['present', 'absent'],
|
||||
},
|
||||
'force': {
|
||||
'type': 'bool',
|
||||
'default': False,
|
||||
},
|
||||
'merge_type': {
|
||||
'type': 'list',
|
||||
|
@ -271,8 +282,7 @@ class KubeVirtVMTemplate(KubeVirtRawModule):
|
|||
@property
|
||||
def argspec(self):
|
||||
""" argspec property builder """
|
||||
argument_spec = copy.deepcopy(COMMON_ARG_SPEC)
|
||||
argument_spec.update(copy.deepcopy(AUTH_ARG_SPEC))
|
||||
argument_spec = copy.deepcopy(AUTH_ARG_SPEC)
|
||||
argument_spec.update(TEMPLATE_ARG_SPEC)
|
||||
return argument_spec
|
||||
|
||||
|
|
|
@ -65,7 +65,6 @@ options:
|
|||
|
||||
extends_documentation_fragment:
|
||||
- k8s_auth_options
|
||||
- k8s_resource_options
|
||||
- kubevirt_vm_options
|
||||
- kubevirt_common_options
|
||||
|
||||
|
@ -210,7 +209,7 @@ kubevirt_vm:
|
|||
import copy
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.k8s.common import AUTH_ARG_SPEC, COMMON_ARG_SPEC
|
||||
from ansible.module_utils.k8s.common import AUTH_ARG_SPEC
|
||||
|
||||
try:
|
||||
from openshift.dynamic.client import ResourceInstance
|
||||
|
@ -243,8 +242,7 @@ class KubeVirtVM(KubeVirtRawModule):
|
|||
@property
|
||||
def argspec(self):
|
||||
""" argspec property builder """
|
||||
argument_spec = copy.deepcopy(COMMON_ARG_SPEC)
|
||||
argument_spec.update(copy.deepcopy(AUTH_ARG_SPEC))
|
||||
argument_spec = copy.deepcopy(AUTH_ARG_SPEC)
|
||||
argument_spec.update(VM_COMMON_ARG_SPEC)
|
||||
argument_spec.update(VM_ARG_SPEC)
|
||||
return argument_spec
|
||||
|
|
|
@ -5,21 +5,23 @@
|
|||
|
||||
|
||||
class ModuleDocFragment(object):
|
||||
|
||||
# Standard oVirt documentation fragment
|
||||
DOCUMENTATION = r'''
|
||||
options:
|
||||
resource_definition:
|
||||
description:
|
||||
- "A partial YAML definition of the object being created/updated. Here you can define Kubernetes
|
||||
resource parameters not covered by this module's parameters."
|
||||
- "NOTE: I(resource_definition) has lower priority than module parameters. If you try to define e.g.
|
||||
I(metadata.namespace) here, that value will be ignored and I(namespace) used instead."
|
||||
aliases:
|
||||
- definition
|
||||
- inline
|
||||
type: dict
|
||||
wait:
|
||||
description:
|
||||
- "I(True) if the module should wait for the resource to get into desired state."
|
||||
type: bool
|
||||
default: yes
|
||||
kind:
|
||||
description:
|
||||
- Use to specify an object model. Use to create, delete, or discover an object without providing a full
|
||||
resource definition. Use in conjunction with I(api_version), I(name), and I(namespace) to identify a
|
||||
specific object. If I(resource definition) is provided, the I(kind) from the I(resource_definition)
|
||||
will override this option.
|
||||
force:
|
||||
description:
|
||||
- If set to C(no), and I(state) is C(present), an existing object will be replaced.
|
||||
|
@ -30,14 +32,6 @@ options:
|
|||
- The amount of time in seconds the module should wait for the resource to get into desired state.
|
||||
type: int
|
||||
default: 120
|
||||
api_version:
|
||||
description:
|
||||
- "Specify the API version to be used."
|
||||
type: str
|
||||
default: kubevirt.io/v1alpha3
|
||||
aliases:
|
||||
- api
|
||||
- version
|
||||
memory:
|
||||
description:
|
||||
- The amount of memory to be requested by virtual machine.
|
||||
|
@ -54,16 +48,12 @@ options:
|
|||
type: str
|
||||
merge_type:
|
||||
description:
|
||||
- Whether to override the default patch merge approach with a specific type. By default, the strategic
|
||||
merge will typically be used.
|
||||
- For example, Custom Resource Definitions typically aren't updatable by the usual strategic merge. You may
|
||||
want to use C(merge) if you see "strategic merge patch format is not supported"
|
||||
- See U(https://kubernetes.io/docs/tasks/run-application/update-api-object-kubectl-patch/#use-a-json-merge-patch-to-update-a-deployment)
|
||||
- Requires openshift >= 0.6.2
|
||||
- If more than one merge_type is given, the merge_types will be tried in order
|
||||
- If openshift >= 0.6.2, this defaults to C(['strategic-merge', 'merge']), which is ideal for using the same parameters
|
||||
on resource kinds that combine Custom Resources and built-in resources. For openshift < 0.6.2, the default
|
||||
is simply C(strategic-merge).
|
||||
- Whether to override the default patch merge approach with a specific type.
|
||||
- If more than one merge type is given, the merge types will be tried in order.
|
||||
- "Defaults to C(['strategic-merge', 'merge']), which is ideal for using the same parameters
|
||||
on resource kinds that combine Custom Resources and built-in resources, as
|
||||
Custom Resource Definitions typically aren't updatable by the usual strategic merge."
|
||||
- "See U(https://kubernetes.io/docs/tasks/run-application/update-api-object-kubectl-patch/#use-a-json-merge-patch-to-update-a-deployment)"
|
||||
type: list
|
||||
choices: [ json, merge, strategic-merge ]
|
||||
cpu_shares:
|
||||
|
@ -122,5 +112,5 @@ requirements:
|
|||
notes:
|
||||
- "In order to use this module you have to install Openshift Python SDK.
|
||||
To ensure it's installed with correct version you can create the following task:
|
||||
I(pip: name=openshift version=0.8.2)"
|
||||
I(pip: name=openshift>=0.8.2)"
|
||||
'''
|
||||
|
|
Loading…
Reference in a new issue