merge with main branch

This commit is contained in:
abikouo
2021-05-17 16:58:27 +02:00
47 changed files with 1548 additions and 506 deletions

View File

@@ -20,13 +20,6 @@ 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.
type: str
aliases: [ namespace ]
#Helm options
state:
description:
@@ -108,7 +101,6 @@ def main():
module = AnsibleModule(
argument_spec=dict(
binary_path=dict(type='path'),
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',),

View File

@@ -20,13 +20,6 @@ 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.
type: str
aliases: [ namespace ]
#Helm options
plugin_name:
description:
@@ -88,7 +81,6 @@ def main():
module = AnsibleModule(
argument_spec=dict(
binary_path=dict(type='path'),
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'])),

View File

@@ -21,7 +21,7 @@ author:
- "Fabian von Feilitzsch (@fabianvf)"
description:
- Use the OpenShift Python client to perform CRUD operations on K8s objects.
- Use the Kubernetes Python client to perform CRUD operations on K8s objects.
- Pass the object definition from a source file or inline. See examples for reading
files and using Jinja templates or vault-encrypted files.
- Access to the full range of K8s APIs.
@@ -37,13 +37,6 @@ extends_documentation_fragment:
- kubernetes.core.k8s_wait_options
- kubernetes.core.k8s_delete_options
notes:
- If your OpenShift Python library is not 0.9.0 or newer and you are trying to
remove an item from an associative array/dictionary, for example a label or
an annotation, you will need to explicitly set the value of the item to be
removed to `null`. Simply deleting the entry in the dictionary will not
remove it from openshift or kubernetes.
options:
merge_type:
description:
@@ -52,11 +45,9 @@ options:
- 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).
- If more than one C(merge_type) is given, the merge_types will be tried in order. 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.
- mutually exclusive with C(apply)
choices:
- json
@@ -67,7 +58,7 @@ options:
validate:
description:
- how (if at all) to validate the resource definition against the kubernetes schema.
Requires the kubernetes-validate python module and openshift >= 0.8.0
Requires the kubernetes-validate python module.
suboptions:
fail_on_error:
description: whether to fail on validation errors.
@@ -88,7 +79,6 @@ options:
- The full definition of an object is needed to generate the hash - this means that deleting an object created with append_hash
will only work if the same object is passed with state=absent (alternatively, just use state=absent with the name including
the generated hash and append_hash=no)
- Requires openshift >= 0.7.2
default: False
type: bool
apply:
@@ -96,7 +86,6 @@ options:
- C(apply) compares the desired resource definition with the previously supplied resource definition,
ignoring properties that are automatically generated
- C(apply) works better with Services than 'force=yes'
- Requires openshift >= 0.9.2
- mutually exclusive with C(merge_type)
default: False
type: bool
@@ -133,10 +122,10 @@ options:
version_added: 2.0.0
requirements:
- "python >= 2.7"
- "openshift >= 0.6"
- "python >= 3.6"
- "kubernetes >= 12.0.0"
- "PyYAML >= 3.11"
- "jsonpath-rw"
- "jsonpatch"
'''
EXAMPLES = r'''

View File

@@ -18,7 +18,7 @@ author:
- Abhijeet Kasurde (@Akasurde)
description:
- Use the OpenShift Python client to perform read operations on K8s objects.
- Use the Kubernetes Python client to perform read operations on K8s objects.
- Authenticate using either a config file, certificates, password or token.
- Supports check mode.
@@ -33,8 +33,8 @@ extends_documentation_fragment:
- kubernetes.core.k8s_auth_options
requirements:
- "python >= 2.7"
- "openshift >= 0.6"
- "python >= 3.6"
- "kubernetes >= 12.0.0"
- "PyYAML >= 3.11"
'''
@@ -140,19 +140,29 @@ apis:
import copy
from ansible_collections.kubernetes.core.plugins.module_utils.ansiblemodule import AnsibleModule
from ansible.module_utils.parsing.convert_bool import boolean
from ansible_collections.kubernetes.core.plugins.module_utils.args_common import (AUTH_ARG_SPEC)
import traceback
from collections import defaultdict
HAS_K8S = False
try:
from ansible_collections.kubernetes.core.plugins.module_utils.client.resource import ResourceList
HAS_K8S = True
except ImportError as e:
K8S_IMP_ERR = e
K8S_IMP_EXC = traceback.format_exc()
from ansible.module_utils._text import to_native
from ansible.module_utils.basic import missing_required_lib
from ansible.module_utils.parsing.convert_bool import boolean
from ansible_collections.kubernetes.core.plugins.module_utils.ansiblemodule import AnsibleModule
from ansible_collections.kubernetes.core.plugins.module_utils.args_common import (AUTH_ARG_SPEC)
def execute_module(module, client):
invalidate_cache = boolean(module.params.get('invalidate_cache', True), strict=False)
if invalidate_cache:
client.resources.invalidate_cache()
results = defaultdict(dict)
from openshift.dynamic.resource import ResourceList
for resource in list(client.resources):
resource = resource[0]
if isinstance(resource, ResourceList):
@@ -176,7 +186,7 @@ def execute_module(module, client):
'username': configuration.username,
'verify_ssl': configuration.verify_ssl,
}
from openshift import __version__ as version
from kubernetes import __version__ as version
version_info = {
'client': version,
'server': client.version,
@@ -192,6 +202,9 @@ def argspec():
def main():
module = AnsibleModule(argument_spec=argspec(), supports_check_mode=True)
if not HAS_K8S:
module.fail_json(msg=missing_required_lib('kubernetes'), exception=K8S_IMP_EXC,
error=to_native(K8S_IMP_ERR))
from ansible_collections.kubernetes.core.plugins.module_utils.common import get_api_client
execute_module(module, client=get_api_client(module=module))

View File

@@ -26,8 +26,8 @@ extends_documentation_fragment:
- kubernetes.core.k8s_auth_options
requirements:
- "python >= 2.7"
- "openshift == 0.4.3"
- "python >= 3.6"
- "kubernetes >= 12.0.0"
- "PyYAML >= 3.11"
notes:

View File

@@ -18,7 +18,7 @@ author:
- "Will Thames (@willthames)"
description:
- Use the OpenShift Python client to perform read operations on K8s objects.
- Use the Kubernetes Python client to perform read operations on K8s objects.
- Access to the full range of K8s APIs.
- Authenticate using either a config file, certificates, password or token.
- Supports check mode.
@@ -49,8 +49,8 @@ extends_documentation_fragment:
- kubernetes.core.k8s_wait_options
requirements:
- "python >= 2.7"
- "openshift >= 0.6"
- "python >= 3.6"
- "kubernetes >= 12.0.0"
- "PyYAML >= 3.11"
- "jsonpath-rw"
'''

View File

@@ -20,7 +20,7 @@ author:
- "Fabian von Feilitzsch (@fabianvf)"
description:
- Use the OpenShift Python client to perform read operations on K8s log endpoints.
- Use the Kubernetes Python client to perform read operations on K8s log endpoints.
- Authenticate using either a config file, certificates, password or token.
- Supports check mode.
- Analogous to `kubectl logs` or `oc logs`
@@ -56,8 +56,8 @@ options:
type: str
requirements:
- "python >= 2.7"
- "openshift >= 0.6"
- "python >= 3.6"
- "kubernetes >= 12.0.0"
- "PyYAML >= 3.11"
'''

View File

@@ -15,7 +15,7 @@ version_added: "1.0.0"
author:
- "Julien Huon (@julienhuon)"
description:
- Use the OpenShift Python client to perform the Rollback.
- Use the Kubernetes Python client to perform the Rollback.
- Authenticate using either a config file, certificates, password or token.
- Similar to the C(kubectl rollout undo) command.
options:
@@ -31,8 +31,8 @@ extends_documentation_fragment:
- kubernetes.core.k8s_auth_options
- kubernetes.core.k8s_name_options
requirements:
- "python >= 2.7"
- "openshift >= 0.6"
- "python >= 3.6"
- "kubernetes >= 12.0.0"
- "PyYAML >= 3.11"
- "jsonpath-rw"
'''

View File

@@ -31,8 +31,8 @@ extends_documentation_fragment:
- kubernetes.core.k8s_scale_options
requirements:
- "python >= 2.7"
- "openshift >= 0.6"
- "python >= 3.6"
- "kubernetes >= 12.0.0"
- "PyYAML >= 3.11"
'''

View File

@@ -18,7 +18,7 @@ short_description: Manage Services on Kubernetes
author: KubeVirt Team (@kubevirt)
description:
- Use Openshift Python SDK to manage Services on Kubernetes
- Use Kubernetes Python SDK to manage Services on Kubernetes
extends_documentation_fragment:
- kubernetes.core.k8s_auth_options
@@ -33,11 +33,9 @@ options:
- 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).
- If more than one C(merge_type) is given, the merge_types will be tried in order
- 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.
choices:
- json
- merge
@@ -85,8 +83,8 @@ options:
type: bool
requirements:
- python >= 2.7
- openshift >= 0.6.2
- python >= 3.6
- kubernetes >= 12.0.0
'''
EXAMPLES = r'''