Installing plug-ins

To install plug-ins, you first create a manifest that contains the names and locations of the plug-ins that you want to install. You then create a secret that includes the manifest contents. If Site Planner is running, you restart the Site Planner pods.

Optional: Building a wheel file

If you want to install a custom plug-in that you developed, you must first build a wheel file by completing the following steps:
  1. On the server where the plug-in is located, install the wheel Python package by running the following command:
    python3 -m pip install wheel
  2. In the directory that contains your plug-in's setup script, that is, setup.py, build the wheel file by running the following command:
    python3 setup.py bdist_wheel

    The wheel file, which is called <plug-in-name>.whl, is created in the /dist directory.

  3. Upload the wheel file to a server that supports HTTP access.

Creating a manifest

A manifest is a YAML list of the plug-ins that you want and where they can be downloaded from. The manifest must contain entries for the following items:
  • Each plug-in that you want to install. You add these entries in the plugins section.
  • Any components, such as Python libraries, that the plug-in depends on. You add these entries in the dependencies section in the same format that you use for the plugins entries.
Create a YAML file to contain the manifest. When you add the manifest entries, ensure that each entry contains the information that is described in the following table:
Key Value
name The name of the plug-in. This value must match the plug-in's Python package name, which is usually configured in the plug-in's setup script, that is, setup.py.
url The HTTPS location of the plug-in's wheel file, that is, <plug-in-name>.whl.
headers The headers that are added to the HTTP GET request to download the wheel file. This value contains the required authorization credentials to download the file from a secure location, for example:
Authorization: "token: <your-GitHub-token>"
basic-auth The required username and password to download the wheel file. Use these attributes instead of the headers attributes if only basic authentication credentials are required.
For example, the following manifest contains the details of the netbox-qr-code plug-in and the qrcode library that it depends on:
plugins:

- name: netbox-qrcode
  url: https://example.com/netbox_qrcode-0.0.7-py3-none-any.whl
  headers:
    Authorization: "token 12345678910111213141516"

dependencies:

- name: qrcode 
  url: https://example.com/qrcode-7.4.dev0-py3-none-any.whl
  headers:
    Authorization: "token 12345678910111213141516"

Creating a secret that includes the manifest contents

After you create the manifest, create a secret that includes the manifest contents by completing the following steps:
  1. Convert the manifest contents to the Base64 format by using an online conversion tool, such as the Online YAML Tools Base64 converter.
  2. In the project where the Site Planner pods are located, create a secret that includes the following information:
    apiVersion: v1
    data:
     plugins.yaml: <Base64-encoded manifest contents>
    kind: Secret
    metadata:
      labels:
        app: siteplanner
        app.kubernetes.io/instance: orchestration-default
        app.kubernetes.io/managed-by: orchestration-default
        app.kubernetes.io/name: orchestration-default
        siteplanner_cr: default
      name: cp4na-o-siteplanner-plugins-secret
      namespace: lifecycle-manager
    type: Opaque
  3. In the orchestration component's custom resource (CR) YAML file, in the spec.advanced.siteplanner.pluginsSecret setting, specify the name of the new secret:
        advanced:
          siteplanner:
            pluginsSecret: cp4na-o-siteplanner-plugins-secret

By creating this secret and adding it to the orchestration component's CR, you ensure that when you restart Site Planner, the plug-ins that you specified are installed.

Restarting Site Planner

If your Site Planner instance is running, delete the Site Planner pods. The pods automatically restart and the plug-ins and dependencies that you specified in the manifest are installed.