Skip to content

Dieler/openshift-restclient-python

 
 

Repository files navigation

OpenShift python client

Build Status Coverage Status

Python client for the OpenShift API.

Installation

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

Example

TODO

Documentation

All APIs and Models' documentation can be found at the Generated client's README file

Community, Support, Discussion

If you have any problem with the package or any suggestions, please file an issue.

Code of Conduct

Participation in the Kubernetes community is governed by the CNCF Code of Conduct.

Update generated client

Updating the generated client requires the following tools:

  • tox
  • maven3
  1. Incorporate new changes to update scripts
  • scripts/constants.py, scripts/pom.xml, scripts/preprocess_spec.py, update-client.sh are the most important
  1. Run tox -e update_client

Ansible Modules

This repo is home to the tools used to generate the K8s modules for Ansible.

Using the modules

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.

Requirements

  • Ansible installed from source
  • OpenShift Rest Client installed on the host where the modules will execute

Installation and use

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

Generating the modules

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.

Common module

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 99.9%
  • Shell 0.1%