# Arlonctl

Arlonctl is a command line utility that enables you to operate with the Arlon profile engine built into PMK. For context around Arlon capabilities built into PMK, please first read [auto$](https://github.com/platform9/pcd-docs-gitbook/blob/main/kubernetes/profile-engine-with-arlon/README.md)

Arlonctl extends the open source Arlon CLI with key additional features context management, using the PMK environment credentials provided by the PMK administrator.

## Installation

You can download the arlonctl binary using the following command:

{% tabs %}
{% tab title="Bash" %}

```bash
bash <(curl -sL https://arlon-assets.s3-us-west-1.amazonaws.com/arlonCTL/5.7/arlonctl_setup)
```

{% endtab %}
{% endtabs %}

Operating Systems Supported :

* Linux (amd64)
* MacOS (amd64,arm64)

Note: arlonctl command may run into errors when the KUBECONFIG environment variable is set to point to some Kubernetes cluster other than the Arlon management cluster (Platform9 DU). The arlonctl command internally uses the KUBECONFIG environment variable (and sets it to point to the Platform9 management plane DU's kubeconfig. The file resides in the location `~/.config/arlon/context.config`). If the user has set this variable to a different cluster's kubeconfig file, arlonctl will error out. As a workaround, unset the KUBECONFIG environment variable.

## List of commands

{% tabs %}
{% tab title="Bash" %}

```bash
arlonctl                    

Usage:
  arlonctl [flags]
  arlonctl [command]

Available Commands:
  basecluster   Manage base clusters
  bundle        Manage configuration bundles
  cloudprovider Lists out the cloud providers of the DU
  cluster       Manage clusters
  clusterspec   Manage cluster specifications
  completion    Generate the autocompletion script for the specified shell
  context       Manage contexts
  controller    Run the Arlon controller
  help          Help about any command
  listclusters  List the clusters registered with ArgoCD
  profile       Manage configuration profiles
  verify        Verify if arlonctl can be run

Flags:
  -h, --help   help for arlonctl

Use "arlonctl [command] --help" for more information about a command.
```

{% endtab %}
{% endtabs %}

### verify

This command is used to verify if all the optional and mandatory tools/requirements to run arlonctl are present.

(Mandatory Requirements : kubectl Optional Requirements: argocd CLI, git)

Example:

{% tabs %}
{% tab title="Bash" %}

```bash
arlonctl verify      

✓ Successfully verified kubectl status
✓ [Optional] Successfully verified git status
! [Optional] Error while verifying Argocd CLI status:  install argocd v2.4.x to run arlonctl

✓ All mandatory requirements are installed
```

{% endtab %}
{% endtabs %}

### context

This command allows user to create and switch between two or more DUs / contexts. It makes it easy for the user to manage multiple DUs. All the contexts which have been added by the user are stored in a contexts.json file which is at \~/.config/arlon .Sensitive credentials such as passwords are stored in the JSON file after being encrypted. The kubeconfig of the current DU as well is stored in the same location with the name context.config. The logs for all the arlonctl commands are stored in \~/.config/arlon/logs.txt

{% tabs %}
{% tab title="Bash" %}

```bash
arlonctl context             
Usage:
  arlonctl context [flags]
  arlonctl context [command]

Available Commands:
  create      Create a new context
  delete      Delete the existing context
  list        Lists the existing contexts
  refresh     Refresh the tokens in DU config and argo config
  switch      Switch between the contexts
  update      updates the existing context

Flags:
  -h, --help   help for context

Use "arlonctl context [command] --help" for more information about a command.
```

{% endtab %}
{% endtabs %}

#### create

This command creates a new context, which the user can then work with. The current context will be set to the newly created context using this command. To create a new context, the user needs to add their DU-FQDN, their username and password.

Usage:

{% tabs %}
{% tab title="Bash" %}

```bash
arlonctl context create --help 
Create or add a new context to the already existing contexts and the current context will be set to the recently created context

Usage:
  arlonctl context create context-name [flags]

Examples:
arlonctl context create context-name [flags]

Flags:
  -f, --fqdn string       sets the fqdn
  -h, --help              help for create
  -p, --password string   sets password
  -u, --username string   sets username
```

{% endtab %}
{% endtabs %}

Example:

{% tabs %}
{% tab title="Bash" %}

```bash
arlonctl context create ctx2          
FQDN: pf9arlon-kubedu.platform9.horse
Username: user@platform9.com
Password: *******
Successfully authenticated with DU
Successfully authenticated with ArgoCD
Successfully added and set to ctx2 context
```

{% endtab %}
{% endtabs %}

#### switch

This command allows the user to switch between multiple contexts.

Example:

{% tabs %}
{% tab title="Bash" %}

```bash
arlonctl context switch arlonctl-ctx
Context found with the name: arlonctl-ctx
Successfully switched the DU Config file
Successfully switched the ArgoCD config
Successfully switched to arlonctl-ctx context
```

{% endtab %}
{% endtabs %}

#### list

Lists the contexts present. It also mentions the current context of the user.

Example:

{% tabs %}
{% tab title="Bash" %}

```bash
arlonctl context list       
NAME          DU_FQDN                          USERNAME            CURRENTCONTEXT
new2          arlon-kubedu-3.platform9.horse   user@platform9.com  False
arlonctl-ctx  pf9arlon-kubedu.platform9.horse  user@platform9.com  False
ctx2          pf9arlon-kubedu.platform9.horse  user@platform9.com  True
```

{% endtab %}
{% endtabs %}

#### delete

Deletes the context provided by the user.

Example:

{% tabs %}
{% tab title="Bash" %}

```bash
arlonctl context delete new2
Context deleted Successfully
```

{% endtab %}
{% endtabs %}

#### refresh

Refreshes the x-auth token of the DU and the argocd token after it expires.

Example:

{% tabs %}
{% tab title="Bash" %}

```bash
arlonctl context refresh
Successfully refreshed the DU config file
Successfully refreshed the Argo config file
```

{% endtab %}
{% endtabs %}

### cloud provider

This command allows user to list the cloud providers present in the DU. Example:

{% tabs %}
{% tab title="Bash" %}

```bash
arlonctl cloudprovider list
NAME      CLOUDPROVIDER
aws       44317bcb8b024041846dc2cb36a92352-aws
aws-demo  44317bcb8b024041846dc2cb36a92352-aws-demo
```

{% endtab %}
{% endtabs %}

### bundle

This command is used to manage the bundles which together form a profile which is then used to deploy a cluster. This command is inherited from the arlon OSS CLI. the available commands in arlonctl bundle are :

{% tabs %}
{% tab title="Bash" %}

```bash
arlonctl bundle      
Manage configuration bundles

Usage:
  arlonctl bundle [flags]
  arlonctl bundle [command]

Available Commands:
  create      Create configuration bundle
  delete      Delete configuration bundle
  dump        Dump content of static configuration bundle
  list        List configuration bundles
  update      update configuration bundle

Flags:
  -h, --help   help for bundle

Use "arlonctl bundle [command] --help" for more information about a command.
```

{% endtab %}
{% endtabs %}

### profile

arlonctl profile is used to create profiles which in turn will be used to deploy the clusters in following steps. This is a command which has been inherited from arlon CLI.

{% tabs %}
{% tab title="Bash" %}

```bash
arlonctl profile     
Usage:
  arlonctl profile [flags]
  arlonctl profile [command]

Available Commands:
  create      Create profile
  delete      Delete profile
  list        List configuration profiles
  update      Update profile

Flags:
  -h, --help   help for profile

Use "arlonctl profile [command] --help" for more information about a command.
```

{% endtab %}
{% endtabs %}

### clusterspec

arlonctl clusterspec is used to create the specs with which the user wants to deploy the cluster. User can use the cluster specifications which they created while deploying the cluster. This command has been inherited from Arlon CLI.

{% tabs %}
{% tab title="Bash" %}

```bash
$ arlonctl clusterspec --help
Manage cluster specifications

Usage:
  arlonctl clusterspec [flags]
  arlonctl clusterspec [command]

Available Commands:
  create      Create clusterspec
  delete      Delete clusterspec
  list        List configuration clusterspecs
  update      Update clusterspec

Flags:
  -h, --help   help for clusterspec

Use "arlonctl clusterspec [command] --help" for more information about a command.
```

{% endtab %}
{% endtabs %}

### clustertemplate

arlonctl clustertemplate is used to prepare and validate the manifest file which have been uploaded in the git repository to create the cluster. This command has been inherited from the Arlon CLI

{% tabs %}
{% tab title="Bash" %}

```bash
$ arlonctl clustertemplate --help
Manage base clusters

Usage:
  arlonctl basecluster [flags]
  arlonctl basecluster [command]

Available Commands:
  prepare     prepare base cluster
  preparegit  prepare base cluster directory in git
  validate    validate base cluster file
  validategit validate base cluster directory in git

Flags:
  -h, --help   help for basecluster

Use "arlonctl basecluster [command] --help" for more information about a command.
```

{% endtab %}
{% endtabs %}

### cluster

arlonctl cluster command is used to manage the clusters. We can deploy the clusters using the available command in the arlonctl cluster. This command as well is inherited from arlon OSS CLI and works same as in Arlon CLI

{% tabs %}
{% tab title="Bash" %}

```bash
$ arlonctl cluster --help
Manage clusters

Usage:
  arlonctl cluster [flags]
  arlonctl cluster [command]

Available Commands:
  create      create new cluster from a base
  delete      delete existing cluster and all related resources
  deploy      deploy new cluster
  get         get information about existing cluster
  list        List the clusters managed by Arlon
  manage      manage external cluster with specified profile
  ngupdate    update existing next-gen cluster
  unmanage    unmanage external cluster
  update      update existing cluster

Flags:
  -h, --help   help for cluster

Use "arlonctl cluster [command] --help" for more information about a command.
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.platform9.com/managed-kubernetes/5.7/profile-engine-with-arlon/arlonctl.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
