diff --git a/README.md b/README.md index 9bc1f603..21aed3b4 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,7 @@ Name | Description [kubernetes.core.helm_template](https://github.com/ansible-collections/kubernetes.core/blob/main/docs/kubernetes.core.helm_template_module.rst)|Render chart templates [kubernetes.core.k8s](https://github.com/ansible-collections/kubernetes.core/blob/main/docs/kubernetes.core.k8s_module.rst)|Manage Kubernetes (K8s) objects [kubernetes.core.k8s_cluster_info](https://github.com/ansible-collections/kubernetes.core/blob/main/docs/kubernetes.core.k8s_cluster_info_module.rst)|Describe Kubernetes (K8s) cluster, APIs available and their respective versions +[kubernetes.core.k8s_cp](https://github.com/ansible-collections/kubernetes.core/blob/main/docs/kubernetes.core.k8s_cp_module.rst)|Copy files and directories to and from pod. [kubernetes.core.k8s_exec](https://github.com/ansible-collections/kubernetes.core/blob/main/docs/kubernetes.core.k8s_exec_module.rst)|Execute command in Pod [kubernetes.core.k8s_info](https://github.com/ansible-collections/kubernetes.core/blob/main/docs/kubernetes.core.k8s_info_module.rst)|Describe Kubernetes (K8s) objects [kubernetes.core.k8s_json_patch](https://github.com/ansible-collections/kubernetes.core/blob/main/docs/kubernetes.core.k8s_json_patch_module.rst)|Apply JSON patch operations to existing objects diff --git a/docs/kubernetes.core.k8s_cp_module.rst b/docs/kubernetes.core.k8s_cp_module.rst new file mode 100644 index 00000000..adad5213 --- /dev/null +++ b/docs/kubernetes.core.k8s_cp_module.rst @@ -0,0 +1,549 @@ +.. _kubernetes.core.k8s_cp_module: + + +********************** +kubernetes.core.k8s_cp +********************** + +**Copy files and directories to and from pod.** + + +Version added: 2.1.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- Use the Kubernetes Python client to copy files and directories to and from containers inside a pod. + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- python >= 3.6 +- kubernetes >= 12.0.0 + + +Parameters +---------- + +.. raw:: html + +
| Parameter | +Choices/Defaults | +Comments | +|
|---|---|---|---|
|
+
+ api_key
+
+
+ string
+
+ |
+ + | +
+ Token used to authenticate with the API. Can also be specified via K8S_AUTH_API_KEY environment variable.
+ |
+ |
|
+
+ ca_cert
+
+
+ path
+
+ |
+ + | +
+ Path to a CA certificate used to authenticate with the API. The full certificate chain must be provided to avoid certificate validation errors. Can also be specified via K8S_AUTH_SSL_CA_CERT environment variable.
+ aliases: ssl_ca_cert |
+ |
|
+
+ client_cert
+
+
+ path
+
+ |
+ + | +
+ Path to a certificate used to authenticate with the API. Can also be specified via K8S_AUTH_CERT_FILE environment variable.
+ aliases: cert_file |
+ |
|
+
+ client_key
+
+
+ path
+
+ |
+ + | +
+ Path to a key file used to authenticate with the API. Can also be specified via K8S_AUTH_KEY_FILE environment variable.
+ aliases: key_file |
+ |
|
+
+ container
+
+
+ string
+
+ |
+ + | +
+ The name of the container in the pod to copy files/directories from/to.
+ Defaults to the only container if there is only one container in the pod.
+ |
+ |
|
+
+ content
+
+
+ string
+
+ |
+ + | +
+ When used instead of local_path, sets the contents of a local file directly to the specified value.
+ Works only when remote_path is a file. Creates the file if it does not exist.
+ For advanced formatting or if the content contains a variable, use the ansible.builtin.template module.
+ Mutually exclusive with local_path.
+ |
+ |
|
+
+ context
+
+
+ string
+
+ |
+ + | +
+ The name of a context found in the config file. Can also be specified via K8S_AUTH_CONTEXT environment variable.
+ |
+ |
|
+
+ host
+
+
+ string
+
+ |
+ + | +
+ Provide a URL for accessing the API. Can also be specified via K8S_AUTH_HOST environment variable.
+ |
+ |
|
+
+ kubeconfig
+
+
+ path
+
+ |
+ + | +
+ 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.
+ |
+ |
|
+
+ local_path
+
+
+ path
+
+ |
+ + | +
+ Path of the local file or directory.
+ Required when state is set to
+ from_pod.Mutually exclusive with content.
+ |
+ |
|
+
+ namespace
+
+
+ string
+ / required
+
+ |
+ + | +
+ The pod namespace name.
+ |
+ |
|
+
+ no_preserve
+
+
+ string
+
+ |
+
+ Default: "no"
+ |
+
+ The copied file/directory's ownership and permissions will not be preserved in the container.
+ This option is ignored when content is set or when state is set to
+ from_pod. |
+ |
|
+
+ password
+
+
+ string
+
+ |
+ + | +
+ Provide a password for authenticating with the API. Can also be specified via K8S_AUTH_PASSWORD environment variable.
+ Please read the description of the
+ username option for a discussion of when this option is applicable. |
+ |
|
+
+ persist_config
+
+
+ boolean
+
+ |
+
+
|
+
+ Whether or not to save the kube config refresh tokens. Can also be specified via K8S_AUTH_PERSIST_CONFIG environment variable.
+ When the k8s context is using a user credentials with refresh tokens (like oidc or gke/gcloud auth), the token is refreshed by the k8s python client library but not saved by default. So the old refresh token can expire and the next auth might fail. Setting this flag to true will tell the k8s python client to save the new refresh token to the kube config file.
+ Default to false.
+ Please note that the current version of the k8s python client library does not support setting this flag to True yet.
+ The fix for this k8s python library is here: https://github.com/kubernetes-client/python-base/pull/169
+ |
+ |
|
+
+ pod
+
+
+ string
+ / required
+
+ |
+ + | +
+ The pod name.
+ |
+ |
|
+
+ proxy
+
+
+ string
+
+ |
+ + | +
+ The URL of an HTTP proxy to use for the connection. Can also be specified via K8S_AUTH_PROXY environment variable.
+ Please note that this module does not pick up typical proxy settings from the environment (e.g. HTTP_PROXY).
+ |
+ |
|
+
+ 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.
+ |
+
|
+
+ remote_path
+
+
+ path
+ / required
+
+ |
+ + | +
+ Path of the file or directory to copy.
+ |
+ |
|
+
+ state
+
+
+ string
+
+ |
+
+
|
+
+ When set to
+ to_pod, the local local_path file or directory will be copied to remote_path into the pod.When set to
+ from_pod, the remote file or directory remote_path from pod will be copied locally to local_path. |
+ |
|
+
+ username
+
+
+ string
+
+ |
+ + | +
+ Provide a username for authenticating with the API. Can also be specified via K8S_AUTH_USERNAME environment variable.
+ Please note that this only works with clusters configured to use HTTP Basic Auth. If your cluster has a different form of authentication (e.g. OAuth2 in OpenShift), this option will not work as expected and you should look into the community.okd.k8s_auth module, as that might do what you need.
+ |
+ |
|
+
+ validate_certs
+
+
+ boolean
+
+ |
+
+
|
+
+ Whether or not to verify the API server's SSL certificates. Can also be specified via K8S_AUTH_VERIFY_SSL environment variable.
+ aliases: verify_ssl |
+ |
| Key | +Returned | +Description | +
|---|---|---|
|
+
+ result
+
+
+ string
+
+ |
+ success | +
+ message describing the copy operation successfully done.
+ + |
+