Skip to content

Latest commit

 

History

History
345 lines (257 loc) · 7.65 KB

kubectl-plugin.md

File metadata and controls

345 lines (257 loc) · 7.65 KB

K8Spin kubectl plugin

This plugin makes straight forward to use and manage K8Spin concepts with the kubectl binary.

Install

Krew

Krew is the package manager for kubectl plugins.

Visit the Krew documentation to find Installation instructions, User Guide and Developer` Guide.

$ kubectl krew index add k8spin https://github.com/k8spin/k8spin-operator.git
WARNING: You have added a new index from "https://github.com/k8spin/k8spin-operator.git"
The plugins in this index are not audited for security by the Krew maintainers.
Install them at your own risk.
$ kubectl krew search k8spin
NAME           DESCRIPTION              INSTALLED
k8spin/k8spin  Manage K8Spin resources  no
$ kubectl krew install k8spin/k8spin
Updated the local copy of plugin index.
Updated the local copy of plugin index "k8spin".
Installing plugin: k8spin
Installed plugin: k8spin
\
 | Use this plugin:
 |      kubectl k8spin
 | Documentation:
 |      https://github.com/k8spin/k8spin-operator
 | Caveats:
 | \
 |  | This plugin needs the following programs:
 |  | * python >= 3.8
 | /
/
$ kubectl k8spin
usage: kubectl k8spin [-h] [--debug] {get,create,delete} ...

K8Spin kubectl plugin to manage multi-tenancy concepts

optional arguments:
  -h, --help           show this help message and exit
  --debug              Activate debug mode

commands:
  {get,create,delete}
    get                Get K8Spin resources
    create             Create K8Spin resources
    delete             Delete K8Spin resources

Manually

Place kubectl-k8spin.py file in your path without extension.

$ cp ./../kubectl-k8spin.py /usr/local/bin/kubectl-k8spin
$ chmod +x /usr/local/bin/kubectl-k8spin

or, run in the root of this repository

$ sudo make kubectl_plugin

Requirements

The plugin requires python 3.8+ to be previously installed.

Check

$ kubectl k8spin
usage: kubectl k8spin [-h] [--debug] {get,create,delete} ...

K8Spin kubectl plugin to manage multi-tenancy concepts

optional arguments:
  -h, --help           show this help message and exit
  --debug              Activate debug mode

commands:
  {get,create,delete}
    get                Get K8Spin resources
    create             Create K8Spin resources
    delete             Delete K8Spin resources

Usage

To start using it, execute kubectl k8spin.

Create

$ kubectl k8spin create --help
usage: kubectl k8spin create [-h] {org,tenant,space} ...

optional arguments:
  -h, --help          show this help message and exit

Create:
  {org,tenant,space}
    org               Organization
    tenant            Tenant
    space             Space

Organizations

$ kubectl k8spin create org --help
usage: kubectl k8spin create org [-h] --cpu cpu --memory memory org_name

positional arguments:
  org_name

optional arguments:
  -h, --help       show this help message and exit
  --cpu cpu        CPU Amount
  --memory memory  Memory Amount

Example:

$ kubectl k8spin create org demo --cpu 10 --memory 10Gi
organization.k8spin.cloud/demo created

Tenants

$ kubectl k8spin create tenant --help
usage: kubectl k8spin create tenant [-h] --org org --cpu cpu --memory memory tenant_name

positional arguments:
  tenant_name

optional arguments:
  -h, --help       show this help message and exit
  --org org        Filter by Organization
  --cpu cpu        CPU Amount
  --memory memory  Memory Amount

Example:

$ kubectl k8spin create tenant demo --org demo --cpu 10 --memory 10Gi
tenant.k8spin.cloud/demo created

Spaces

$ kubectl k8spin create space --help
usage: kubectl k8spin create space [-h] --org org --tenant tenant --cpu cpu --memory memory --default-cpu cpu --default-memory memory space_name

positional arguments:
  space_name

optional arguments:
  -h, --help            show this help message and exit
  --org org             Filter by Organization
  --tenant tenant       Filter by Tenant
  --cpu cpu             CPU Amount
  --memory memory       Memory Amount
  --default-cpu cpu     CPU Amount
  --default-memory memory
                        Memory Amount

Example:

$ kubectl k8spin create space demo --org demo --tenant demo --cpu 10 --memory 10Gi --default-cpu 0.1 --default-memory 1Mi
space.k8spin.cloud/demo created

Get

$ kubectl k8spin get --help
usage: kubectl k8spin get [-h] {org,tenant,space} ...

optional arguments:
  -h, --help          show this help message and exit

Query For:
  {org,tenant,space}
    org               Organization
    tenant            Tenant
    space             Space

Organizations

$ kubectl k8spin get org --help
usage: kubectl k8spin get org [-h] [org_name]

positional arguments:
  org_name

optional arguments:
  -h, --help  show this help message and exit

Example:

$ kubectl k8spin get org
Name                CPU                 Memory
demo                10                  10Gi

Tenants

$ kubectl k8spin get tenant --help
usage: kubectl k8spin get tenant [-h] [--org org] [tenant_name]

positional arguments:
  tenant_name

optional arguments:
  -h, --help   show this help message and exit
  --org org    Filter by Organization

Example:

$ kubectl k8spin get tenant
Organization        Name                CPU                 Memory
demo                demo                10                  10Gi

Spaces

$ kubectl k8spin get space --help
usage: kubectl k8spin get space [-h] [--tenant tenant] [--org org] [space_name]

positional arguments:
  space_name

optional arguments:
  -h, --help       show this help message and exit
  --tenant tenant  Filter by Tenant
  --org org        Filter by Organization

Example:

$ kubectl k8spin get space
Organization        Tenant              Name                CPU                 Memory              Default CPU         Default Memory
demo                demo                demo                10                  10Gi                0.1                 1Mi

Delete

$ kubectl k8spin delete --help
usage: kubectl k8spin delete [-h] {org,tenant,space} ...

optional arguments:
  -h, --help          show this help message and exit

Delete:
  {org,tenant,space}
    org               Organization
    tenant            Tenant
    space             Space

Spaces

$ kubectl k8spin delete space --help
usage: kubectl k8spin delete space [-h] --org org --tenant tenant space_name

positional arguments:
  space_name

optional arguments:
  -h, --help       show this help message and exit
  --org org        Filter by Organization
  --tenant tenant  Filter by Tenant

Example:

$ kubectl k8spin delete space demo --org demo --tenant demo
space.k8spin.cloud "demo" deleted

Tenants

$ kubectl k8spin delete space tenant --help
usage: kubectl k8spin delete space [-h] --org org --tenant tenant space_name

positional arguments:
  space_name

optional arguments:
  -h, --help       show this help message and exit
  --org org        Filter by Organization
  --tenant tenant  Filter by Tenant

Example:

$ kubectl k8spin delete tenant demo --org demo
tenant.k8spin.cloud "demo" deleted

Organizations

$ kubectl k8spin delete org --help
usage: kubectl k8spin delete org [-h] org_name

positional arguments:
  org_name

optional arguments:
  -h, --help  show this help message and exit

Example:

$ kubectl k8spin delete org demo
organization.k8spin.cloud "demo" deleted