Link Search Menu Expand Document

Playground CLI

Our CLI interfacte gives you access to the same functionality available on the web interface plus some additional features. The Playground CLI is available on the Downloads section.

Installation

Basic usage

Discover how to log into your cluster.

Login into the Playground

To log into the playground from the CLI use:

$ playground login
Login success

Obtaining the kubeconfig

The Kubeconfig file is automatically managed by the CLI. However, if you are interested in using the kubeconfig yourself to interact through kubectl, retrieve the file with:

$ playground get-kubeconfig
ASSOCIATED SERVER
https://<server_IP>

Use this kubeconfig to connect to the cluster and deploy applications:
kubectl --kubeconfig <napptive-kubeconfig> ...

Cluster information

To discover your quota usage:

$ playground cluster info
Server version: v1.18.12-gke.1206 OAM: v0.2.1
CPU       MEM (MB)    STORAGE (MB)
0.15/2    269/1000    0/1000

Open Dashboard

To open the Playground dashboard execute:

$ playground dashboard

and the dashoard home screen will open in your browser

Login

Accounts & Environments

An account has one or more environments. A user, administrator of the account, will be in charge of creating and deleting them. The account’s environments cannot exceed the quota associated with the account.

An account belongs to one or more users. All the users can view the environments and work on them. One administrator can invite/remove another user to/of the account. Available commands to manage accounts and environments

List your accounts

Obtain a list of your accounts executing:

$ playground account list

ACCOUNT ID              NAME
<account1_id>           <account1_name>
<account2_id>           <account2_name>
...

Check the account info

Get detailed information about the account

$ playground account info <account_name>

ACCOUNT         ID              PLAN
<account_name > <account_id>    <PLAN>

Account quota (used/available):
CPU     MEM(MB)       STORAGE (MB)
1/4     4000/16000    1000/5000

Environments:
ENV         ID          CPU     RAM       STORAGE
<env1>      <env1_od>   0/1     0/4000    0/1000

Users:
USERNAME        FULL_NAME         EMAIL               ROLE
<username1>     <user Full Name>  user1@napptive.com  ADMIN

List your environments

Obtain a list of all your available environments executing:

$ playground env list
Current environment: account1/env1
CURRENT    ACCOUNT     NAME        ID           DESCRIPTION
*          account1    env1        <env1_id>    description environment 1
           account1    env2        <env2_id>    description environment 2
           account2    env3        <env3_id>    description environment 3

or list only the environments of one account:

$ playground env list account1 
Current environment: account1/env1
CURRENT    ACCOUNT     NAME        ID           DESCRIPTION
*          account1    env1        <env1_id>    description environment 1
           account1    env2        <env2_id>    description environment 2

Check the environment info

Get the environment detailed information executing:

$ playground env info <account>/<environment>
Server version: v1.20.9-gke.1001 OAM: v0.2.1
CREATION_TIME                           CREATED_BY
2021-09-01 16:03:48.452752 +0000 UTC    <username>

ACCOUNT    ENV              CPU     RAM       STORAGE
<account>  <environment>    0/1     0/4000    0/1000

DESCRIPTION
environment description

Create environments

As administrator of an account, you can create new environments in the account.

$ playground env create <account_name>/<env_name> --description=”This is a test” --cpu=1 --ram=2G --storage=5G --set-as-default=true

Flags:
      --cpu float32          Cpu quota
      --description string   Environment description
  -h, --help                 help for create
      --ram string           Ram quota
      --set-as-default       Set environment as default
      --storage string       Storage quota

If you don’t indicate the quota (cpu, ram and storage), an environment will be created with the default quota defined in the plan.

You can create as many environments as you need, always respecting the limits of the plan quotas. If this is not the case, the creation will fail:

$ playground env create account/env --ram=<value_that_exceeds_the_quota> --description="This is a test"
rpc error: code = Internal desc = Error creating environment. Not enough resources available

Invite to other users to your account

All administrators of an account can invite other users into the account.

  • The new user will have different roles in the account (admin or member).
  • The new user must be signed in napptive platform (exist in the platform)
  • The new user must no longer belong to the account
$ playground account user invite --help

Invite a user in an account

Usage:
  playground account user invite <username> <role> [flags]

Examples:

$ playground account user invite <username> member
$ playground account user invite <username> member
STATUS     INFO
SUCCESS    User invited successfully

Remove users from your account

Remove a user from an account. This operation can execute admin members only

$ playground account user remove <username>
STATUS     INFO
SUCCESS    User removed successfully

Change the role of the users in your account

Each user has a role in the account, and one administrator user can change the role of the other users.

Change the role executing:

$ playground account user change-role <username> admin
STATUS     INFO
SUCCESS    Role changed successfully

Change into environments

A user can deploy applications in the environments of the accounts to which he belongs. When you log into the platform, you do it into the default environment. To work in another environment, you must indicate it by executing:

$ playground env use <account1>/<env2>
Logged into account [account1] - environment [env2]

To confirm that the environment has changed, ask for a list and checking which is the current environment

$ playground env list
Current environment: account1/env1
CURRENT    ACCOUNT       NAME          ID           DESCRIPTION
           <account1>    <env1>        <env1_id>    <description environment 1>
*          <account1>    <env2 >       <env2_id>    <description environment 2>
           <account2>    <env3>        <env3_id>    <description environment 3>

Working with applications

Learn how to manage applications.

Deploying an application

To deploy an application from sources use:

$ playground apps deploy <path_to_drawio_files> 
STATUS     INFO
SUCCESS    application [drawio] deployed

CREATED
core.oam.dev/v1alpha2, Kind=Component "drawio" created
core.oam.dev/v1alpha2, Kind=ApplicationConfiguration "drawio" created

$ playground apps
NAME      STATUS
drawio    APP_OK

Listing deployed applications

Obtain a list of running applications in your current environment with:

$ playground apps
NAME                 STATUS
drawio               APP_OK
my-wordpress         APP_OK

You may be interested in knowing the applications that you have displaced in ALL your environments

$ playground apps --all-environments
Current environment: cdelope/cdelope
ENV                NAME           STATUS
account2/env1     my-nifi         APP_OK
account2/env1     drawio          APP_OK
account1/env1     my-wordpress    APP_OK

Or those deployed in a certain account

$ playground apps --account=<account1>
Current environment: cdelope/cdelope
ENV               NAME            STATUS
account1/env1     my-wordpress    APP_OK

Inspecting the application

Detailed application information can be obtained with:

$ playground app info drawio
NAME      STATUS
drawio    APP_OK

COMPONENT    STATUS    SCOPES    TRAITS
drawio       OK                  drawio-ingress

COMPONENT    INGRESSES
drawio       drawio-<your_username>.apps.playground.napptive.dev

Application logs

To retrieve logs from an application use:

$ playground apps logs <appName> 

[comp-1-864b6b49-f47l8]    [comp-1]    2021-04-20T19:12:09.401703900Z 2021-04-20 19:12:09+00:00 Sample application log
...

This command will actively stream all the logs comming from the application, use CTRL+C to stop receiving logs. A detailed guide on application logs is available describing how to obtain application and component logs.

Application endpoints

Applications may expose public endpoints, to navigate to those either request the information using:

$ playground app info <appName>
...
COMPONENT    INGRESSES
<appName>    <ingressName>-<your_username>.apps.playground.napptive.dev

And navigate to <ingressName>-<your_username>.apps.playground.napptive.dev or just use:

$ playground app open <appName>

This will launch a browser for each of the application endpoints.

Removing an application

The simplest way to remove an application is using the playground command with:

$ playground apps delete <appName> 

Open Application Model

Schematics

Explore the different schematics with:

$ playground schematics components
NAME
drawio

$ playground schematics traits
NAME
ingresses.core.napptive.com
manualscalertraits.core.oam.dev

$ playground schematics scopes
NAME
healthscopes.core.oam.dev

$ playground schematics workloads
NAME
containerizedworkloads.core.oam.dev

What’s next


Table of contents