Skip to main content

HPE Container Platform client

Project description

Build & Test Code Checks Issues Coverage Status Pyversions MIT license Code Style

Gitpod Ready-to-Code Good first issues open


- This project is under active development.
- Method APIs may change between commits.
- Not all HPE CP APIs have been implemented.
- Help Wanted - please consider contributing!

Documentation

See here for User Documentation.

Contributing

See:

Installation

# ensure you have an up-to-date pip
pip3 install -U pip

# install hpecp directly from git
pip3 install --upgrade git+https://github.com/hpe-container-platform-community/hpecp-client@master

If you are installing on Centos 7.7 with only Python 2.7 see here for a workaround

CLI examples

CLI is installed with pip (as above)

First you need to create a config file with your endpoint details.

Note that you can have multiple profiles:

cat > ~/.hpecp.conf <<EOF
[default]
api_host = 127.0.0.1
api_port = 8080
use_ssl = True
verify_ssl = False
warn_ssl = False
username = admin
password = admin123

[tenant1]
tenant = /api/v1/tenant/15
admin = ad_admin1
password = pass123
EOF

Setup bash autocomplete:

source <(hpecp autocomplete bash)

Autocompletion:

hpecp TAB

K8s versions:

hpecp k8scluster k8s-supported-versions --major-filter 1 --minor-filter 17

Create k8s cluster:

hpecp k8scluster create --name myclus1 --k8shosts-config /api/v2/worker/k8shost/1:master --k8s_version=1.17.0

List with columns parameter:

hpecp k8scluster list --columns [id,description,status]

List with (jmespath) query parameter:

hpecp catalog list --query "[?state!='installed' && state!='installing'] | [*].[_links.self.href] | []"  --output text

List --query examples:

hpecp tenant examples

Tenant kube config:

PROFILE=tenant1 hpecp tenant k8skubeconfig > tenant1_kube.conf

Http call:

hpecp httpclient get /some/uri

Logging with HTTP tracing:

export LOG_LEVEL=DEBUG
hpecp do-something

More sophisticated CLI examples here

Basic Library Usage

See docs: https://hpe-container-platform-community.github.io/hpecp-python-library/index.html

Example:

from hpecp import ContainerPlatformClient

client = ContainerPlatformClient(username='admin',
                                password='admin123',
                                api_host='127.0.0.1',
                                api_port=8080,
                                use_ssl=True,
                                verify_ssl='/certs/hpecp-ca-cert.pem')
client.create_session() # Login

# Alternatively:
# client = ContainerPlatformClient.create_from_config_file().create_session()

print(client.k8s_cluster.list(columns=['description', 'id']))

On my environment, this displays:

+-------------+-----------------------+
| description |          id           |
+-------------+-----------------------+
| my cluster  | /api/v2/k8scluster/20 |
+-------------+-----------------------+

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hpecp-0.0.5.tar.gz (36.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hpecp-0.0.5-py3-none-any.whl (53.0 kB view details)

Uploaded Python 3

File details

Details for the file hpecp-0.0.5.tar.gz.

File metadata

  • Download URL: hpecp-0.0.5.tar.gz
  • Upload date:
  • Size: 36.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.8

File hashes

Hashes for hpecp-0.0.5.tar.gz
Algorithm Hash digest
SHA256 f37a7c4c2454d61d557219d63c7e3ab6e3255591adba2f77b91aa820337a0332
MD5 a81f5dc01bd7180c09103743ba1090e5
BLAKE2b-256 f49b499d22c3eb34a47b4fd3600085d72598b4f72d52a5e94f33a3eb438086d2

See more details on using hashes here.

File details

Details for the file hpecp-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: hpecp-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 53.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.8

File hashes

Hashes for hpecp-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 604078b72d2e2767a72af65b2b6150608133d4dd503866ae9ba156ad8d833403
MD5 c6deabb441a027ac721c86beca7abe14
BLAKE2b-256 036c9a235b297c82f58ed64ef02f5e0fc526e1248abdbeb66db6491bfe8f05cc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page