Python client for the OpenShift API.
From source:
git clone https://github.com/openshift/openshift-restclient-python.git
cd openshift-restclient-python
python setup.py install
From PyPi directly (coming soon):
pip install openshift
TODO
All APIs and Models' documentation can be found at the Generated client's README file
If you have any problem with the package or any suggestions, please file an issue.
Participation in the Kubernetes community is governed by the CNCF Code of Conduct.
Updating the generated client requires the following tools:
- tox
- maven3
- Incorporate new changes to update scripts
- scripts/constants.py, scripts/pom.xml, scripts/preprocess_spec.py, update-client.sh are the most important
- Run tox -e update_client
This repo is home to the tools used to generate the K8s modules for Ansible.
The modules are currently in pre-release. For convenience there is an Ansible role available at ansible/ansible-kubernetes-modules, which if referenced in a playbook, will provide full access to the latest.
- Ansible installed from source
- OpenShift Rest Client installed on the host where the modules will execute
Using the Galaxy client, download and install the role as follows:
$ ansible-galaxy install ansible.kubernetes-modules
Include the role in your playbook, and the modules will be available, allowing tasks from any other play or role to reference them. Here's an example:
- hosts: localhost
connection: local
gather_facts: no
roles:
- role: ansible.kubernetes-modules
- role: hello-world
The hello-world role deploys an application to a locally running OpenShift instance by executing tasks with the modules. It's able to access them because ansible.ansible-kubernetes-modules is referenced.
You'll find the modules in the library folder of the role. Each contains documented parameters, and the returned data structure. Not every module contains examples, only those where we have added test data.
If you find a bug, or have a suggestion, related to the modules, please file an issue here
After installing the OpenShift client, the modules can be generated by running the following:
$ openshift-ansible-gen modules --output-path /path/to/modules/dir
If --output-path is not provided, modules will be written to ./_modules.
Individual modules are generated using the OpenShift Rest Client. However, there is a shared or utility module in the Ansible repo called, k8s_common.py, which imports the client, and performs most of the work. This is currently in a pre-release state as well, and is only available in the devel branch of Ansible. For this reason, you'll need to run Ansible from source. For assistnace, see Running from source.