diff --git a/README.md b/README.md index bc6a1104..4635368f 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,11 @@ Name | Description --- | --- [kubernetes.core.kubectl](https://github.com/ansible-collections/kubernetes.core/blob/main/docs/kubernetes.core.kubectl_connection.rst)|Execute tasks in pods running on Kubernetes. +### K8s filter plugins +Name | Description +--- | --- +kubernetes.core.k8s_config_resource_name|Generate resource name for the given resource of type ConfigMap, Secret + ### Inventory plugins Name | Description --- | --- diff --git a/docs/kubernetes.core.helm_plugin_info_module.rst b/docs/kubernetes.core.helm_plugin_info_module.rst index 931c6418..86c563f9 100644 --- a/docs/kubernetes.core.helm_plugin_info_module.rst +++ b/docs/kubernetes.core.helm_plugin_info_module.rst @@ -152,22 +152,6 @@ Parameters
Name of Helm plugin, to gather particular plugin info.
- - -
- release_namespace - -
- string -
- - - - -
Kubernetes namespace where the helm plugins are installed.
-

aliases: namespace
- -
diff --git a/docs/kubernetes.core.helm_plugin_module.rst b/docs/kubernetes.core.helm_plugin_module.rst index 515b6f12..ca1f1d03 100644 --- a/docs/kubernetes.core.helm_plugin_module.rst +++ b/docs/kubernetes.core.helm_plugin_module.rst @@ -170,22 +170,6 @@ Parameters
Required only if state=present.
- - -
- release_namespace - -
- string -
- - - - -
Kubernetes namespace where the helm plugin should be installed.
-

aliases: namespace
- -
diff --git a/docs/kubernetes.core.k8s_cluster_info_module.rst b/docs/kubernetes.core.k8s_cluster_info_module.rst index ef64ec40..e1b6c4de 100644 --- a/docs/kubernetes.core.k8s_cluster_info_module.rst +++ b/docs/kubernetes.core.k8s_cluster_info_module.rst @@ -17,7 +17,7 @@ Version added: 0.11.1 Synopsis -------- -- 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. @@ -27,8 +27,8 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- python >= 2.7 -- openshift >= 0.6 +- python >= 3.6 +- kubernetes >= 12.0.0 - PyYAML >= 3.11 @@ -39,12 +39,12 @@ Parameters - + - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterParameter Choices/Defaults Comments
+
api_key @@ -59,7 +59,7 @@ Parameters
+
ca_cert @@ -75,7 +75,7 @@ Parameters
+
client_cert @@ -91,7 +91,7 @@ Parameters
+
client_key @@ -107,7 +107,7 @@ Parameters
+
context @@ -122,7 +122,7 @@ Parameters
+
host @@ -137,7 +137,7 @@ Parameters
+
invalidate_cache @@ -156,7 +156,7 @@ Parameters
+
kubeconfig @@ -167,11 +167,11 @@ Parameters
-
Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the openshift client will attempt to load the default configuration file from ~/.kube/config. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.
+
Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the Kubernetes client will attempt to load the default configuration file from ~/.kube/config. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.
+
password @@ -187,7 +187,7 @@ Parameters
+
persist_config @@ -210,7 +210,7 @@ Parameters
+
proxy @@ -226,7 +226,76 @@ Parameters
+
+ proxy_headers + +
+ dictionary +
+
added in 2.0.0
+
+ +
The Header used for the HTTP proxy.
+
Documentation can be found here https://urllib3.readthedocs.io/en/latest/reference/urllib3.util.html?highlight=proxy_headers#urllib3.util.make_headers.
+
+
+ basic_auth + +
+ string +
+
+ +
Colon-separated username:password for basic authentication header.
+
Can also be specified via K8S_AUTH_PROXY_HEADERS_BASIC_AUTH environment.
+
+
+ proxy_basic_auth + +
+ string +
+
+ +
Colon-separated username:password for proxy basic authentication header.
+
Can also be specified via K8S_AUTH_PROXY_HEADERS_PROXY_BASIC_AUTH environment.
+
+
+ user_agent + +
+ string +
+
+ +
String representing the user-agent you want, such as foo/1.0.
+
Can also be specified via K8S_AUTH_PROXY_HEADERS_USER_AGENT environment.
+
username @@ -242,7 +311,7 @@ Parameters
+
validate_certs @@ -269,7 +338,6 @@ Notes ----- .. note:: - - The OpenShift Python client wraps the K8s Python client, providing full access to all of the APIS and models available on both platforms. For API version details and additional information visit https://github.com/openshift/openshift-restclient-python - To avoid SSL certificate validation errors when ``validate_certs`` is *True*, the full certificate chain for the API server must be provided via ``ca_cert`` or in the kubeconfig file. @@ -309,48 +377,17 @@ Common return values are documented `here
dictionary + / elements=dictionary
success -
The APs that exists in dictionary
+
dictionary of group + version of resource found from cluster

  -
- api_version - -
- string -
-
success -
API version
-
-
  -
- available_api_version - -
- list -
-
success -
All available versions of the given API
-
-
 
categories @@ -365,38 +402,6 @@ Common return values are documented `here
  -
- group_version - -
- string -
-
success -
Resource Group version
-
-
  -
- kind - -
- string -
-
success -
Resource kind
-
-
  @@ -445,22 +450,6 @@ Common return values are documented `here
  -
- preferred_api_version - -
- string -
-
success -
Preferred version of the given API
-
-
  diff --git a/docs/kubernetes.core.k8s_exec_module.rst b/docs/kubernetes.core.k8s_exec_module.rst index 2599f40e..72b980b2 100644 --- a/docs/kubernetes.core.k8s_exec_module.rst +++ b/docs/kubernetes.core.k8s_exec_module.rst @@ -25,8 +25,8 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- python >= 2.7 -- openshift == 0.4.3 +- python >= 3.6 +- kubernetes >= 12.0.0 - PyYAML >= 3.11 @@ -37,12 +37,12 @@ Parameters - + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - @@ -314,6 +314,75 @@ Parameters
Please note that this module does not pick up typical proxy settings from the environment (e.g. HTTP_PROXY).
+ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/kubernetes.core.k8s_log_module.rst b/docs/kubernetes.core.k8s_log_module.rst index 324f2e88..edea0a8c 100644 --- a/docs/kubernetes.core.k8s_log_module.rst +++ b/docs/kubernetes.core.k8s_log_module.rst @@ -17,7 +17,7 @@ Version added: 0.10.0 Synopsis -------- -- 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` @@ -28,8 +28,8 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- python >= 2.7 -- openshift >= 0.6 +- python >= 3.6 +- kubernetes >= 12.0.0 - PyYAML >= 3.11 @@ -40,12 +40,12 @@ Parameters
ParameterParameter Choices/Defaults Comments
+
api_key @@ -57,7 +57,7 @@ Parameters
+
ca_cert @@ -73,7 +73,7 @@ Parameters
+
client_cert @@ -89,7 +89,7 @@ Parameters
+
client_key @@ -105,7 +105,7 @@ Parameters
+
command @@ -121,7 +121,7 @@ Parameters
+
container @@ -137,7 +137,7 @@ Parameters
+
context @@ -152,7 +152,7 @@ Parameters
+
host @@ -167,7 +167,7 @@ Parameters
+
kubeconfig @@ -178,11 +178,11 @@ Parameters
-
Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the openshift client will attempt to load the default configuration file from ~/.kube/config. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.
+
Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the Kubernetes client will attempt to load the default configuration file from ~/.kube/config. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.
+
namespace @@ -198,7 +198,7 @@ Parameters
+
password @@ -214,7 +214,7 @@ Parameters
+
persist_config @@ -237,7 +237,7 @@ Parameters
+
pod @@ -253,7 +253,7 @@ Parameters
+
proxy @@ -270,7 +270,76 @@ Parameters
+
+ proxy_headers + +
+ dictionary +
+
added in 2.0.0
+
+ +
The Header used for the HTTP proxy.
+ +
+
+ basic_auth + +
+ string +
+
+ +
Colon-separated username:password for basic authentication header.
+
Can also be specified via K8S_AUTH_PROXY_HEADERS_BASIC_AUTH environment.
+
+
+ proxy_basic_auth + +
+ string +
+
+ +
Colon-separated username:password for proxy basic authentication header.
+
Can also be specified via K8S_AUTH_PROXY_HEADERS_PROXY_BASIC_AUTH environment.
+
+
+ user_agent + +
+ string +
+
+ +
String representing the user-agent you want, such as foo/1.0.
+
Can also be specified via K8S_AUTH_PROXY_HEADERS_USER_AGENT environment.
+
username @@ -286,7 +355,7 @@ Parameters
+
validate_certs @@ -315,7 +384,6 @@ Notes .. note:: - Return code ``return_code`` for the command executed is added in output in version 1.0.0. - The authenticated user must have at least read access to the pods resource and write access to the pods/exec resource. - - The OpenShift Python client wraps the K8s Python client, providing full access to all of the APIS and models available on both platforms. For API version details and additional information visit https://github.com/openshift/openshift-restclient-python - To avoid SSL certificate validation errors when ``validate_certs`` is *True*, the full certificate chain for the API server must be provided via ``ca_cert`` or in the kubeconfig file. diff --git a/docs/kubernetes.core.k8s_info_module.rst b/docs/kubernetes.core.k8s_info_module.rst index 3c9f3f39..be82dce5 100644 --- a/docs/kubernetes.core.k8s_info_module.rst +++ b/docs/kubernetes.core.k8s_info_module.rst @@ -16,7 +16,7 @@ kubernetes.core.k8s_info Synopsis -------- -- 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. @@ -28,8 +28,8 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- python >= 2.7 -- openshift >= 0.6 +- python >= 3.6 +- kubernetes >= 12.0.0 - PyYAML >= 3.11 @@ -204,7 +204,7 @@ Parameters
-
Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the openshift client will attempt to load the default configuration file from ~/.kube/config. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.
+
Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the Kubernetes client will attempt to load the default configuration file from ~/.kube/config. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.
+
+ proxy_headers + +
+ dictionary +
+
added in 2.0.0
+
+ +
The Header used for the HTTP proxy.
+ +
+
+ basic_auth + +
+ string +
+
+ +
Colon-separated username:password for basic authentication header.
+
Can also be specified via K8S_AUTH_PROXY_HEADERS_BASIC_AUTH environment.
+
+
+ proxy_basic_auth + +
+ string +
+
+ +
Colon-separated username:password for proxy basic authentication header.
+
Can also be specified via K8S_AUTH_PROXY_HEADERS_PROXY_BASIC_AUTH environment.
+
+
+ user_agent + +
+ string +
+
+ +
String representing the user-agent you want, such as foo/1.0.
+
Can also be specified via K8S_AUTH_PROXY_HEADERS_USER_AGENT environment.
+
@@ -492,7 +561,6 @@ Notes ----- .. note:: - - The OpenShift Python client wraps the K8s Python client, providing full access to all of the APIS and models available on both platforms. For API version details and additional information visit https://github.com/openshift/openshift-restclient-python - To avoid SSL certificate validation errors when ``validate_certs`` is *True*, the full certificate chain for the API server must be provided via ``ca_cert`` or in the kubeconfig file. diff --git a/docs/kubernetes.core.k8s_inventory.rst b/docs/kubernetes.core.k8s_inventory.rst index 7569c258..e1fc270b 100644 --- a/docs/kubernetes.core.k8s_inventory.rst +++ b/docs/kubernetes.core.k8s_inventory.rst @@ -27,8 +27,8 @@ Requirements ------------ The below requirements are needed on the local Ansible controller node that executes this inventory. -- python >= 2.7 -- openshift >= 0.6 +- python >= 3.6 +- kubernetes >= 12.0.0 - PyYAML >= 3.11 @@ -187,7 +187,7 @@ Parameters
-
Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the OpenShift client will attempt to load the default configuration file from ~/.kube/config. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.
+
Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the Kubernetes client will attempt to load the default configuration file from ~/.kube/config. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.
- + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - @@ -381,12 +381,6 @@ Parameters
-Notes ------ - -.. note:: - - The OpenShift Python client wraps the K8s Python client, providing full access to all of the APIS and models available on both platforms. For API version details and additional information visit https://github.com/openshift/openshift-restclient-python - Examples diff --git a/docs/kubernetes.core.k8s_module.rst b/docs/kubernetes.core.k8s_module.rst index 9437db14..92af21a9 100644 --- a/docs/kubernetes.core.k8s_module.rst +++ b/docs/kubernetes.core.k8s_module.rst @@ -16,7 +16,7 @@ kubernetes.core.k8s Synopsis -------- -- 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. - Use the :ref:`kubernetes.core.k8s_info ` module to obtain a list of items about an object of type ``kind`` @@ -29,9 +29,10 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- python >= 2.7 -- openshift >= 0.6 +- python >= 3.6 +- kubernetes >= 12.0.0 - PyYAML >= 3.11 +- jsonpatch Parameters @@ -100,7 +101,6 @@ Parameters
Applies only to ConfigMap and Secret resources
The parameter will be silently ignored for other resource kinds
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
@@ -121,7 +121,6 @@ Parameters @@ -188,6 +187,27 @@ Parameters
The name of a context found in the config file. Can also be specified via K8S_AUTH_CONTEXT environment variable.
+ + + + + @@ -385,9 +405,7 @@ Parameters
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 merge if you see "strategic merge patch format is not supported"
See 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 ['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 strategic-merge.
+
If more than one merge_type is given, the merge_types will be tried in order. This defaults to ['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 apply
@@ -482,6 +500,75 @@ Parameters
Please note that this module does not pick up typical proxy settings from the environment (e.g. HTTP_PROXY).
+ + + + + + + + + + + + + + + + + + + + + + + + @@ -812,8 +899,6 @@ Notes ----- .. note:: - - 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. - - The OpenShift Python client wraps the K8s Python client, providing full access to all of the APIS and models available on both platforms. For API version details and additional information visit https://github.com/openshift/openshift-restclient-python - To avoid SSL certificate validation errors when ``validate_certs`` is *True*, the full certificate chain for the API server must be provided via ``ca_cert`` or in the kubeconfig file. @@ -994,6 +1079,22 @@ Common return values are documented `here 48 + + + + + +
ParameterParameter Choices/Defaults Comments
+
api_key @@ -60,7 +60,7 @@ Parameters
+
api_version @@ -80,7 +80,7 @@ Parameters
+
ca_cert @@ -96,7 +96,7 @@ Parameters
+
client_cert @@ -112,7 +112,7 @@ Parameters
+
client_key @@ -128,7 +128,7 @@ Parameters
+
container @@ -145,7 +145,7 @@ Parameters
+
context @@ -160,7 +160,7 @@ Parameters
+
host @@ -175,7 +175,7 @@ Parameters
+
kind @@ -193,7 +193,7 @@ Parameters
+
kubeconfig @@ -204,11 +204,11 @@ Parameters
-
Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the openshift client will attempt to load the default configuration file from ~/.kube/config. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.
+
Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the Kubernetes client will attempt to load the default configuration file from ~/.kube/config. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.
+
label_selectors @@ -225,7 +225,7 @@ Parameters
+
name @@ -242,7 +242,7 @@ Parameters
+
namespace @@ -260,7 +260,7 @@ Parameters
+
password @@ -276,7 +276,7 @@ Parameters
+
persist_config @@ -299,7 +299,7 @@ Parameters
+
proxy @@ -315,7 +315,76 @@ Parameters
+
+ proxy_headers + +
+ dictionary +
+
added in 2.0.0
+
+ +
The Header used for the HTTP proxy.
+ +
+
+ basic_auth + +
+ string +
+
+ +
Colon-separated username:password for basic authentication header.
+
Can also be specified via K8S_AUTH_PROXY_HEADERS_BASIC_AUTH environment.
+
+
+ proxy_basic_auth + +
+ string +
+
+ +
Colon-separated username:password for proxy basic authentication header.
+
Can also be specified via K8S_AUTH_PROXY_HEADERS_PROXY_BASIC_AUTH environment.
+
+
+ user_agent + +
+ string +
+
+ +
String representing the user-agent you want, such as foo/1.0.
+
Can also be specified via K8S_AUTH_PROXY_HEADERS_USER_AGENT environment.
+
username @@ -331,7 +400,7 @@ Parameters
+
validate_certs @@ -358,7 +427,6 @@ Notes ----- .. note:: - - The OpenShift Python client wraps the K8s Python client, providing full access to all of the APIS and models available on both platforms. For API version details and additional information visit https://github.com/openshift/openshift-restclient-python - To avoid SSL certificate validation errors when ``validate_certs`` is *True*, the full certificate chain for the API server must be provided via ``ca_cert`` or in the kubeconfig file. diff --git a/docs/kubernetes.core.k8s_lookup.rst b/docs/kubernetes.core.k8s_lookup.rst index 1d7f760f..9337796a 100644 --- a/docs/kubernetes.core.k8s_lookup.rst +++ b/docs/kubernetes.core.k8s_lookup.rst @@ -16,7 +16,7 @@ kubernetes.core.k8s Synopsis -------- -- Uses the OpenShift Python client to fetch a specific object by name, all matching objects within a namespace, or all matching objects for all namespaces, as well as information about the cluster. +- Uses the Kubernetes Python client to fetch a specific object by name, all matching objects within a namespace, or all matching objects for all namespaces, as well as information about the cluster. - Provides access the full range of K8s APIs. - Enables authentication via config file, certificates, password or token. @@ -26,8 +26,8 @@ Requirements ------------ The below requirements are needed on the local Ansible controller node that executes this lookup. -- python >= 2.7 -- openshift >= 0.6 +- python >= 3.6 +- kubernetes >= 12.0.0 - PyYAML >= 3.11 @@ -232,7 +232,7 @@ Parameters
-
Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the openshift client will attempt to load the default configuration file from ~/.kube/config. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.
+
Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the Kubernetes client will attempt to load the default configuration file from ~/.kube/config. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.
apply compares the desired resource definition with the previously supplied resource definition, ignoring properties that are automatically generated
apply works better with Services than 'force=yes'
-
Requires openshift >= 0.9.2
mutually exclusive with merge_type
+
+ continue_on_error + +
+ boolean +
+
added in 2.0.0
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
Whether to continue on creation/deletion errors when multiple resources are defined.
+
This has no effect on the validation step which is controlled by the validate.fail_on_error parameter.
+
@@ -361,7 +381,7 @@ Parameters
-
Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the openshift client will attempt to load the default configuration file from ~/.kube/config. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.
+
Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the Kubernetes client will attempt to load the default configuration file from ~/.kube/config. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.
+
+ proxy_headers + +
+ dictionary +
+
added in 2.0.0
+
+ +
The Header used for the HTTP proxy.
+ +
+
+ basic_auth + +
+ string +
+
+ +
Colon-separated username:password for basic authentication header.
+
Can also be specified via K8S_AUTH_PROXY_HEADERS_BASIC_AUTH environment.
+
+
+ proxy_basic_auth + +
+ string +
+
+ +
Colon-separated username:password for proxy basic authentication header.
+
Can also be specified via K8S_AUTH_PROXY_HEADERS_PROXY_BASIC_AUTH environment.
+
+
+ user_agent + +
+ string +
+
+ +
String representing the user-agent you want, such as foo/1.0.
+
Can also be specified via K8S_AUTH_PROXY_HEADERS_USER_AGENT environment.
+
@@ -590,7 +677,7 @@ Parameters
-
how (if at all) to validate the resource definition against the kubernetes schema. Requires the kubernetes-validate python module and openshift >= 0.8.0
+
how (if at all) to validate the resource definition against the kubernetes schema. Requires the kubernetes-validate python module.
  +
+ error + +
+ complex +
+
error +
error while trying to create/delete the object.
+
+
  diff --git a/docs/kubernetes.core.k8s_rollback_module.rst b/docs/kubernetes.core.k8s_rollback_module.rst index ceaa24f9..48e2d35c 100644 --- a/docs/kubernetes.core.k8s_rollback_module.rst +++ b/docs/kubernetes.core.k8s_rollback_module.rst @@ -17,7 +17,7 @@ Version added: 1.0.0 Synopsis -------- -- 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 ``kubectl rollout undo`` command. @@ -27,8 +27,8 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- python >= 2.7 -- openshift >= 0.6 +- python >= 3.6 +- kubernetes >= 12.0.0 - PyYAML >= 3.11 @@ -39,12 +39,12 @@ Parameters - + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + -
ParameterParameter Choices/Defaults Comments
+
api_key @@ -59,7 +59,7 @@ Parameters
+
api_version @@ -79,7 +79,7 @@ Parameters
+
ca_cert @@ -95,7 +95,7 @@ Parameters
+
client_cert @@ -111,7 +111,7 @@ Parameters
+
client_key @@ -127,7 +127,7 @@ Parameters
+
context @@ -142,7 +142,7 @@ Parameters
+
field_selectors @@ -158,7 +158,7 @@ Parameters
+
host @@ -173,7 +173,7 @@ Parameters
+
kind @@ -191,7 +191,7 @@ Parameters
+
kubeconfig @@ -202,11 +202,11 @@ Parameters
-
Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the openshift client will attempt to load the default configuration file from ~/.kube/config. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.
+
Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the Kubernetes client will attempt to load the default configuration file from ~/.kube/config. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.
+
label_selectors @@ -222,7 +222,7 @@ Parameters
+
name @@ -240,7 +240,7 @@ Parameters
+
namespace @@ -258,7 +258,7 @@ Parameters
+
password @@ -274,7 +274,7 @@ Parameters
+
persist_config @@ -297,7 +297,7 @@ Parameters
+
proxy @@ -313,7 +313,76 @@ Parameters
+
+ proxy_headers + +
+ dictionary +
+
added in 2.0.0
+
+ +
The Header used for the HTTP proxy.
+ +
+
+ basic_auth + +
+ string +
+
+ +
Colon-separated username:password for basic authentication header.
+
Can also be specified via K8S_AUTH_PROXY_HEADERS_BASIC_AUTH environment.
+
+
+ proxy_basic_auth + +
+ string +
+
+ +
Colon-separated username:password for proxy basic authentication header.
+
Can also be specified via K8S_AUTH_PROXY_HEADERS_PROXY_BASIC_AUTH environment.
+
+
+ user_agent + +
+ string +
+
+ +
String representing the user-agent you want, such as foo/1.0.
+
Can also be specified via K8S_AUTH_PROXY_HEADERS_USER_AGENT environment.
+
username @@ -329,7 +398,7 @@ Parameters
+
validate_certs @@ -356,7 +425,6 @@ Notes ----- .. note:: - - The OpenShift Python client wraps the K8s Python client, providing full access to all of the APIS and models available on both platforms. For API version details and additional information visit https://github.com/openshift/openshift-restclient-python - To avoid SSL certificate validation errors when ``validate_certs`` is *True*, the full certificate chain for the API server must be provided via ``ca_cert`` or in the kubeconfig file. diff --git a/docs/kubernetes.core.k8s_scale_module.rst b/docs/kubernetes.core.k8s_scale_module.rst index 0cb88c8d..29aadd5b 100644 --- a/docs/kubernetes.core.k8s_scale_module.rst +++ b/docs/kubernetes.core.k8s_scale_module.rst @@ -24,8 +24,8 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- python >= 2.7 -- openshift >= 0.6 +- python >= 3.6 +- kubernetes >= 12.0.0 - PyYAML >= 3.11 @@ -36,12 +36,12 @@ Parameters - + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - -
ParameterParameter Choices/Defaults Comments
+
api_key @@ -56,7 +56,7 @@ Parameters
+
api_version @@ -76,7 +76,7 @@ Parameters
+
ca_cert @@ -92,7 +92,7 @@ Parameters
+
client_cert @@ -108,7 +108,7 @@ Parameters
+
client_key @@ -124,7 +124,7 @@ Parameters
+
context @@ -139,7 +139,7 @@ Parameters
+
current_replicas @@ -154,7 +154,7 @@ Parameters
+
host @@ -169,7 +169,7 @@ Parameters
+
kind @@ -187,7 +187,7 @@ Parameters
+
kubeconfig @@ -198,11 +198,11 @@ Parameters
-
Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the openshift client will attempt to load the default configuration file from ~/.kube/config. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.
+
Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the Kubernetes client will attempt to load the default configuration file from ~/.kube/config. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.
+
name @@ -220,7 +220,7 @@ Parameters
+
namespace @@ -238,7 +238,7 @@ Parameters
+
password @@ -254,7 +254,7 @@ Parameters
+
persist_config @@ -277,7 +277,7 @@ Parameters
+
proxy @@ -293,7 +293,76 @@ Parameters
+
+ proxy_headers + +
+ dictionary +
+
added in 2.0.0
+
+ +
The Header used for the HTTP proxy.
+ +
+
+ basic_auth + +
+ string +
+
+ +
Colon-separated username:password for basic authentication header.
+
Can also be specified via K8S_AUTH_PROXY_HEADERS_BASIC_AUTH environment.
+
+
+ proxy_basic_auth + +
+ string +
+
+ +
Colon-separated username:password for proxy basic authentication header.
+
Can also be specified via K8S_AUTH_PROXY_HEADERS_PROXY_BASIC_AUTH environment.
+
+
+ user_agent + +
+ string +
+
+ +
String representing the user-agent you want, such as foo/1.0.
+
Can also be specified via K8S_AUTH_PROXY_HEADERS_USER_AGENT environment.
+
replicas @@ -309,7 +378,7 @@ Parameters
+
resource_definition @@ -326,7 +395,7 @@ Parameters
+
resource_version @@ -341,7 +410,7 @@ Parameters
+
src @@ -358,7 +427,7 @@ Parameters
+
username @@ -374,7 +443,7 @@ Parameters
+
validate_certs @@ -394,7 +463,7 @@ Parameters
+
wait @@ -413,7 +482,7 @@ Parameters
+
wait_timeout @@ -436,7 +505,6 @@ Notes ----- .. note:: - - The OpenShift Python client wraps the K8s Python client, providing full access to all of the APIS and models available on both platforms. For API version details and additional information visit https://github.com/openshift/openshift-restclient-python - To avoid SSL certificate validation errors when ``validate_certs`` is *True*, the full certificate chain for the API server must be provided via ``ca_cert`` or in the kubeconfig file. diff --git a/docs/kubernetes.core.k8s_service_module.rst b/docs/kubernetes.core.k8s_service_module.rst index 465f2057..3ac7e918 100644 --- a/docs/kubernetes.core.k8s_service_module.rst +++ b/docs/kubernetes.core.k8s_service_module.rst @@ -16,7 +16,7 @@ kubernetes.core.k8s_service Synopsis -------- -- Use Openshift Python SDK to manage Services on Kubernetes +- Use Kubernetes Python SDK to manage Services on Kubernetes @@ -24,8 +24,8 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- python >= 2.7 -- openshift >= 0.6.2 +- python >= 3.6 +- kubernetes >= 12.0.0 Parameters @@ -35,12 +35,12 @@ Parameters - + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - - - -
ParameterParameter Choices/Defaults Comments
+
api_key @@ -55,7 +55,7 @@ Parameters
+
apply @@ -76,7 +76,7 @@ Parameters
+
ca_cert @@ -92,7 +92,7 @@ Parameters
+
client_cert @@ -108,7 +108,7 @@ Parameters
+
client_key @@ -124,7 +124,7 @@ Parameters
+
context @@ -139,7 +139,7 @@ Parameters
+
force @@ -158,7 +158,7 @@ Parameters
+
host @@ -173,7 +173,7 @@ Parameters
+
kubeconfig @@ -184,11 +184,11 @@ Parameters
-
Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the openshift client will attempt to load the default configuration file from ~/.kube/config. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.
+
Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the Kubernetes client will attempt to load the default configuration file from ~/.kube/config. Can also be specified via K8S_AUTH_KUBECONFIG environment variable.
+
merge_type @@ -208,13 +208,12 @@ Parameters
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 merge if you see "strategic merge patch format is not supported"
-
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 ['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 strategic-merge.
+
If more than one merge_type is given, the merge_types will be tried in order
+
This defaults to ['strategic-merge', 'merge'], which is ideal for using the same parameters on resource kinds that combine Custom Resources and built-in resources.
+
name @@ -230,7 +229,7 @@ Parameters
+
namespace @@ -246,7 +245,7 @@ Parameters
+
password @@ -262,7 +261,7 @@ Parameters
+
persist_config @@ -285,7 +284,7 @@ Parameters
+
ports @@ -302,7 +301,7 @@ Parameters
+
proxy @@ -318,7 +317,76 @@ Parameters
+
+ proxy_headers + +
+ dictionary +
+
added in 2.0.0
+
+ +
The Header used for the HTTP proxy.
+ +
+
+ basic_auth + +
+ string +
+
+ +
Colon-separated username:password for basic authentication header.
+
Can also be specified via K8S_AUTH_PROXY_HEADERS_BASIC_AUTH environment.
+
+
+ proxy_basic_auth + +
+ string +
+
+ +
Colon-separated username:password for proxy basic authentication header.
+
Can also be specified via K8S_AUTH_PROXY_HEADERS_PROXY_BASIC_AUTH environment.
+
+
+ user_agent + +
+ string +
+
+ +
String representing the user-agent you want, such as foo/1.0.
+
Can also be specified via K8S_AUTH_PROXY_HEADERS_USER_AGENT environment.
+
resource_definition @@ -335,7 +403,7 @@ Parameters
+
selector @@ -351,7 +419,7 @@ Parameters
+
src @@ -368,7 +436,7 @@ Parameters
+
state @@ -387,7 +455,7 @@ Parameters
+
type @@ -409,7 +477,7 @@ Parameters
+
username @@ -425,7 +493,7 @@ Parameters
+
validate_certs @@ -452,7 +520,6 @@ Notes ----- .. note:: - - The OpenShift Python client wraps the K8s Python client, providing full access to all of the APIS and models available on both platforms. For API version details and additional information visit https://github.com/openshift/openshift-restclient-python - To avoid SSL certificate validation errors when ``validate_certs`` is *True*, the full certificate chain for the API server must be provided via ``ca_cert`` or in the kubeconfig file. diff --git a/plugins/filter/k8s.py b/plugins/filter/k8s.py index 7b8591ef..bf19ba3b 100644 --- a/plugins/filter/k8s.py +++ b/plugins/filter/k8s.py @@ -11,6 +11,9 @@ from ansible_collections.kubernetes.core.plugins.module_utils.hashes import gene def k8s_config_resource_name(resource): + """ + Generate resource name for the given resource of type ConfigMap, Secret + """ try: return resource['metadata']['name'] + '-' + generate_hash(resource) except KeyError: @@ -19,6 +22,9 @@ def k8s_config_resource_name(resource): # ---- Ansible filters ---- class FilterModule(object): + """ + + """ def filters(self): return {