1 - Getting-Started

1.1 - Release Notes

Changelog KOSI 2.9.2

Fixed

  • Fixed an issue in push - command, which caused a missleading error message.
  • Fixed an issue in the housekeeping functionality, that prevent working properly.

Changelog KOSI 2.9.2_Beta0

Fixed

  • Fixed an issue where KOSI was still running successfully even if a image could not be pulled
  • Fixed an issue where images where only pushed once
  • Fixed an issue where update could be executed with an invalid deployment name
  • Fixed an issue where delete could be executed with an invalid deployment name

Changelog KOSI 2.9.1

Update

  • update nuget packages
  • update kosi plugin

Changelog KOSI 2.9.0

New

  • SINA renamed to KOSI
  • new code format for creating packages named package.kosi
  • added the possibility to use sha tag values.
  • added an image-clean-up if you use retagging in KOSI
  • added KOSI remove - command, for removing your own packages from the hub
  • added checking syntax of new package.kosi and lint for package.yaml

1.2 - About Kosi

What is KOSI?

KOSI is a specially designed software installer for Kubernates cluster. It helps you define, install, and manage self-contained packages for Kubernetes. These packages can be configured for different needs.

Why to use KOSI?

KOSI , with its usability inspired by helm, enables software developers to create packages. You can include many artifacts and the necessary dependencies in one single KOSI package. At the time of software deployment into your environments you only need to download this package from KubeOps hub. All relevant dependencies are managed by KOSI insuring installation.

This makes the process of installing software with KOSI into your cluster simplified, secure and flawless.

Highlights

  • KOSI is beneficial over other package managers due to its unique feature of assisting you to bundle images along other artifacts in the package.

  • KOSI due to its ability to produce single self-sufficient package eliminates the chances of human errors caused due to Manual Processing in software deployment.

  • KOSI provides you the pre-built plugins along which enable to execute few most common tasks through KOSI packages. You can also easily access other plugins through our KubeOps hub.

  • KOSI facilitates you to deliver your software through KOSI even in the complex environments where outgoing proxy preventing broad access to the internet.

  • KOSI is compatible with Helm and docker.

Click here to download and get started with KOSI now.

1.3 - Quickstart

How to install KOSI

This quickstart shows you how to install KOSI. KOSI can be downloaded only from our official website.

Install KOSI as user

Prerequisites

Before you begin, check the following prerequisites:

  1. A machine with any of the following operating systems
  • RHEL 8
  • openSUSE or SUSE Linux Enterprise Server Version 15 SP3
  1. You must have Helm installed on your machine.

Refer Helm Official Documentation for Installation Guide.

  1. For KOSI versions you must have installed Podman on your machine.

Note : Before installing podman, make sure that The number of user namespaces (max_user_namespaces) is specified on your system if you are a non root-user.
For more information, follow this Github link

To install podman on your OS use command:

dnf install podman
zypper install podman

Important: Only supports secure registries. If you use an insecure registry, it is important to list your registry as an insecure registry in registry.conf (/etc/containers/registries.conf).

Installation Steps

Every release of KOSI provides a rpm file for manual installation. You need to login into your KubeOps account to download the file.

  1. Create an KubOps account on the KubeOps website if you don’t have already and login into your account.

  2. Download your desired version of KOSI .rpm file from our official download page https://kubeops.net/products/downloads/kosi-downloads-en

  3. Install the KOSI rpm on master node or admin node (recommended).

    dnf install <path to rpm>/<kosi file name>
    zypper install <path to rpm>/<kosi file name>

path to rpm : the directory path in which the file is available.
kosi file name : the exact file name of the file with .rpm extension.

Check Installation

You can check if the kosi is installed correctly on your machine simply with command kosi version.

kosi version

If the output indicates kosi version and relative information, KOSI is installed successfully.

For example the output should look like

KOSI version: 2.9.0_Alpha0_1701852856
This work is licensed under Creative Commons Attribution - NoDerivatives 4.0 International License(see https://creativecommons.org/licenses/by-nd/4.0/legalcode for more details).
©KubeOps GmbH, Hinter Stöck 17, 72406 Bisingen - Germany, 2022

Create a KOSI package

If you have installed KOSI on your machine, you can not only download and install packages, you can also create your own packages.

Create a KOSI package

Upgrade to newer KOSI version

If you have already installed KOSI on your machine and want to upgrade to a newer version, please install the new version with same steps mentioned above.

Once you have successfully installed KOSI, you are ready to use KOSI.
Update KOSI

2 - How to Guides

2.1 - How to install KOSI as a user

How to install KOSI as a user

This guide shows you how to install KOSI as a user. KOSI can be downloaded only from our official website.

Prerequisites

Before you begin, check the following prerequisites:

  1. A machine with any of the following operating systems

    • RHEL 8
    • openSUSE or SUSE Linux Enterprise Server Version 15 SP3
  2. You must have Helm installed on your machine.

    Refer Helm Official Documentation for Installation Guide.

  3. For KOSI versions you must have installed Podman on your machine.

    Note : Before installing podman, make sure that The number of user namespaces (max_user_namespaces) is specified on your system if you are a non root-user.
    For more information, follow this Github link

To install podman on your OS use command:

dnf install podman
zypper install podman

Important: Only supports secure registries. If you use an insecure registry, it is important to list your registry as an insecure registry in registry.conf (/etc/containers/registries.conf).

Installation Steps

Every release of KOSI provides a rpm file for manual installation. You need to login into your KubeOps account to download the file.

  1. Create an KubOps account on the KubeOps website if you don’t have already and login into your account.

  2. Download your desired version of KOSI .rpm file from our official download page https://kubeops.net/products/downloads/kosi-downloads-en

  3. Install the KOSI rpm on master node or admin node (recommended).

    dnf install <path to rpm>/<kosi file name>
    zypper install <path to rpm>/<kosi file name>

path to rpm : the directory path in which the file is available.
kosi file name : the exact file name of the file with .rpm extension.

$KUBEOPSROOT Variable

The $KUBEOPSROOT environment variable stores the location of the KOSI plugins, deployment.yaml and the config.yaml. To use the variable,the deployment.yaml, the config.yaml and the plugins have to be copied manually.
So for example:

echo 'export KUBEOPSROOT=/<home folder of user>/kubeops' >> $HOME/.bashrc
source $HOME/.bashrc
cp -r /var/kubeops/kosi/config.yaml /home/<user>/kubeopsrootdir/kosi/config.yaml
cp -r /var/kubeops/kosi/config.yaml /home/<user>/kubeopsrootdir/kosi/deployment.yaml
rm -rf /var/kubeops/kosi
cp -r /var/kubeops/plugins /home/<user>/kubeopsrootdir/plugins
rm -rf /var/kubeops/plugins

For a clean installation it is not neccessary to move the deployment.yaml

Check Installation

You can check if the kosi is installed correctly on your machine simply with command kosi version.

kosi version

If the output indicates kosi version and relative information, KOSI is installed successfully. For example the output should look like

KOSI version: 2.9.0_Alpha0_1701852856
This work is licensed under Creative Commons Attribution - NoDerivatives 4.0 International License(see https://creativecommons.org/licenses/by-nd/4.0/legalcode for more details).
©KubeOps GmbH, Hinter Stöck 17, 72406 Bisingen - Germany, 2022

2.2 - How to build a KOSI package

How to build your own KOSI package

This guide shows you how to create a KOSI package. KOSI can be downloaded only from our official website.

Prerequisites

Before you begin, check the following prerequisites:

  1. A machine with any of the following operating systems
    • RHEL 8
    • openSUSE
  2. Vi, VIM, Nano or other text editors
  3. An internet-connection for downloading images or helmcharts.
  4. All Prerequisits for the KOSI installation

The package base

With kosi create - command we generate all base components for building our own package.

kosi create

Output:

2024-03-25 13:29:40 Info:      KOSI version: 2.9.1_1709213374
2024-03-25 13:29:41 Info:      Write package.kosi to /root/demo
2024-03-25 13:29:41 Info:      Write template.yaml to /root/demo
2024-03-25 13:29:41 Info:      Write logo.png to /root/demo
2024-03-25 13:29:41 Info:      Write docs.tgz to /root/demo

The package logic

The logic of the package is in the package.kosi. For building the package you need some additional files like a helm chart and a valuestemplate.yaml - file. In this case all defaultvalues from the bitnami helmchart of wordpress are used. For the transfer into the package, a simple valuestemplate.yaml is needed.

A valuestemplate.yaml

{{values}}

A helm chart is needed as well. Download the bitnami worpress helm chart from the ArtifactHUB and prepare your values.yaml from the defaultvalues. You get both here.

A helmchart and values

helm repo add bitnami https://charts.bitnami.com/bitnami
helm pull bitnami/wordpress --version 21.0.6

This chart is not for production. It is only for demo purposes.

In the following example, the chart and the valuestemplate.yaml are added to the package.kosi. For transfering the values, you need to call the template plugin, there you have to set the tmpl file and a target. Advanced templating makes it possible to split one large value files into smaller ones. In this case we use some of the defaultvalues but all values will be transfered.
For executing the helm install/upgrade operation, the helm plugin has to be called and for the values the target-file is needed.
You can also write update and remove operations for your package like in the example.
In the remove section a clean is done. with the helm plugin the helm deployment is removed and the cmd plugin call will remove the namespace.

A package.kosi example

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "wordpressdemo";
description = "Deploys a wordpress helm chart";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  wordpressvaluestemplate= "valuestemplate.yaml";
  chart = "wordpress-21.0.6.tgz";
}


install
{
    template(tmpl='"valuestemplate.yaml"';target='"wordpressvalues.yaml"');
    helm(command='"upgrade"';tgz='"wordpress-21.0.6.tgz"';values='["wordpressvalues.yaml"]';deploymentName='"wordpressdemo"';namespace='"wordpressdemo"';flags='["--create-namespace"," --install"]');
}

update
{
   template(tmpl='"valuestemplate.yaml"';target='"wordpressvalues.yaml"');
    helm(command='"upgrade"';tgz='"wordpress-21.0.6.tgz"';values='["wordpressvalues.yaml"]';deploymentName='"wordpressdemo"';namespace='"wordpressdemo"';flags='["--create-namespace"," --install"]');
}

delete
{
    cmd(command='"echo delete worpressdemo helm deployment."');
    helm(command='"delete"';deploymentName='"worpressdemo"';namespace='"wordpressdemo"';flags='["--wait"]');
    cmd(command='"echo delete worpressdemo namespace."');
    cmd(command='"kubectl delete namespace wordpressdemo"');
}

For more information about the package.kosi Click here.

Build the package

If the package.kosi is finished, the package can be built. In the build process a package.tgz and package.yaml are created. For building a kosi-package simply use the kosi build command.

kosi build

The package.yaml is only generated once, if it is not available. If the package.yaml already exists the package.yaml will not be generated.

Install the package

To install the package.tgz you need the package itself and some values. In this case some values from the defaultvalues of the chart are used. For this a values.yaml is created.

A values.yaml example

global:
  storageClass: rook-cephfs
service:
  type: NodePort
  nodePorts:
    http: 30123
mariadb:
  enabled: true
  auth:
    rootPassword: topsecretChangeMe
    password: secretChangeMe
  primary:
    persistence:
      enabled: true
      storageClass: rook-cephfs
      accessModes:
        - ReadWriteOnce
persistence:
  enabled: true
  storageClass: rook-cephfs

For installing the package simply use the kosi install command.
The -p parameter is set for a local package.
The -f parameter is set to hand over value files to the package.

kosi install -p package.tgz -f values.yaml

In this case the output of the chart describe your next steps.

kosi install -p package.tgz -f values1.yaml
2024-03-26 10:47:34 Info:      KOSI version: 2.9.2
2024-03-26 10:47:35 Info:      template write to /var/kubeops/kosi/e628d035-4700-4f55-a9ac-ab9217b8e79f/wordpressvalues.yaml
2024-03-26 10:47:35 Info:      run cmd plugin
2024-03-26 10:47:35 Info:      use plugin bash if available
2024-03-26 10:47:35 Info:      Executing with non sudo privilegs
2024-03-26 10:47:36 Info:      Release "wordpressdemo" does not exist. Installing it now.
NAME: wordpressdemo
LAST DEPLOYED: Tue Mar 26 10:47:35 2024
NAMESPACE: wordpressdemo
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
CHART NAME: wordpress
CHART VERSION: 21.0.6
APP VERSION: 6.4.3

** Please be patient while the chart is being deployed **

Your WordPress site can be accessed through the following DNS name from within your cluster:

    wordpressdemo.wordpressdemo.svc.cluster.local (port 80)

To access your WordPress site from outside the cluster follow the steps below:

1. Get the WordPress URL by running these commands:

   export NODE_PORT=$(kubectl get --namespace wordpressdemo -o jsonpath="{.spec.ports[0].nodePort}" services wordpressdemo)
   export NODE_IP=$(kubectl get nodes --namespace wordpressdemo -o jsonpath="{.items[0].status.addresses[0].address}")
   echo "WordPress URL: http://$NODE_IP:$NODE_PORT/"
   echo "WordPress Admin URL: http://$NODE_IP:$NODE_PORT/admin"

2. Open a browser and access WordPress using the obtained URL.

3. Login with the following credentials below to see your blog:

  echo Username: user
  echo Password: $(kubectl get secret --namespace wordpressdemo wordpressdemo -o jsonpath="{.data.wordpress-password}" | base64 -d)

WARNING: There are "resources" sections in the chart not set. Using "resourcesPreset" is not recommended for production. For production installations, please set the following values according to your workload needs:
  - resources
+info https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/

2024-03-26 10:47:36 Info:      Helm upgrade successfully.
2024-03-26 10:47:36 Info:      Installation successful

2.3 - How to install and access the Plugins from the Hub

How to access the Plugins

Note : Be sure you have a supported KOSI version 2.4.0 or higher.
All plugins are available as KOSI packages in the KubeOpsHub. Our plugins are grouped into several KOSI packages described below. To see our KOSI packages in the KubeOpsHub use the command:

KOSI Basic Plugins Version 1.4.0

kosi search --hub kosi-basic
[root@cluster2admin1 ~]# kosi search --hub kosi-basic
2024-04-09 10:01:40 Info:      KOSI version: 2.9.1_1709213374
| User | Name          | Version | Description        | Install                  |
|------|---------------|---------|--------------------|--------------------------|
| kosi | basic-plugins | 1.4.0   | KOSI Basic Plugins | kosi/basic-plugins:1.4.0 | 

This are the plugins which the packages contains:

Plugin Version
template 1.4.0
helm 1.4.0
print 1.4.0

KOSI Professional Plugins Version 1.4.0

kosi search --hub kosi-professional
[root@cluster2admin1 ~]# kosi search --hub kosi-professional
2024-04-09 10:04:13 Info:      KOSI version: 2.9.1_1709213374
| User | Name                 | Version | Description               | Install                         |
|------|----------------------|---------|---------------------------|---------------------------------|
| kosi | professional-plugins | 1.4.0   | KOSI Professional Plugins | kosi/professional-plugins:1.4.0 |

This are the plugins which the packages contains:

Plugin Version
template 1.4.0
helm 1.4.0
print 1.4.0
kubectl 1.4.0
bash 1.4.0
cmd 1.4.0
sh 1.4.0
editfile 1.4.0
fprint 1.4.0
if 1.4.0
loop 1.4.0
kosi 0.4.3
merge 1.4.0

KOSI Enterprise Plugins Version 1.4.0

kosi search --hub kosi-professional
[root@cluster2admin1 ~]# kosi search --hub kosi-professional
2024-04-09 10:04:13 Info:      KOSI version: 2.9.1_1709213374
| User | Name                 | Version | Description               | Install                         |
|------|----------------------|---------|---------------------------|---------------------------------|
| kosi | professional-plugins | 1.4.0   | KOSI Professional Plugins | kosi/professional-plugins:1.4.0 |

This are the plugins which the packages contains:

Plugin Version
template 1.4.0
helm 1.4.0
print 1.4.0
kubectl 1.4.0
bash 1.4.0
cmd 1.4.0
sh 1.4.0
editfile 1.4.0
fprint 1.4.0
if 1.4.0
loop 1.4.0
kosi 0.4.3
merge 1.4.0
auditlog 1.4.0
chmod 1.4.0
copy 1.4.0
firewall 1.4.0
firewallD 1.4.0
containerd 1.4.0
containerruntime 1.4.0
hostname 1.4.0
iptables 1.4.0
kubeadm 1.4.0
osCheck 1.4.0
packagemanager 1.4.0
pia 1.4.0
service 1.4.0
sudo 1.4.0

How to install the Plugins

After installing the plugins with our kosi install Command, the plugins are automatically placed in the associated directory ($KUBEOPSROOT/plugins) and can be used directly.

kosi install --hub=<pluginhub> user/packagename:version

Example: The package basic-plugins of the user kosi with the version 1.4.0 is to be installed from the kosi-basic hub.

kosi install --hub=kosi-basic kosi/basic-plugins:1.4.0 
Note: You can also use the Install Tab from the Output to Help with Installation.

2.4 - How to update KOSI

How to update KOSI

This guide shows you how to update KOSI. KOSI can be downloaded only from our official website.

Prerequisites

Before you begin, check the following prerequisites:

  1. A machine with any of the following operating systems

    • RHEL 8
    • openSUSE or SUSE Linux Enterprise Server Version 15 SP3
  2. You must have Helm installed on your machine.

    Refer Helm Official Documentation for Installation Guide.

  3. For KOSI versions you must have installed Podman on your machine.

    Note : Before installing podman, make sure that The number of user namespaces (max_user_namespaces) is specified on your system if you are a non root-user.
    For more information, follow this Github link

To install podman on your OS use command:

dnf install podman
zypper install podman

Important: Only supports secure registries. If you use an insecure registry, it is important to list your registry as an insecure registry in registry.conf (/etc/containers/registries.conf).

Update Steps

Every release of KOSI provides a rpm file for manual installation. You need to login into your KubeOps account to download the rpm.

  1. Create an KubOps account on the KubeOps website if you don’t have already and login into your account.

  2. Download your desired version of KOSI .rpm file from our official download page https://kubeops.net/products/downloads/kosi-downloads-en

  3. Update the KOSI rpm on master node or admin node (recommended). You can it simply install the rpm and override the existan version.

    dnf install <path to rpm>/<kosi file name>
    zypper install <path to rpm>/<kosi file name>

path to rpm : the directory path in which the file is available.
kosi file name : the exact file name of the file with .rpm extension.

2.5 - How to template within the package.kosi

How to template within the package.kosi"

TBA

3 - Reference

3.1 - Fileformats

Fileformats in KOSI

This Guide shows you all the different kind of fileformats KOSI uses and how to use them.

KOSI config.yaml

Default-installation-location for: /var/kubeops/kosi/config.yaml
Location for usage: $KUBEOPSROOT/kosi/config.yaml

The config.yaml file contains all necessary files for networking and logging. For example, config.yaml contains the hub from which the packages are downloaded. If you have custom values for your config you have to put these in the $KUBEOPSROOT/kosi/config.yaml.
If KOSI can not find the config.yaml, it will use default like the example.

Example:

apiversion: kubernative/sina/config/v2                # Shows the supported API-Version
spec:                                            
  hub: https://hub.kubernative.net/v4/dispatcher/     # Adress to the KOSI online hub
  plugins: /kubeops/kosi/kosi-plugins/                # Location of the KOSI-Plugins
  workspace: /tmp/kosi/process/                       # Workspace Path 
  logging: info                                       # Loglevel options: info (default), warning, error, debug1, debug2, debug3
  housekeeping: true                                  # Housekeeping options: true (all temporary created files and images (-r flag) will be deleted), false (all temporary created files and images won't be deleted)

If you want to use your own Hub you can create a user-specific config.yaml file. The original file can be changed too, but it is not recommended.

KOSI values.yaml

In KOSI there are two ways to template values and one of them is using a values.yaml the other is using the template.yaml. In a normal values.yaml you can do value templating like in helm.

Example:

In the example is a package.kosi with an if-plugin call, where the condition is templated.

values.yaml

firstparam: 1
secondparam: 2

More information about the if-plugin can be find here if-plugin Reference.

package.kosi

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files = 
{
  input="template.yaml";
}

containers = 
{
    example=["docker.io", "nginx", "latest"];
}

install 
{
    cmd(command='"echo using if plugin"');
    if(condition='"{{values.firstparam}}<2"')
    then
    {
        cmd(command='"echo using templated values."')
        cmd(command='"echo {{values.firstparam}} is smaller than 2"');
    }
    else
    {
        cmd(command='"echo {{values.firstparam}} is bigger than 2"');
    }
}
More information about the KOSI language can be found here KOSI Language Reference.

KOSI template.yaml

In KOSI there are two ways to template values and one of them is using a template .yaml the other is using the values.yaml. This type of templating works with the template-plugin.

How-to How to use templating within the package.kosi.

For more information about the template syntax check the Scriban documentation (https://github.com/scriban/scriban/blob/master/doc/language.md) and try it out in the online demo (https://scribanonline.azurewebsites.net/).

Example:

package:
  file: {{package.includes.files.input}}

KOSI package.kosi

The package.kosi defines properties of a KOSI package (.tgz). A default package.kosi is created after a kosi create-command.

Metadata

There are a few metadata and they are mandatory.

Parameter Description
languageversion KOSI language version specification.
apiversion KOSI package version sepcification.
name Set the name of the package, which will displayed on the hub.
description Set the description of the package, which will displayed on the hub.
version Set the description of the package, which will displayed on the hub.
docs A Tgz with the documentation of the package, which contains Markdown files.
logo A PNG for a logo of the package.

IMPORTANT: Only use a fully lowercase as name for your package.
Note: Do not change name for logo.png and docs.tgz.
Note: Please name your markdown files inside docs.tgz without versions (docs/documentation-1.0.0.md).

The containers element is used for docker images. The methods which are used in the package.
The files element describes the files which are inluded in the KOSI package.
The installation tree describes the tasks (KOSI plugins), which are executed with the kosi install command.
The update tree describes the tasks (KOSI plugins), which are executed with the kosi update command.
The delete tree describes the tasks (KOSI plugins), which are executed with the kosi delete command.

Example

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    cmd(command='"touch ~/kosiExample1"');
}

update
{
    cmd(command='"touch ~/kosiExample2"');
}

delete
{
    cmd(command='"rm ~/kosiExample1"');
    cmd(command='"rm ~/kosiExample2"');
}
More information about the KOSI language can be find here KOSI Language Reference.

KOSI package.yaml

The package.yaml defines properties of a KOSI package (.tgz). A package.yaml is created after a kosi build-command with a valid package.kosi file.

Metadata

There are a few metadata and they are mandatory.

Parameter Description
languageversion KOSI language version specification.
apiversion KOSI package version sepcification.
name Set the name of the package, which will displayed on the hub.
description Set the description of the package, which will displayed on the hub.
version Set the description of the package, which will displayed on the hub.
docs A Tgz with the documentation of the package, which contains Markdown files.
logo A PNG for a logo of the package.

IMPORTANT: Only use a fully lowercase as name for your package.
Note: Do not change name for logo.png and docs.tgz.
Note: Please name your markdown files inside docs.tgz without versions (docs/documentation-1.0.0.md).

The includes.containers element is used for docker images. The methods which are used in the package.
The includes.files element describes the files which are inluded in the KOSI package.
The installation tree describes the tasks (KOSI plugins), which are executed with the kosi install.tasks command.
The update.tasks tree describes the tasks (KOSI plugins), which are executed with the kosi update command.
The delete.tasks tree describes the tasks (KOSI plugins), which are executed with the kosi delete command.

# languageversion: "0.1.0"
apiversion: "kubernative/kubeops/sina/user/v3"
name: "kosi-example-packagev3"
description: "kosi-example-package"
version: "0.1.0"
docs: "docs.tgz"
logo: "logo.png"
includes:
  files:
    input: "template.yaml"
  containers:
    example:
      registry: "docker.io"
      image: "nginx"
      tag: "latest"
installation:
  tasks:
    - cmd:
        command: "touch ~/kosiExample1"
update:
  tasks:
    - cmd:
        command: "touch ~/kosiExample2"
delete:
  tasks:
    - cmd:
        command: "rm ~/kosiExample1"
    - cmd:
        command: "rm ~/kosiExample2"

KOSI package.tgz

The KOSI package contains all metadata and installation, update and delete tasks. A package.tgz is created after a kosi build-command with a valid package.kosi file. The package.tgz is the artefact that will pushed on the KubeOpsHub. There are some default files, that are always included in the KOSI package, beside your included files.
A package.tgz is created after a kosi build-command with a valid package.kosi or package.yaml file.

Note: package.kosi will be preferred in the building process

File Description
docs.tgz A Tgz with the documentation of the package, which contains Markdown files.
logo.png A PNG for a logo of the package.
package.yaml KOSI language translated package.yaml for task. execution.
template.yaml KOSI template.yaml for templating values.

3.2 - KOSI Language Reference

This Guide explains the basic Structure of the package.kosi File using the if and cmd Plugins

package.kosi File

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files = 
{
  input="template.yaml";
}

containers = 
{
    example=["docker.io", "nginx", "latest"];
}

install 
{
    cmd(command='"echo using if plugin"');
    if(condition='"{{values.firstparam}}<2"')
    then
    {
        cmd(command='"echo using templated values."')
        cmd(command='"echo {{values.firstparam}} is smaller than 2"');
    }
    else
    {
        cmd(command='"echo {{values.firstparam}} is bigger than 2"');
    }
}
More information about each KOSI Plugin and their use can be found here Plugins.

Metadata

There are a few metadata and they are mandatory.

Parameter Description
languageversion KOSI language version specification.
apiversion KOSI package version sepcification.
name Set the name of the package, which will displayed on the hub.
description Set the description of the package, which will displayed on the hub.
version Set the description of the package, which will displayed on the hub.
docs A Tgz with the documentation of the package, which contains Markdown files.
logo A PNG for a logo of the package.
files = 
{
  input="template.yaml";
}

The includes.files element describes the files which are inluded in the KOSI package.

containers = 
{
    example=["docker.io", "nginx", "latest"];
}

The includes.containers element is used for docker images. The methods which are used in the package.

file =
{
  install 
{
    cmd(command='"echo using if plugin"');
    if(condition='"{{values.firstparam}}<2"')
    then
    {
        cmd(command='"echo using templated values."')
        cmd(command='"echo {{values.firstparam}} is smaller than 2"');
    }
    else
    {
        cmd(command='"echo {{values.firstparam}} is bigger than 2"');
    }
}
}

In this section the logic of the used Pulgins is described.

The cmd Plugin is for executing commands in the commandline and the if Plugin is for creating conditions, under which other plugins are executed.

The main used Trees are Install for installing a new package, Update for updating Packages and Uninstall for uninstalling packages.

3.3 - Full Documentation KOSI-2.9.x

KubeOps KOSI

How to use KOSI

This guide explains how to use KOSI with detailed instructions and examples.

General commands

Overview of all KOSI commands

kosi:
  Kosi is a SoftwareINstAller for kubernetes cluster

Usage:
  Kosi [options] [command]

Options:
  --version         Show version information
  -?, -h, --help    Show help and usage information

Commands:
  login                    logs you in
  search                   Shows you all the available packages on the softwarehub
  build                    Creates your final kosi.package
  push                     Push package.tgz to KubeOps Hub.
  pull <package>           Downloads an existing package from the hub without installing.
  install <packagename>    install a .tgz file and if it is required, download it
  update <packagename>     update a .tgz file and if it is required, download it
  delete <packagename>     run delete section of a .tgz file and if it is required, download it
  list                     List packages from storage
  lint                     lint your files for your .tgz package
  create                   Creates a package.kosi and a template.yaml for you to manipulate
  version                  Basic infos about KOSI
  logout                   Logout
  remove <package>         Gives you the possibility to remove packages from the hub, if you have write permissions.
  encrypt                  Gives you the possibility to encrypt your values with a password.
  check <hash>             check your local package hash

Command ‘kosi –help’

The command kosi --help gives you an overview of all available commands:

kosi --help

Alternatively, you can also enter kosi or kosi -? in the command line.

Command ‘kosi version’

The kosi version command shows you the current version of KOSI.

kosi version

The output should be:

[ 12/03/2021 10:13:20 Debug1  default ] Check OS Support...
[ 12/03/2021 10:13:20 Debug1  default ] set Loglevel info
Version: 2.9.0_Alpha0
This work is licensed under Creative Commons Attribution - NoDerivatives 4.0 International License(see https://creativecommons.org/licenses/by-nd/4.0/legalcode for more details).
©KubeOps GmbH, Hinter Stöck 17, 72406 Bisingen - Germany, 2022

Command ‘kosi create’

Note: The command works in the current directory.

The command kosi create creates four files (package.kosi, template.yaml, logo.png and docs.tgz) in the current directory. These files can be edited by the user.

The template.yaml is required if the template engine Scriban is to be used.

The logo.png is a package-thumbnail with the size of 50x50px

The docs.tgz is a zipped directory with the documentation of the package. The documentation of the package is written down in markdown. The file for the documentation is called readme.md.

Note: Please name your markdown files inside docs.tgz without a version-tag (docs/documentation-1.0.0.md).

kosi create

Created files:

  • package.kosi
  • template.yaml
  • logo.png - For showing logo on the KubeOpsHub.
  • docs.tgz - For showing documentation on the KubeOpsHub.

Command ‘kosi build’

Note: The command works in the current working directory.

Note: If you have no package.kosi file in your current working directory, KOSI will pick a package.yaml file.

Note: Name your package in the package.kosi in full lower case.

Note: Don´t change the name for logo.png and docs.tgz

Note: Please name your markdown files inside docs.tgz without a version-tag (docs/documentation-1.0.0.md).

IMPORTANT: Please name your packages without docker tags (:v1.0.0).

The kosi build command creates the necessary yaml files for building a package:

kosi build

All files specified in the package.kosi are combined together with the package.yaml to form a KOSI package.

The package.yaml is only generated once, if it is not available. If the package.yaml already exists the package.yaml will not be generated.

Command ‘kosi lint’

The kosi lint command is used to check whether the contents of the package.yaml file are valid:

kosi lint

Command ‘kosi login’

The kosi login command logs on to the KubeOps services. The account name is required for this command.

Note: To push packages into the hub, you need to create an account here first. Note: We recommend lowercase usernames for your kubeops-accounts.

After the flag -u type your username. Afterwards you will be asked to enter your password.

kosi login -u <username>

The parameter -p is used to enter the password in the command directly, but it is important to know that the password will be shown in plain text. This parameter can help with the automation of KOSI commands.

kosi login -u <username> -p <password>

-u flag

The -u parameter is used to specify the user name.

kosi login -u

This parameter is required.

-p flag

The -p parameter is used to specify the password.

kosi login -p

This parameter is not required. We recommend to use this parameter only if it is absolutely necessary.

Command ‘kosi logout’

The kosi logout command logs out from the KubeOps services.

Note: To logout from the KubeOps services, you have to be logged in.

kosi logout

Command ‘kosi push’

The kosi push command uploads KOSI packages to the KubeOps Hub:

kosi push --hub <hubname>

Note: In order to upload KOSI packages, you first have to log in using the kosi login command.

Note: The package name is case-sensitive and should be lowercase.

–hub flag

The --hub parameter is used to upload KOSI packets from a specific hub, e.g. in this example we upload our KOSI packet to the public hub.

kosi push --hub public

Command ‘kosi pull’

The kosi pull command downloads a specific KOSI package from the hub without installing it directly.

kosi pull --hub <hubname> <packagename> -o <desired name>

Note: kosi pull downloads the package to the current directory.

Note: The downloaded packages can be transferred to machines without internet access via USB, for example.

Note: The package name is case-sensitive and should be lowercase.

Example:

kosi pull --hub public donald/kosi-print-test:0.0.1 -o printpackage

Note: The -o option specifies a name that the package will have after download. The file automatically gets the .kosi extension. The -o option is not optional.

–hub flag

The --hub parameter is used to download KOSI packages to a specific hub, e.g. in this example we are pulling our KOSI package from the public hub.

kosi pull --hub public kubeops/harbor:1.1.0  

-r flag

The parameter r can be used to pull the docker images which are included in the package to a given local docker registry.

kosi pull --hub <hubname> <packagename> -o <desired name> -r <local.docker.registry>

Note: kosi pull downloads the package and pulls the required docker images to the given local docker registry.

Example:

kosi pull --hub public kubeops/harbor:1.1.0   -o harborpackage -r 127.0.0.1:5000

Note: After the kosi pull kubeops/harbor:1.1.0 -o printpackage -r 127.0.0.1:5000 command you can use kosi install -p printpackage.tgz to use the docker image from your local docker registry.

Note: You can now install your packages including docker images without internet connection from your local machine.

-t flag

For the szenario that the registry of the cluster is exposed to the admin via a network internal domain name, but this name can’t be resolved by the nodes, the flag -t can be used, to use the cluster internal hostname of the registry.

kosi pull --hub <hubname> <packagename> -o <desired name> -r <local.docker.registry> -t <cluster.internal.registry>

Note: local.docker.registry is the same registry as cluster.internal.registry but with a different hostname.

Example:

kosi pull --hub public kubeops/harbor:1.1.0 -o harborpackage -r myregistry:5000 -t clusterregistry:5000

IMPORTANT: -t flag can only be used in combination with the -r flag.

KOSI_retag_registry

The kosi search command displays all available packages of your own private hub. Only the logged in user can see the packages on his private hub. The User column contains the name of the creator of the package.
The Name column contains the name of the package.
The Version column contains the version of the package.
The Description column contains the description of the package.
The Install column contains a string consisting of the name of the creator, name and version of the package. This string can be copied and used for the kosi install command.

kosi search --hub <hubname>

Example: User donald is logged in and wants to get the packets from his private hub:

kosi search --hub donald
| User   | Name         | Version | Description                      |Install                    |
|--------|--------------|---------|----------------------------------|---------------------------|                  
| donald | private-kosi | 0.0.1   | private installation             | donald/private-kosi:0.0.1 |                                       
| donald | private-test | 0.0.1   | private package                  | donald/private-test:0.0.1 |
| donald | livedemo     | 2.7.2   | welcome to kosi                  | donald/livedemo:2.7.1     | 

–ps flag

The --ps parameter can be used to filter for keywords that refer to all five columns. It is also possible to filter by individual word components:

kosi search --hub <hubname> --ps <name>

Example:
In this case, all packets containing the word private are displayed:

kosi search --hub donald --ps private
| User   | Name         | Version | Description                      |Install                    |
|--------|--------------|---------|----------------------------------|---------------------------|                  
| donald | private-kosi | 0.0.1   | private installation             | donald/private-kosi:0.0.1 |                                       
| donald | private-test | 0.0.1   | private package                  | donald/private-test:0.0.1 |                                        

–hub flag

In addition, there is an option to search for packages on a specific hub using the --hub parameter. You need no login to search in the public hub.

kosi search --hub public
| User   | Name         | Version | Description                      |Install                  |
|--------|--------------|---------|----------------------------------|-------------------------|
| kosi   | lima         | 0.6.2   | installs LIMA                    | kosi/lima:0.6.2         |
| kosi   | installation | 0.0.1   | kosi create example package.yaml | kosi/installation:0.0.1 |  
| donald | elk-kosi     | 0.0.1   | ELK installation                 | donald/elk-kosi:0.0.1   |
| donald | prod-test    | 0.0.1   | test for prod                    | donald/prod-test:0.0.1  | 
| lima   | lima         | 0.6.0   | installs LIMA                    | lima/lima:0.6.0         |
                                     

The parameters --hub and --ps can be combined for a targeted search in the kosi hub:

kosi search --hub <hubname> --ps <package_name>

Example:
The user kosi wants to display all packages in the kosi hub with the term “lima”.

kosi search --hub kosi  --ps lima
| User | Name         | Version | Description                      |Install                  |
|------|--------------|---------|----------------------------------|-------------------------|
| kosi | lima         | 0.6.2   | installs LIMA                    | kosi/lima:0.6.2         |
| kosi | lima         | 0.7.1   | installs LIMA                    | kosi/lima:0.7.1         |
                                     

Command ‘kosi encrypt’

The kosi encrypt command is used to encrypt YAML files with AES-256-CBC:

-f flag

The parameter -f must be used to use yaml files from the user.

This parameter is required.

kosi encrypt -f <user.yaml>

Note: The -f parameter can be specified any number of times to use any number of files.

kosi encrypt -f userfile1.yaml -f userfile2.yaml -f userfile3.yaml

Command ‘kosi install’

The kosi install command installs a KOSI package:

kosi install --hub <hubname> <package>

The string of the column Install in the output of kosi search is required:

Example: The package livedemo of the user kosi with version 2.7.1 is to be installed from the private Hub:

kosi install --hub public kosi/livedemo:2.7.1 

–hub flag

The --hub parameter must be used to install packages from the software hub. Only the logged in user can install the packages from the software hub.

kosi install --hub <hubname> <package>

Example: The package livedemo of the user kosi with version 2.7.1 is to be installed from the public Software Hub:

kosi install --hub public kosi/livedemo:2.7.1

-p flag

The “p” parameter must be used to install local packages. For “p” parameter you need no --hub:

kosi install -p package.kosi

-f flag

The parameter f must be used to use .yaml files from the user.

kosi install <package> -f <user.yaml>

Example: The package livedemo of the user kosi with version 2.7.1 is to be installed from the public software hub and user specific files are to be used for the installation:

kosi install --hub public kosi/livedemo:2.7.1 -f userfile1.yaml -f userfile2.yaml -f userfile3.yaml

Note: The -f parameter can be specified any number of times to use any number of files. Note: The -f parameter can also be combined with the --hub parameter.

–cf flag

The parameter --cf must be used to use encrypted yaml files from the user.

kosi install <package> --cf <encryptedUser.yaml>

Example: The package livedemo of the user kosi with version 2.7.1 is to be installed from the public software hub and user specific encrypted files are to be used for the installation:

kosi install --hub public kosi/livedemo:2.7.1 --cf encryptedUserfile1.yaml --cf encryptedUserfile2.yaml --cf encryptedUserfile3.yaml

Note: The --cf parameter can be specified any number of times to use any number of encrypted files.
Note: The --cf parameter can also be combined with the --hub parameter.
Note: The --cf parameter can also be combined with the -f parameter.

IMPORTANT: If you combine -f with --cf, you must specify the -f parameter first before specifying --cf!

Example:

kosi install --hub public kosi/livedemo:2.7.1 -f userfile1.yaml -f userfile2.yaml --cf encryptedUserfile1.yaml --cf encryptedUserfile2.yaml

–namespace flag

The namespace parameter can be used to specify a Kubernetes namespace in which the installation is to be performed.

kosi install --hub <hubname> <package> --namespace <namespace>

Example: The package livedemo of the user kosi with version 2.7.1 is to be installed from the public software hub and a custom kubernetes namespace is used:

kosi install --hub public kosi/livedemo:2.7.1 --namespace MyNamespace

Note: If no --namespace parameter is specified, the namespace default will be used.

–dname flag

The parameter dname can be used to save the package under a specific name.

kosi install --hub <hubname> <package> --dname <deploymentname>

Example: The package livedemo of the user kosi with version 2.7.1 is to be installed from the public software hub and a deployment name is set:

kosi install --hub public kosi/livedemo:2.7.1 --dname MyDeployment

Note: If no --dname parameter is specified, a random deployment name will be generated. Note: Deploymentnames are unique, the installation will stop if the deploymentname already exists.
Note: The deployment name is stored in the file /<user>/var/kubeops/kosi/deployment.yaml.

Command ‘kosi list’

The kosi list command lists all installed KOSI packages:

kosi list
 KOSI version: 2.9.0_preAlpha0
| Deployment       | Package                           | PublicHub | Hub    |
|------------------|-----------------------------------|-----------|--------|
| kosiinstallslima | kosi/lima:0.6.2                   |           | private|
| kosicreatetest   | kosi/kosi-create:0.0.1            |           | public |
| plugininstall    | local/kubeops-basic-plugins:0.4.0 |           | local  |

Command ‘kosi update’

The kosi update command updates an already installed KOSI package:

For update, the installation and the update package have to be the same name. Update will be defined in the package.yaml.

kosi update --hub <hubname> --dname <deploymentname> <package>

The string of the column Install in the output of kosi search is required:

Example: The installation of the package lima from the user kosi with version 0.6.2 and deployment name kosiInstallsLima is updated by a package from the private Software Hub from kosi.:

kosi update --hub public --dname kosiInstallsLima kosi/kosi/lima:0.6.2 

–hub flag

The --hub parameter must be used to update packages from the software hub. Only the logged in user can update the packages from the software hub.

kosi update --hub <hubname> <package>

Example: The package livedemo of the user kosi with version 2.7.1 is to be updated from the public Software Hub:

kosi update --hub public kosi/livedemo:2.7.1
```create:0.0.1

-p flag

The “p” parameter must be used to update the installation from a local package. For “p” parameter you need no --hub parameter:

kosi update -p package.tgz

-f flag

The parameter f must be used to use yaml files from the user.

kosi update --hub <hubname> <package> -f <user.yaml>

Example: The installation of the package livedemo of the user kosi with version 2.7.1 is updated by a package from the public software hub and user specific files are to be used for the update progress:

kosi update --hub public kosi/livedemo:2.7.1 -f userfile1.yaml -f userfile2.yaml -f userfile3.yaml

Note: The -f parameter can be specified any number of times to use any number of files. Note: The -f parameter can also be combined with the --hub parameters.

–cf flag

The parameter --cf must be used to use encrypted yaml files from the user.

kosi update --hub <hubname> <package> --cf <encryptedUser.yaml>

Example: The installation of the package livedemo of the user kosi with version 2.7.1 is updated by a package from the public software hub and user specific encrypted files are to be used for the update progress:

kosi update --hub public kosi/livedemo:2.7.1 --cf encryptedUserfile1.yaml --cf encryptedUserfile2.yaml --cf encryptedUserfile3.yaml

Note: The --cf parameter can be specified any number of times to use any number of encrypted files. Note: The --cf parameter can also be combined with the --hub parameter.
Note: The --cf parameter can also be combined with the -f parameter.

IMPORTANT: If you combine -f with --cf, you must specify the -f parameter first before specifying --cf!

Example:

kosi update --hub public kosi/livedemo:2.7.1 -f userfile1.yaml -f userfile2.yaml --cf encryptedUserfile1.yaml --cf encryptedUserfile2.yaml

–namespace flag

The namespace parameter can be used to specify a kubernetes namespace in which the update is to be performed.

kosi update --hub <hubname> <package> --namespace <namespace>

Example: The installation of the package livedemo of the user kosi with version 2.7.1 is updated by a package from the public software hub and a custom kubernetes namespace is used:

kosi update --hub public kosi/livedemo:2.7.1 --namespace MyNamespace

Note: If no --namespace parameter is specified, the default namespace will be used.

–dname flag

The parameter dname can be used to update the deployment by name.

kosi update --hub <hubname> <package> --dname <deploymentname>

Example: The installation of the package livedemo of the user kosi with version 2.7.1 is updated by a package from the public software hub and a deployment name is set:

kosi update --hub public kosi/livedemo:2.7.1 --dname MyDeployment

Command ‘kosi delete’

The kosi delete command deletes an already installed KOSI package:

For delete, the installation and the update package have to be the same name. Delete will be defined in the package.yaml.

kosi delete --hub <hubname> --dname <deploymentname> <package>

The string of the column Install in the output of kosi search is required:

Example: The installation of the package lima from the user kosi with version 0.6.2 and deployment name kosiInstallsLima is deleted by a package from the private Software Hub from kosi.:

kosi delete --hub public --dname kosiInstallsLima kosi/kosi/lima:0.6.2 

–hub flag

The --hub parameter must be used to use the delete section of packages from the software hub. Only the logged in user can use the delete section of packages from the software hub.

kosi delete --hub <hubname> <package>

Example: The package livedemo of the user kosi with version 2.7.1 is to be updated from the public Software Hub:

kosi delete --hub public kosi/livedemo:2.7.1
```create:0.0.1
```-create:0.0.1

-p flag

The “p” parameter must be used to delete the installation from a local package. For “p” parameter you need no --hub parameter:

kosi delete -p package.tgz

-f flag

The parameter f must be used to use yaml files from the user.

kosi delete --hub <hubname> <package> -f <user.yaml>

Example: The installation of the package livedemo of the user kosi with version 2.7.1 is deleted by a package from the public software hub and user specific files are to be used for the delete progress:

kosi delete --hub public kosi/livedemo:2.7.1 -f userfile1.yaml -f userfile2.yaml -f userfile3.yaml

Note: The -f parameter can be specified any number of times to use any number of files. Note: The -f parameter can also be combined with the --hub parameter.

–cf flag

The parameter --cf must be used to use encrypted yaml files from the user.

kosi delete --hub <hubname> <package> -f <encryptedUser.yaml>

Example: The installation of the package livedemo of the user kosi with version 2.7.1 is deleted by a package from the public software hub and user specific encrypted files are to be used for the delete progress:

kosi delete --hub public kosi/livedemo:2.7.1 -f encryptedUserfile1.yaml -f encryptedUserfile2.yaml -f encryptedUserfile3.yaml

Note: The --cf parameter can be specified any number of times to use any number of encrypted files. Note: The --cf parameter can also be combined with the --hub parameter.
Note: The --cf parameter can also be combined with the -f parameter.

IMPORTANT: If you combine -f with --cf, you must specify the -f parameter first before specifying --cf!

Example:

kosi delete --hub public kosi/livedemo:2.7.1 -f userfile1.yaml -f userfile2.yaml --cf encryptedUserfile1.yaml --cf encryptedUserfile2.yaml

–namespace flag

The namespace parameter can be used to specify a kubernetes namespace in which to perform the deletion.

kosi delete --hub <hubname> <package> --namespace <namespace>

Example: The installation of the package livedemo of the user kosi with version 2.7.1 is deleted by a package from the public software hub and a custom kubernetes namespace is used:

kosi delete --hub public kosi/livedemo:2.7.1 --namespace MyNamespace

Note: If no --namespace parameter is specified, the default namespace will be used.

–dname flag

The parameter dname can be used to delete the deployment by name.

kosi delete --hub <hubname> <package> --dname <deploymentname>

Example: The installation of the package livedemo of the user kosi with version 2.7.1 is deleted by a package from the public software hub and a deployment name is set:

kosi delete --hub public kosi/livedemo:2.7.1 --dname MyDeployment

Command ‘kosi remove’

The kosi remove command removes a KOSI package from the hub:

Note: Only logged users can delete there own packages. Users must have write-permissions.

kosi remove --hub <hubname> <package>

Note: the package you want to remove can be found in the output of the kosi search command, more precisely in the install column

Example: The package livedemo of the user kosi with version 2.7.1 will be removed from the public hub:

kosi remove --hub public kosi/livedemo:2.7.1 

Note: If your package already deleted, the command will try do delete your package successfully. Deleting non-existing packages does not cause any errors.

Command ‘kosi check’

The kosi check command is used to compare a local kosi package with a sha256 Checksum.

kosi check -p <localpackagename> <sha256 hash>

Example:

kosi check -p examplepackage c83f3db9639e175f82e7d07d342533866873e2d9ca2f0fd5ee607ea395417edb

File Formats

package.kosi

This file defines properties of the KOSI package. This file is created after the kosi create command. The package.kosi defines a package in a specific version as well as the tasks needed to install it. The tasks which are used in the package.yaml are plugins, which can be created by the user. The includes.containers element is used for docker images. A container for the docker images will be created when the kosi install, kosi update or kosi delete command is used. There is also a description, which will be shown in the kosi search command. The includes.files element describes the files which are inluded in the KOSI package. The installation.tasks tree describes the tasks (KOSI plugins), which are executed with the kosi install command. The update.tasks tree describes the tasks (KOSI plugins), which are executed with the kosi update command.The delete.tasks tree describes the tasks (KOSI plugins), which are executed with the kosi delete command.

IMPORTANT: To get your package please enter a fully lowercase name for your package.

Note: Do not change name for logo.png and docs.tgz

Note: Please name your markdown files inside docs.tgz without versions (docs/documentation-1.0.0.md).

IMPORTANT: Please name your packages without docker tags (:v1.0.0).

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    cmd(command='"touch ~/kosiExample1"');
}

update
{
    cmd(command='"touch ~/kosiExample2"');
}

delete
{
    cmd(command='"rm ~/kosiExample1"');
    cmd(command='"rm ~/kosiExample2"');
}

package.yaml

This file defines properties of the KOSI package. This file is created after the kosi build command. The package.yaml defines a package in a specific version as well as the tasks needed to install it. The tasks which are used in the package.yaml are plugins, which can be created by the user. The includes.containers element is used for docker images. A container for the docker images will be created when the kosi install, kosi update or kosi delete command is used. There is also a description, which will be shown in the kosi search command. The includes.files element describes the files which are inluded in the KOSI package. The installation.tasks tree describes the tasks (KOSI plugins), which are executed with the kosi install command. The update.tasks tree describes the tasks (KOSI plugins), which are executed with the kosi update command.The delete.tasks tree describes the tasks (KOSI plugins), which are executed with the kosi delete command.

IMPORTANT: The apiversion has been changed from …/user/v2 to …/user/v3. The Image Key has been split into to seperate Keys registry and image.

IMPORTANT: To get your package please enter a fully lowercase name for your package.

Note: Do not change name for logo.png and docs.tgz

Note: Please name your markdown files inside docs.tgz without versions (docs/documentation-1.0.0.md).

IMPORTANT: Please name your packages without docker tags (:v1.0.0).

# languageversion: "0.1.0"
apiversion: "kubernative/kubeops/sina/user/v3"
name: "kosi-example-packagev3"
description: "kosi-example-package"
version: "0.1.0"
docs: "docs.tgz"
logo: "logo.png"
includes:
  files:
    input: "template.yaml"
  containers:
    example:
      registry: "docker.io"
      image: "nginx"
      tag: "latest"
installation:
  tasks:
    - cmd:
        command: "touch ~/kosiExample1"
update:
  tasks:
    - cmd:
        command: "touch ~/kosiExample2"
delete:
  tasks:
    - cmd:
        command: "rm ~/kosiExample1"
    - cmd:
        command: "rm ~/kosiExample2"

default.yaml

The default.yaml in a package.tgz is used for setting default variables. In case you use the -f parameter in install, update or delete, the file which you address is merged with the default.yaml. If you have the same keys but different values in both files, your adressed file will overwrite the values set by the default.yaml.

config.yaml

Location for: /var/kubeops/kosi/config.yaml

The config.yaml file contains all necessary files for networking and logging. For example, config.yaml contains the hub from which the packages are downloaded.

apiversion: kubernative/kosi/config/v2           # Shows the supported API-Version
spec:                                            
  hub: https://hub.kubernative.net/dispatcher/      # Adress to the KOSI online hub
  plugins: /kubeops/kosi/kosi-plugins/                      # Location of the KOSI-Plugins
  registry: registry1.kubernative.net/             # Registry, where Docker-images will be pulled to (kosi pull)
  workspace: /tmp/kosi/process/                    # Workspace Path 
  logging: info                                    # Loglevel options: info (default), warning, error, debug1, debug2, debug3
  housekeeping: true                               # Housekeeping options: true (all temporary created folders will be deleted), false (all temporary created folders won't be deleted)

Usage

To keep KOSI running there has to be a valid config.yaml file.
After installing KOSI, a valid config.yaml file is created under the location /var/kubeops/kosi/config.yaml. If you want to use your own Hub you can create a user-specific config.yaml file. The original file can be changed too, but it is not recommended.

$KUBEOPSROOT Variable

The $KUBEOPSROOT environment variable stores the location of the KOSI plugins and the config.yaml. To use the variable, the config.yaml and the plugins have to be copied manually.
So for example:

cp -r /var/kubeops/kosi/config.yaml /home/<user>/kubeopsrootdir/kosi/config.yaml
rm -rf /var/kubeops/kosi
cp -r /var/kubeops/plugins /home/<user>/kubeopsrootdir/plugins
rm -rf /var/kubeops/plugins

If you want to use the config file and plugins with a user you have to go through these steps.

How to use templating within the package.kosi

This is an example of how templating in a package.kosi is working with kosi 2.9.x

First we need to create this package.kosi:

# languageversion: "0.1.0"
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    cmd(command='"echo using templatep plugin."');
    template(tmpl='{{package.includes.files.input}}';target='{{values.target}}');
}

update
{
    cmd(command='"touch ~/kosiExample2"');
    template(tmpl='{{package.includes.files.input}}';target='{{values.target}}');
}

delete
{
    cmd(command='"rm ~/kosiExample1"');
    cmd(command='"rm ~/kosiExample2"');
}

Now we create a template.yaml:

package:
  file: {{package.includes.files.input}}
  uservalues: {{values.example}}

Next we create a default.yaml:

example: example
target: target.yaml

Please make sure that you create all these files in the same directory.

Now we are ready to create a kosi package. For this we need the following command:

kosi build

Next we can run the installation section we have defined in the package.yaml with the following command:

kosi install -p package.tgz --dname example

We can check the result in the directory $KUBEOPSROOT/kosi/tmp.

The file of interest is the target.yaml. But most of the time this file is not in tmp Folder . In this case, type the command find / -name target.yaml to find the location of the target.yaml file.

the content of target.yaml is:

package:
  file: template.yaml
  uservalues: example

So what exactly happened?
In the package.yaml you can see that we use {{package.includes.files.input}} for defining the template.yaml as value for the key tmpl. You can use any value of the package.yaml but make sure that the path to the value is correct and starts with package.. This is the indicator for using a variable from the package.yaml.

You can also see that we use {{values.target}} for defining the target.yaml as value for the key target. If you wonder where the target.yaml is coming from you can check the default.yaml. If you want to use a variable from the default.yaml or from a file specified with the parameter -f make sure that the path to the value is correct and starts with values..

For more information about the template syntax check the Scriban documentation (https://github.com/scriban/scriban/blob/master/doc/language.md) and try it out in the online demo (https://scribanonline.azurewebsites.net/).

Plugins

With the installation of KOSI a handful of plugins are included. Which plugins are included can be seen under “pre-installed plugins” in the Plugin References

4 - Plugins

Plugin References

How to access the plugins

All plugins are available as KOSI packages in the KubeOpsHub. Our plugins are grouped into several KOSI packages described below. To see our KOSI packages in the KubeOpsHub use the command:

Search for kubeops-plugins

kosi search --ps kubeops --hub public

Install for kubeops-plugins

kosi install --hub=public <user/packagename:version> 

The plugins are automatically placed in the associated directory($KUBEOPSROOT/plugins) and can be used directly.

Plugin packages

In this section you can find the plugin packages and the documentation for each plugin.

4.1 - auditLog-1.4.0

Kosi Plugin auditLog Version 1.4.0

Summary

With the auditLog plugin you can enable or disable auditLog for your Kubernetes Cluster. The plugin supports the following usage:

Keys

Key Description
state Mandatory With the value “on” or “off” you can enable or disable the auditlogging for your Cluster.
policyPath Mandatory The path in which your policy.yaml is stored.
logPath Mandatory The path in which the audit.log will be stored.

Example 1 - enable auditLog

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    auditLog(state='"on"'; policyPath='"/root/test/policyDir/"';logPath='"/root/test/logging/"');
}

Example 2 - disable auditLog

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    auditLog(state='"off"'; policyPath='"/root/test/policyDir/"';logPath='"/root/test/logging/"');
}

4.2 - bash-1.4.0

KOSI Plugin bash Version 1.4.0

Summary

With the bash-Plugin the user is able to execute commands inside a bash-shell.

Examples

Key Description
command Mandatory set this to string of one or more commands.

Note: The command has to be surrounded by double quotes, otherwise it will not be recognized. You can append multiple commands seprated by a ;.

Example 1

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  guestbook= "guestbook.tgz";
  gbValues= "gbValues.yaml";
  values2= "values2.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    cmd(command='"echo Using the bash plugin."');
    bash(command='"echo Hello World!"');
}

Output

2023-12-01 10:32:28 Info:      use plugin bash if available
using the bash-plugin-update
Hello World!

Example 2

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  guestbook= "guestbook.tgz";
  gbValues= "gbValues.yaml";
  values2= "values2.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    cmd(command='"echo using the bash-plugin-update"');
    bash(command='"echo 1.Hello;echo 2.World;echo 3.Hello World."');
} 

Output

2023-12-01 10:32:28 Info:      use plugin bash if available
using the bash-plugin-update
1.Hello
2.World
3.Hello World.

4.3 - chmod-1.4.0

KOSI Plugin chmod Version 1.4.0

Summary

By specifying a path, state and mode you can change the acces permissioins for the given file or directory. The state value can be “file” or “directory”. In the later case a recursive directory traversal is performed. With mode the access permissions are specified in the numerical representation usual with linux.

Keys

Key Description
path Mandatory Set it to the absolute path of the file or directory whose access rights you want to change.
state Mandatory set it to “file” / “directory” depending upon the path is a file or directory.
mode Mandatory Set the permission mode of the file in classic numeric linux syntax. This plugin supports both three-digit and four-digit octal representation.
sudo optional Set it to use sudo for your chmod-command.If you set sudo.
sudoPassword optional Set it to give a sudoPassword.

Note: If you’re not yet familiar with Linux permissions, check out this short introduction from RedHat.

Example

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    cmd(command='"echo Using the chmod-plugin"');
    chmod(path='"/user/myuser/myUserApp.sh"';state='"file"';mode='"777"');
}

Example 2

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    cmd(command='"echo Using the chmod-plugin"');
    chmod(path='"/root/myRootApp.sh"';state='"file"';mode='"777"';sudo='"true"';sudoPassword='"myPassword"');
}

4.4 - cmd-1.4.0

KOSI Plugin cmd Version 1.4.0

Summary

The cmd command calls either the bash plugin (the plugin that executes commands in the bash terminal in linux), or if not available the sh plugin (the plugin that executes commands in the sh terminal in linux) and passes the parameters through.
This plugin also supports chaining of multiple commands with the semicolon ; as a divider.

Plugin dependencies

If you want to use the plugin cmd you need one of following plugins:

Keys

Key Description
command Mandatory set this to a command for the bash or the sh terminal .

Note: The command has to be surrounded by double quotes, otherwise it will not be recognized.

usage

Example 1 - Single commands

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    cmd(command='"echo Using the cmd-plugin"');
    cmd(command='"echo Hello World"');
}

Result

This will be printed to the console:

2023-12-01 10:44:30 Info:      use plugin bash if available
Using the cmd-plugin
Hello World

Example 2 - Multiple commands

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    cmd(command='"echo Using the cmd-plugin"');
    cmd(command='"echo Hello World! > test.txt; cat test.txt"');
}

Result

A file named test.txt is created and “Hello World!” is written to the file.
The second command outputs the contents of the file.

2023-12-01 11:06:17 Info:      run cmd plugin
Using the cmd-plugin
2023-12-01 11:06:17 Info:      run cmd plugin
Hello World!

4.5 - containerd-1.4.0

KOSI Plugin containerd Version 1.4.0

Summary

With the containerRunitme Plugin you can manage you containerRuntime. You can use options to ecexute commands with or without flags. Additionally its possible to gather information about the current containerRuntime status. The plugin supports the following usage:

Key Description
command Mandatory Will be the command you want to execute inside the container.
containerName - Will be the Name of the contianer you choose or the Name of the temporarily stored Name of the created cluster.*1
destImage - Will be the new image name for the tages srcImage.
execID - Will be the ID / Name of your execution.*2
flag - The value of the “flag” key stores information on which options you want to enable. You will have to confirm which flag the “option” of your command allows. Examples for ps are “-a or –all” for all or “-n or –last” for last of the list of container, you can append any number of flags, like in example 3.
sudo - Can be true or false. If it is true the Plugin will be executed with sudo privileges.
sudoPassword - If you use, sudoPassword will be mandatory.
srcImage - Will be the Image which you want to pull, push or tag.
option Mandatory Depending on which operation you want to execute select one of these as a variable of the key. Following example 1, if you want to execute a command like run, you take “option” as a key and “run” as a value.

The Values can be followed:

  • ps list all existing container.
  • images lists all existing images.
  • run starts an container.
  • status will be show the state of the containerRuntim like “active”, if the runtime is running.
  • exec will be execute an command within an running Container.
  • tag will be rename the Imagename, for example: docker tag -t Image NewImage
  • pull will be pulling the given Image.
  • push will be pushing the given Image.
  • stop will be stop a given Container.
  • start will be start a given Container.
  • deleteCon will delete a given container.

*1:Note: In the case of containerd, the containers do not have any Name they only have ID’s. The contianerName in this case will be the contianer ID. If startTask, stopTask or deleteTask was selected containerName is treated as name of the task.

*2:Note: Only needed for execution commands with containerd.

Example 1 - containerd ps

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    containerd(option='"ps"'; flag='"--last"';sudo='"true"';sudoPassword='"Drowssap"');
}

Example 2 - containerd images

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    containerd(option='"images"'; flag='"--all"';sudo='"true"';sudoPassword='"Drowssap"');
}

Example 3 - containerd run

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    containerd(option='"run"'; flag='"-w /path/to/dir/ -i -t"';srcImage='"registry.kubernative.net/lima:v0.8.0"';containerName='"myFirstContainer"';runtime='"status"';sudo='"true"';sudoPassword='"Drowssap"');
}

Example 4 - containerd status

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    containerd(option='"status"';sudo='"true"';sudoPassword='"Drowssap"');
}

Example 5 - containerd exec

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    containerd(option='"exec"'; execID='"exec1"';containerName='"registry.kubernative.net/lima:v0.8.0"';command='"mkdir /tmp/testdir"';sudo='"true"';sudoPassword='"Drowssap"');
}

Example 6 - containerd tag

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    containerd(option='"tag"'; srcImage='"registry.kubernative.net/lima:v0.8.0"';destImage='"yourRegistry/yourName:v0.8.0"';sudo='"true"';sudoPassword='"Drowssap"');
}

Example 7 - containerd pull / push

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    containerd(option='"pull/push"'; srcImage='"registry.kubernative.net/lima:v0.8.0"';sudo='"true"';sudoPassword='"Drowssap"');
}

Example 8 - containerd deleteCon

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    containerd(option='"deleteCon"'; containerName='"myFirstContainer"';sudo='"true"';sudoPassword='"Drowssap"');
}

Example 9 containerd psTask

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    containerd(type='"containerd"'; option='"psTask"';sudo='"true"';sudoPassword='"Drowssap"');
}

Example 10 containerd stopTask / startTask / deleteTask

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    containerd(option='"stopTask / startTask / seleteTask"'; containerName='"task1"';sudo='"true"';sudoPassword='"Drowssap"');
}

4.6 - Plugin References

Plugin References

How to access the plugins

All plugins are available as KOSI packages in the KubeOpsHub. Our plugins are grouped into several KOSI packages described below. To see our KOSI packages in the KubeOpsHub use the command:

KOSI 2.4.0 or higher
kosi search --ps kubeops --hub public
KOSI 2.4.0 or higher
kosi install --hub=public <user/packagename:version> 

The plugins are automatically placed in the associated directory($KUBEOPSROOT/plugins) and can be used directly.

Plugin packages

In this section you can find the plugin packages and the documentation for each plugin.

kubeops-basic-plugins

These plugins are part of the kubeops-basic-plugins package.

[Plugin copy]( “Plugin copy”)

[Plugin editFile]( “Plugin editFile”)

[Plugin fPrint]( “Plugin fPrint”)

[Plugin hostname]( “Plugin hostname”)

[Plugin if]( “Plugin if”)

[Plugin loop]( “Plugin loop”)

[Plugin osCheck]( “Plugin osCheck”)

[Plugin packagemanager]( “Plugin packagemanager”)

[Plugin service]( “Plugin service”)

[Plugin sudo]( “Plugin sudo”)

kubeops-kubernetes-plugins

These plugins are part of the kubeops-kubernetes-plugins package.

[Plugin auditLog]( “Plugin auditLog”)

[Plugin kubeadm]( “Plugin kubeadm”)

[Plugin kubectl]( “Plugin kubectl”)


pre-installed plugins

These plugins are installed with the installation of KOSI.

[Plugin bash]( “Plugin bash”)

[Plugin chmod]( “Plugin chmod”)

[Plugin cmd]( “Plugin cmd”)

[Plugin helm]( “Plugin helm”)

[Plugin print]( “Plugin print”)

[Plugin sh]( “Plugin sh”)

[Plugin template]( “Plugin template”)

[Plugin kosi]( “Plugin kosi”)

4.7 - containerRuntime-1.4.0

KOSI Plugin containerRuntime Version 1.4.0

Summary

With the containerRunitme Plugin you can manage you containerRuntime. You can use options to ecexute commands with or without flags. Additionally its possible to gather information about the current containerRuntime status. The plugin supports the following usage:

Plugin requirements

If you want to use the Plugin containerd you need the following Plugins:

  • docker
  • crio
  • contianerd

Keys

Key Description
command Mandatory Will be the command you want to execute inside the container.
containerConfig - Will be the configuration JSON or YAML for your container creation. For Example: containerConfiguatrion.json or containerConfiguatrion.yaml
containerName - Will be the Container in which your command will be executed.
destImage - Will be the new image name for the tages srcImage.
execID - Will be the ID / Name of your execution.*1
flag - The value of the “flag” key stores information on which options you want to enable. You will have to confirm which flag the “option” of your command allows. Examples for ps are “-a or –all” for all or “-n or –last” for last of the list of container, you can append any number of flags, like in example 3.*2
runtime - In the value of the key “containerRuntime” in this case “status” the runtime will be stored temporarily.*3
srcImage - Will be the Image which you want to pull, push or tag.
sudo - Can be true or false. If it is true the Plugin will be executed with sudo privileges.
sudoPassword - If you use, sudoPassword will be mandatory.
type - You can either specify the containerRuntime type via the key “type” or if no type specified the plugin will detect automatically the running containerRuntime.*4
option Mandatory Depending on which operation you want to execute select one of these as a variable of the key. Following example 1, if you want to execute a command like run, you take “option” as a key and “run” as a value.

The Values can be followed:

  • ps list all existing container.
  • images lists all existing images.
  • run starts an container.
  • status will be show the state of the containerRuntim like “active”, if the runtime is running.
  • exec will be execute an command within an running Container.
  • tag will be rename the Imagename, for example: docker tag -t Image NewImage
  • pull will be pulling the given Image.
  • push will be pushing the given Image.
  • stop will be stop a given Container.
  • start will be start a given Container.
  • deleteCon will delete a given container.

Only for containerd

  • psTask list all existing task for containerd.
  • startTask starts a task from a given container.
  • stopTask will be stop a given Task.
  • deleteTask will delete a given Task.

podConfig

containerConfig

Will be the configuration JSON or YAML for your pod creation. For Example: podConfiguatrion.json or podConfiguatrion.yaml

*1:Note: Only needed for execution commands with containerd. *2:optional key! For all other keys. *3:Note: optional key! You can store your runtime temporarily. *4:If docker and crio and containerd, or 2 of the specific containerRuntime, are running, docker will be choosen, for containerd and crio it will be containerd.

Example 1 - docker / crio / containerd ps

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    containerRuntime(type='"docker / crio / containerd"'; option='"ps"';flag='"--last"';runtime='"status"';sudo='"true"';sudoPassword='"Drowssap"');
}

Example 2 - docker / crio / containerd images

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    containerRuntime(type='"docker / crio / containerd"'; option='"images"';flag='"--all"';runtime='"status"';sudo='"true"';sudoPassword='"Drowssap"');
}

Example 3 - docker / containerd run

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    containerRuntime(type='"docker / crio / containerd"'; option='"run"';flag='"-w /path/to/dir/ -i -t"';srcImage='"registry.kubernative.net/lima:v0.8.0"';containerName='"myFirstContainer"';runtime='"status"';sudo='"true"';sudoPassword='"Drowssap"');
}

Example 4 - crio run

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    containerRuntime(type='"crio"'; option='"run"';containerConfig='"/root/podConfig.json / .yaml"';podConfig='"/root/podConfig.json / .yaml"';runtime='"status"';sudo='"true"';sudoPassword='"Drowssap"');
}

Example 5 - docker / crio / containerd status

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    containerRuntime(type='"docker / crio / contianerd"'; option='"status"';runtime='"status"';sudo='"true"';sudoPassword='"Drowssap"');
}

Example 6 - containerd exec

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    containerRuntime(type='"contianerd"'; option='"exec"';execID='"exec1"';containerName='"registry.kubernative.net/lima:v0.8.0"';command='"mkdir /tmp/testdir"';runtime='"status"';sudo='"true"';sudoPassword='"Drowssap"');
}

Example 7 - docker / crio exec

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    containerRuntime(type='"docker / crio"'; option='"exec"';containerName='"registry.kubernative.net/lima:v0.8.0"';command='"mkdir /tmp/testdir"';runtime='"status"';sudo='"true"';sudoPassword='"Drowssap"');
}

Example 8 - docker / containerd tag

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    containerRuntime(type='"docker / containerd"'; option='"tag"';srcImage='"registry.kubernative.net/lima:v0.8.0"'; destImage='"yourRegistry/yourName:v0.8.0"';runtime='"status"';sudo='"true"';sudoPassword='"Drowssap"');
}

Example 9 docker / crio / containerd deleteCon / start / stop

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    containerRuntime(type='"docker / crio / containerd"'; option='"deleteCon / start / stop"';containerName='"myFirstContainer"';runtime='"status"';sudo='"true"';sudoPassword='"Drowssap"');
}

Example 10 - docker / crio / containerd pull / push

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    containerRuntime(type='"docker / crio / containerd"'; option='"pull / push"';srcImage='"registry.kubernative.net/lima:v0.8.0"';runtime='"status"';sudo='"true"';sudoPassword='"Drowssap"');
}

Note: Crio does not have the “option” push and tag!

The following Examples are only for containerd runtime!

Example 11 containerd psTask

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    containerRuntime(type='"containerd"'; option='"psTask"';flag='"--all"';runtime='"status"';sudo='"true"';sudoPassword='"Drowssap"');
}

Example 12 containerd startTask / stopTask / deleteTask

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    containerRuntime(type='"containerd"'; option='"startTask /stopTask / deleteTask"';flag='"--null-io"';containerName='"myFirstTask"';runtime='"status"';sudo='"true"';sudoPassword='"Drowssap"');
}

4.8 - copy-1.4.0

KOSI Plugin copy Version 1.4.0

Summary

With the copy Plugin you can either copy a file or a whole directory recursively.

Keys

Key Description
src Mandatory set to the absolute path to the source file or folder.
dest Mandatory set to the absolute path to the destination file or folder.
overwrite true/false With overwrite true an already existing file or folder will be overwritten. The default value is set to false.

Usage

Example 1 - copy file

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    copy(src='"/absolute/path/to/file"'; dest='"/absolute/path/to/the/dest/file"';overwrite='"true/false"');
}

When copying, a new file is inevitably created in the destination directory. Da wird nicht der Dateiname verändert, sondern die Datei mit dem neuen Namen daneben gelegt.

Example 2 - copy folder

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    copy(src='"/absolute/path/to/folder"'; dest='"/absolute/path/to/the/dest/folder"';overwrite='"true/false"');
}

If the destination folder does not exists, it will be created. The content of the src folder will be copied into the dest folder.

⚠️ Be careful, overwritten data will be lost and will be not recoverable! ⚠️

4.9 - crio-0.0.1

KOSI Plugin crio Version 0.0.1

Summary

With the containerRunitme Plugin you can manage you containerRuntime. You can use options to ecexute commands with or without flags. Additionally its possible to gather information about the current containerRuntime status. The plugin supports the following usage:

Keys

Key Description
command - Will be the command you want to execute inside the container.
containerName - Will be the Name of the contianer you choose or the Name of the temporarily stored Name of the created cluster.
flag - The value of the “flag” key stores information on which options you want to enable. You will have to confirm which flag the “option” of your command allows. Examples for ps are “-a or –all” for all or “-n or –last” for last of the list of container, you can append any number of flags, like in example 3.
srcImage - Will be the Image which you want to pull.
option Mandatory Depending on which operation you want to execute select one of these as a variable of the key. Following example 1, if you want to execute a command like run, you take “option” as a key and “run” as a value.

The Values can be followed:

  • Ps will list be you all existing container.
  • Images will be list all existing Images.
  • Run will be start an Container.
  • Status will be show the state of the containerRuntim like “active”, if the runtime is running.
  • Exec will be execute an command within an running Container.
  • Pull will be pulling the given Image.

Example 1 - crio ps

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    crio(option='"ps"'; flag='"--last"');
}

Example 2 - crio images

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    crio(option='"images"'; flag='"--all"');
}
installation:
  tasks:
    - crio:
        option: images
        flag: "--all"

Example 3 - crio run

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    crio(option='"run"'; flag='"-w /path/to/dir/ -i -t"');
}

Example 4 - crio status

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    crio(option='"status"');
}

Example 5 - crio exec

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    crio(option='"exec"'; flag='"-d"';containerName='"registry.kubernative.net/lima:v0.7.0-beta-0"';command='"touch /tmp/testdir"');
}

Example 6 - crio pull

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    crio(option='"pull"';srcImage='"registry.kubernative.net/lima:v0.7.0-beta-0"');
}

4.10 - docker-0.0.1

KOSI Plugin docker Version 0.0.1

Summary

With the containerRunitme Plugin you can manage you containerRuntime. You can use options to ecexute commands with or without flags. Additionally its possible to gather information about the current containerRuntime status. The plugin supports the following usage:

Keys

Key Description
command - Will be the command you want to execute inside the container.
containerName - Will be the Name of the contianer you choose or the Name of the temporarily stored Name of the created cluster.
destImage - Will be the new image name for the tages srcImage.
flag - The value of the “flag” key stores information on which options you want to enable. You will have to confirm which flag the “option” of your command allows. Examples for ps are “-a or –all” for all or “-n or –last” for last of the list of container, you can append any number of flags, like in example 3.
srcImage - Will be the Image which you want to pull.
option Mandatory Depending on which operation you want to execute select one of these as a variable of the key. Following example 1, if you want to execute a command like run, you take “option” as a key and “run” as a value.

The Values can be followed:

  • ps lists you all existing container.
  • images list all existing Images.
  • run starts an Container.
  • status will be showing the state of the containerRuntim like “active”, if the runtime is running.
  • exec will be executing an command within an running Container.
  • tag will be renamed the Imagename, for example: docker tag -t Image NewImage
  • pull will be pulling the given Image.
  • push will be pushing the given Image.
  • start will be starting a stopped container.
  • stop will be stopping a running container.
  • deleteCon will be deleting a given container

Example 1 - docker ps

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    docker(option='"ps"'; flag='"--last"';sudo='"true"';sudoPassword='"Drowssap"');
}

Example 2 - docker Images

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    docker(option='"images"'; flag='"--all"';sudo='"true"';sudoPassword='"Drowssap"');
}

Example 3 - docker run

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    docker(option='"run"'; flag='"-w /path/to/dir/ -i -t"';sudo='"true"';sudoPassword='"Drowssap"');
}

Example 4 - docker status

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    docker(option='"status"';sudo='"true"';sudoPassword='"Drowssap"');
}

Example 5 - docker exec

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    docker(option='"exec"';flag='"-d"';containerName='"registry.kubernative.net/lima:v0.8.0"';command='"touch /tmp/testdir"';sudo='"true"';sudoPassword='"Drowssap"');
}

Example 6 - docker tag

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    docker(option='"tag"';flag='"-t"';srcImage='"registry.kubernative.net/lima:v0.8.0"';destImage='"yourRegistry/yourName:v0.8.0"';sudo='"true"';sudoPassword='"Drowssap"');
}

Example 7 - docker pull /push

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    docker(option='"pull / push"';flag='"-t"';srcImage='"registry.kubernative.net/lima:v0.8.0"';sudo='"true"';sudoPassword='"Drowssap"');
}

Example 8 - docker start / stop / deleteCon

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    docker(option='"start / stop / deleteCon"';containerName='"myFirstContainer"';sudo='"true"';sudoPassword='"Drowssap"');
}

4.11 - editFile-1.4.0

KOSI Plugin editFile Version 1.4.0

Summary

The editFile Plugin allows you to add, overwrite or delete specific parts of a yaml or text file.

Keys

operation (required)

This key accepts the three operating modes as its value:

  • add
  • overwrite
  • delete

add

Add a value to the specified key (yaml) or line (text).
For yaml files you have to specify the key and value you want to add to the file. For text files you have to specify the line and value you want to add to the file.

For example:

- editFile:
    operation: add
    fileType: text
    filePath: "/root/KosiPlugin/script.text"
    key: "spec.clusterMaster.toAdd"
    value: Hier steht ein Text

The key toAdd will be created / written into the file as a subtree of clusterMaster with the given value.

overwrite

Overwrite the text with the value on the specified key (yaml) or line (text)

Note: add and overwrite work the same for yaml.

delete

Delete the text of the specified key (yaml) or line (text). In both cases the whole line is removed.

filePath (required)

Set the absolute pathe to the file to be edited as the value of this key.

fileType (required)

If the file that you want to edit is a yaml file, set the value of this key to "yaml".
If the file is a text file, set the value of this key to "text".

key

This is a mandatory key for yaml files.

This key allows you to specify the key you want to add, overwrite or delete in your yaml file.
Key is based on JSON Path.

For example:

key: "spec.clusterName"

This example shows the value of key, if you want to edit the key clusterName with the parent spec.

Note: If you have a list the key would be as followd:

key: "spec.clusterName.list.[0].Name"

line

This is a mandatory key for text files.

Allows you to set the line number where the operation gets executed.

value (required)

Set the new value you want to write to the file as the value of this key. If you want to write a text/block you have to use \n at the end of each line and \t to indent line.

For example:

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    editFile(operation='"overwrite"'; fileType='"text"';filePath='"/root/KosiPlugin/script.txt"';line='"3"';
    value='"Hier steht ein Text \n
           \t clusterName: hier steht ein Name \n
           \t hostips: \n
           \t \t ips: \n
           \t \t \t - 192.168.79.130"');
}

For yaml files, the whole string is set as the value for the given key.

For text files, when using add, the text will inserted beginning at line. For every newline in value a new line will be added to te file.
When using overwrite, the value will be split into multiple lines and every line in the input will replace one line in the old file starting at line.

Make sure that there are enough lines to overwrite

Examples for yaml files

example file

spec:
  clusterMaster:
    someText: this is an example
    toOverwrite: this will be gone

Example 1 - add new text

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    editFile(operation='"add"'; fileType='"text"';filePath='"/root/KosiPlugin/example.yaml"';key='"spec.clusterMaster.toAdd"';
    value='"this is ne text"');
}

Result:

spec:
  clusterMaster:
    someText: this is an example
    toOverwrite: heir steht text
    toAdd: this is new text

Example 2 - overwrite text

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    editFile(operation='"overwrite"'; fileType='"yaml"';filePath='"/root/KosiPlugin/example.yaml"';key='"spec.clusterMaster.toOverwrite"';value='"this replaced the old text"');
}

Result:

spec:
  clusterMaster:
    someText: this is an example
    toOverwrite: this replaced the old text

Example 3 - delete text

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    editFile(operation='"delete"'; fileType='"yaml"';filePath='"/root/KosiPlugin/example.yaml"';key='"spec.clusterMaster.toOverwrite"');
}

Result:

spec:
  clusterMaster:
    someText: this is an example

Examples for text files

example file

bucket list:
 - item 1
 - item 2
 - item 3

Example 1 - add new text

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    editFile(operation='"add"'; fileType='"text"';filePath='"/root/KosiPlugin/example.txt"';line='"5"';value='" - item 4"');
}

Result:

bucket list:
 - item 1
 - item 2
 - item 3
 - item 4

Example 2 - overwrite text

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    editFile(operation='"overwrite"'; fileType='"text"';filePath='"/root/KosiPlugin/example.txt"';line='"4"';value='" - item 3"');
}

Result:

bucket list:
 - item 1
 - item 2
 - new item 3

Example 3 - delete text

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    editFile(operation='"delete"'; fileType='"text"';filePath='"/root/KosiPlugin/example.txt"';line='"3"');
}

Result:

bucket list:
 - item 1
 - item 3

4.12 - firewall-1.4.0

KOSI Plugin Firewall Version 1.4.0

Required Plugins

  • osCheck
  • firewallD
  • IPTables

Summary

With the firewall Plugin you can manage your firewall. You can either open/close ports or disable/enable the firewall. Additionally it is possible to gather information about the current firewall status. Currently 2 types of firewall are supported:

Documentation of Plugin firewallD
Documentation of Plugin IPTables

Keys

Key Description
type Mandatory The following actions will be applied to the specified firewall type
action Mandatory Similiar to the service Plugin you can enable and disable the specified firewall as well open and close ports.
ports Mandatory If you want to open or close any ports the key ports which requires a list ("ports" or "ports-range"/protocol) is mandatory. Any ports like in the schema above are valid.
getFirewallStatus Mandatory The status of the the firewall will be stored in the value of this key. There are two status possible: "running" / "not running"

If firewalld and iptables are running, firewalld will be chosen

Example

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    firewall(type='"firewalld"';action='"close / open / disable"';ports='"["5555/tcp","6666/tcp","8888-9999/udp"]"';getFirewallStatus='"status"');
}

4.13 - firewallD-1.4.0

KOSI Plugin FirewallD Version 1.4.0

Required Plugins

  • firewallD

Summary

With the firewall Plugin you can manage your firewall. You can either open/close ports or disable/enable the firewall. Additionally it is possible to gather information about the current firewall status. Currently 2 types of firewall are supported:

Documentation of Plugin firewallD
Documentation of Plugin IPTables

Keys

Key Description
action Mandatory Similiar to the service Plugin you can enable and disable the specified firewall as well open and close ports.
ports Mandatory If you want to open or close any ports the key ports which requires a list ("ports" or "ports-range"/protocol) is mandatory. Any ports like in the schema above are valid.
getFirewallStatus Mandatory The status of the the firewall will be stored in the value of this key. There are two status possible: "running" / "not running"

If firewalld and iptables are running, firewalld will be chosen

Example

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    firewalld(action='"close / open / disable"';ports='"["5555/tcp","6666/tcp","8888-9999/udp"]"';getFirewallStatus='"status"');
}

4.14 - fprint-1.4.0

KOSI Plugin fprint Version 1.4.0

Summary

The fprint plugin allows you to send a message as a key-value pair to the user like the print plugin does. In addition, variables from other plugins can be included, which are also printed (see loop-plugin Reference.).

Keys

Key Description
message Mandatory The value consists of a string which represents a command line output.
variables - The value must be a list of strings. Each string object passed is checked. If such an object was created by another plugin, the fprint plugin takes over the output and prints it in the message.

Example

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    fprint(message='"Hello {0} with the ips {1}"'; variables='"["name","ips"]"');
}

4.15 - helm-1.4.0

KOSI Plugin Helm Version 1.4.0

Release-Notes

New

  • flags parameter

Updates

  • update dependencies

Summary

With this plugin you cann install, upgrade or delete helm packages. It is required that the helmvalues.yaml is present in the running directory of the install command of KOSI.
The helm tgz should be included in the files tree inside the includes tree.

Keys

command

Defines whether the chart should be installed, upgraded or deleted.

tgz

The filename of the Helmchart.

values

Give a list of files where the values for the helm package will be stored.

flags

Give a list of flags where the flags for the helm command will be stored. Example: flags=’["–wait","–create-namespace"]'

namespace

Define in which namespace the chart should get installed.

deploymentName

Defines the name of the deployment.

helm install:

This are the parameters for helm install.

Key Default value Description
command Mandatory - This key have to be set to execute the wanted helm command.
tgz Mandatory - This key have to be set to handle the wanted helm-chart.
values optional - This key is optional. If this key is not set, there are no values.
flags optional - This key is optional. If this key is not set, there are no flags.
namespace optional default This key is optional. Set this key if you want to handle your command in a specific namespace.
deploymentName optional random-generated This key is optional. Set this key to set a specific deploymentName for your helm-deployment. Default is a random-generated name

Example install:

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  guestbook= "guestbook.tgz";
  gbValues= "gbValues.yaml";
  values2= "values2.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    cmd(command='"echo install helmchart."');
    helm(command='"install"';tgz='"guestbook.tgz"';values='["gbValues.yaml","values2.yaml"]';deploymentName='"guestbook"';namespace='"dev"');
}

helm upgrade:

This are the parameters for helm upgrade.

Key Default value Description
command Mandatory - This key have to be set to execute the wanted helm command.
tgz Mandatory - This key have to be set to handle the wanted helm-chart.
values optional - This key is optional. If this key is not set, there are no values.
flags optional - This key is optional. If this key is not set, there are no flags.
namespace optional default This key is optional. Set this key if you want to handle your command in a specific namespace.
deploymentName Mandatory - This key have to be set to handle the upgraded helm-chart of the deploymentName

Example upgrade

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  guestbook= "guestbook.tgz";
  gbValues= "gbValues.yaml";
  values2= "values2.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    cmd(command='"echo install helmchart."');
    helm(command='"install"';tgz='"guestbook.tgz"';values='["gbValues.yaml","values2.yaml"]';deploymentName='"guestbook"';namespace='"dev"');
}
update
{
    cmd(command='"echo upgrade helmchart."');
    helm(command='"upgrade"';tgz='"guestbook.tgz"';values='["gbValues.yaml","values2.yaml"]';deploymentName='"guestbook"';namespace='"dev"'); 
    helm(command='"upgrade"';tgz='"guestbook2.tgz"';values='["gbValues.yaml","values2.yaml"]';deploymentName='"guestbook2"';namespace='"dev"';flags='["--create-namespace"]');
}

helm delete:

This are the parameters for helm upgrade.

Key Default value Description
command Mandatory - This key have to be set to execute the wanted helm command.
flags optional - This key is optional. If this key is not set, there are no flags.
namespace optional default This key is optional. Set this key if you want to handle your command in a specific namespace.
deploymentName Mandatory - This key have to be set to handle the upgraded helm-chart of the deploymentName

Example delete

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  guestbook= "guestbook.tgz";
  guestbook2= "guestbook2.tgz";
  gbValues= "gbValues.yaml";
  values2= "values2.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    cmd(command='"echo install helm chart."');
    helm(command='"install"';tgz='"guestbook.tgz"';values='["gbValues.yaml","values2.yaml"]';deploymentName='"guestbook"';namespace='"dev"');
}
update
{
    cmd(command='"echo upgrade helm chart."');
    helm(command='"upgrade"';tgz='"guestbook.tgz"';values='["gbValues.yaml","values2.yaml"]';deploymentName='"guestbook"';namespace='"dev"');
    helm(command='"upgrade"';tgz='"guestbook2.tgz"';values='["gbValues.yaml","values2.yaml"]';deploymentName='"guestbook2"';namespace='"dev"';flags='["--create-namespace"]'); 
}
delete
{
   cmd(command='"echo delete helm chart."');
   helm(command='"delete"';deploymentName='"guestbook"';namespace='"dev"';flags='["--wait"]'); 
}

4.16 - hostname-1.4.0

KOSI Plugin hostname Version 1.4.0

Summary

The hostname plugin enables you to :

  • print the current hostname of the machine and save it to an internal storage
  • set the hostname to your desired name permenently.
  • read the hostname from the storage to set your hostname permenently.

Keys

Depending on which operating mode you use, you have to set one of the following keys.

Key Description
get - Set this key to the name of variable in which you want the current hostname to be saved. This variable is accessible until the end of your kosi session.
set - Set this key to your desired name which should be set as hostname.
setVar - Set this key to the name of the variable in the internal storage in which you have saved the desired hostname.
sudo true / false If it is true the Plugin will be executed with sudo privileges.
sudoPassword - If you use sudo, sudoPassword will be mandatory.

Examples

Example 1 - get hostname

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    containerd(get='"oldHostname"';sudo='"true"';sudoPassword='"Drowssap"');
}

Example 2 - set hostname

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    containerd(set='"master"';sudo='"true"';sudoPassword='"Drowssap"');
}

Example 3 - use internal variable to set hostname

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    hostname(setVar='"oldHostname"';sudo='"true"';sudoPassword='"Drowssap"');
}

4.17 - if-1.4.0

KOSI Plugin if Version 1.4.0

Changelog Plugin if 1.4.0

Update

  • updateing dependencies

Summary

The ‘if’ Plugin allowes you to introduce controll flows into your KOSI packages. It implements the classic ‘if’ ( + optional ’else’) construct.

Keys

Key Description
condition Mandatory set to a string that will be evaluated as an expression.
Condition is based on net5.0 DataColumn expressions and follows almost the same syntax. The only difference are plugin variables can also be used in the condition
then Mandatory expects the key “tasks” to be child. If the"condition" is true, then it will execute “tasks” under “then”.
else Optional expects the key “tasks” to be child.If “condition” is false, then it will execute “tasks” under “else”.
tasks tasks key works the exact same way as the global list of tasks in your package.

Syntax to access plugin variables inside condition :

condition= "$variableName$"

Syntax to access KOSI templating of values.yaml inside condition :

condition= '{{values.variable}}'

Example

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  guestbook= "guestbook.tgz";
  gbValues= "gbValues.yaml";
  values2= "values2.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    cmd(command='"echo Using the if plugin."');
    if(condition='"$myVar$ < 0"')
      then{
        print(message='"myVar is less then 0."');
      }
      else{
        print(a='"myVar is equal or greater then 0."');
      }
    print(message='"This will always print."');
}

Result

[ 06/22/2021 16:56:54 Info    default ] myVar is equal or more then 0 
[ 06/22/2021 16:56:54 Info    default ] this will always print

or

[ 06/22/2021 16:57:37 Info    default ] myVar is less then 0 
[ 06/22/2021 16:57:37 Info    default ] this will always print

All expressions are expected to evaluate to either ‘True’ or ‘False’ otherwise the ‘if’ plugin will exit with an error.

4.18 - ipTables-1.4.0

KOSI Plugin IPTables Version 1.4.0

Required Software

  • iptables

Summary

With this plugin you can manage iptables. You can either open/close ports or disable/enable it. Additionally it is possible to gather information about the iptables status.

Keys

Key Description
action Mandatory Similiar to the service Plugin you can enable and disable iptables as well as open and close ports.
ports If you want to open or close any ports the key ports which requires a list ("ports" or "ports-range"/protocol) is mandatory. Any ports like in the schema above are valid.
getFirewallStatus set to a variable name in which status of the iptables will be stored. The status will be either: "running" / "not running"

Example

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    IPTables(action='"close / open / disable"';ports='"["5555/tcp","6666/tcp","8888-9999/udp"]"';getFirewallStatus='"status"');
}

4.19 - kosi-0.4.3

KOSI Plugin kosi Version 0.4.3

Changelog KOSI Plugin 0.4.3

New

  • Added pull command to plugin

Update

  • Update dependencies from kosi

Changelog KOSI Plugin 0.2.6

Update

  • Update dependencies from kosi

Summary

The kosi plugin provides a means to use features of kosi within a kosi plugin.
With the kosi plugin you can automatically log in to your hub, pull packages and install them. The kosi plugin currently supports these kosi features:

  • login
  • install
  • delete
  • update
  • pull

Keys

Depending on which operating mode you use, you have to set one of the following keys.

Key Default value Description
command Mandatory - Set this key to the KOSI command you want to execute.
userVar Mandatory - Set this key to your user name.
passwordVar Mandatory - Set this key to your password in plain text.
sourcePath Mandatory - Set this key to the name of the package you want to install.
sourceRegistry Mandatory - Set this key to the registry you want to download the images of the package from.
deploymentName Optional Name of the package Set this key to the name that the installed package has in the cluster. A deploymentName will be set automatically if you don’ t set it in the package.yaml. The deploymentName is important for upadating a package.
nameSpace Optional “default” Set this key to the name of the namespace you want to deploy the package into.
userHub Mandatory - Set this key to the user-hub you want to access.
packageName Mandatory - Set this key to the name of the package you want to install.
packageDestinationPath Mandatory save location Set this key to set your save location of your package
destinationRegistry Optional - Set this key to set the destination registry for your pulled image in your package, if retag is set true
targetRegistry Optional - Set this key to set the target registry for your pulled image in your deployment inside the package, if retag is set true
retag Optional “true”/“false” Set this key to set retag flag for your pull process
values Optional, list - This list is equivalent to the -f option of the KOSI CLI.

Features

Login

Login enables you to log in to your KubeOps user account. This is required to upload packages to a hub and to download packages from a private hub.
Both the username and password must be entered in plain text in package.yaml.

Install

The install command can be used to download and install packages from any registry. If this is a public package you have to set your userHub to “public”. Otherwise you have to set the userHub, where the package is located. In addition, the namespace in which the package is to be installed can be specified and the name of the deployed package in the cluster can be changed.

Update

The update command updates an already installed KOSI package. For update, the installation and the update package have to be the same name. Update will be defined in the package.yaml (example 3 - Update). If this is a public package you have to set your userHub to “public”. Otherwise you have to set the userHub, where the package is located

Delete

The delete command can be used to delete packages from any registry. The command delete expected parameters like sourcePath, sourceRegistry and deploymentName, which are also marked as required. If this is a public package you have to set your userHub to “public”. Otherwise you have to set the userHub, where the package is located

The namespace parameter can be used to specify the name of the package to be deleted.

Pull

The pull command can be used to pull packages from any registry. The command pull expected parameters like packageName, packageDestinationPath and userHub, which are also marked as mandatory. If you want to pull your images in your own registry you can use the destinationRegistry parameter. If you want to pull your images in your own registry and change your deployment automatically you can use destinationRegistry and targetRegistry. In both scenarios you have to use the retag parameter.

Examples

Example 1 - Login

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    kosi(command='"login"'; userVar='"exampleUser"';passwordVar='"examplePW"';hub='"http://hub.kubernative.net/dispatcher/ ");
}

Example 2 - Install

tasks: 
  - kosi:
      command: "install"
      sourcePath: "kosi/kubeops-kubernetes-plugins:0.0.1"  #mandatory
      sourceRegistry: "registry1.kubernative.net"          #mandatory
      deploymentName: "kubernetes-plugins"                 #optional
      hub: http://hub.kubernative.net/dispatcher/          #mandatory
      nameSpace: "kosi"                                    #optional
      values:                                              #optional
        - "values.yaml"
      userHub: "public"                                    #mandatory
      local: false                                         #flag for local or remote package

Example 3 - Install local package

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    kosi(command='"install"'; sourcePath='"/root/kosi-test/package.kosi"';sourceRegistry='"registry1.kubernative.net"';deploymentName='"kubernetes-plugins"';hub='"http://hub.kubernative.net/dispatcher/"';namespace='"kosi"';values='"["values.yaml"]"';userHub='"public"';local='"true"';);
}

Example 4 - Update

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    kosi(command='"update"'; sourcePath='"/root/kosi-test/package.kosi"';sourceRegistry='"registry1.kubernative.net"';deploymentName='"kubernetes-plugins"';hub='"http://hub.kubernative.net/dispatcher/"';namespace='"kosi"';values='"["values.yaml"]"';userHub='"public"';local='"true"';);
}

Example 5 - Delete

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    kosi(command='"delete"'; sourcePath='"/root/kosi-test/package.kosi"';sourceRegistry='"registry1.kubernative.net"';deploymentName='"kubernetes-plugins"';hub='"http://hub.kubernative.net/dispatcher/"';namespace='"kosi"';values='"["values.yaml"]"';userHub='"public"';local='"true"';);
}

Example 6 - Pull with retag

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    kosi(command='"pull"';hub='"http://hub.kubernative.net/dispatcher/"';packageName='"lima/kubernetes:1.24.7"';packageDestinationPath='"/root/kubernetes-1.24.7/package.kosi" ';destinationRegistry='localhost:5000/myimages"';targetRegistry='"myregistry.net/myimages"';retag='"true"');
}

4.20 - kubeadm-1.4.0

KOSI Plugin kubeadm Version 1.4.0

Summary

This plugin can be used to execute kubeadm commands.

Keys

Key Description
action - Action performed when upgrade is used as an operation.
kubeadmVersion - Any offical verb supported by Kubernetes is allowed when you try the operation “config” or “can-i”
outputVar Mandatory Save the output of the executed command in the offered variable.
sudo - Can be true or false. If it is true the Plugin will be executet with sudo privileges.
sudoPassword - If you use sudo, sudoPassword will be mandatory.
phase - Phase which will be initialized when using init phase as an operation.
token - Save the token of the token create command in the offered variable.
operation - The operations shown above are currently supported when using the kubeadm plugin. Depending on the operation the following inputs are required:
  • Operation “version” requires kubeadmVersion to save the output kubeadmVersion. It’s recommended to use the flag -o short to get only the Version as output.
  • Operation “init phase” requires a phase. E.g certs or kubeconfig.
  • Operation “token create” requires a token to save the created token into a variable.
  • Operation “upgrade” requires an action. E.g plan oder apply.

action

Action performed when upgrade is used as an operation.

kubeadmVersion

Any offical verb supported by Kubernetes is allowed when you try the operation “config” or “can-i”

operation

The operations shown above are currently supported when using the kubeadm plugin. Depending on the operation the following inputs are required:

  • Operation “version” requires kubeadmVersion to save the output kubeadmVersion. It’s recommended to use the flag -o short to get only the Version as output.
  • Operation “init phase” requires a phase. E.g certs or kubeconfig.
  • Operation “token create” requires a token to save the created token into a variable.
  • Operation “upgrade” requires an action. E.g plan oder apply.

Example

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    kubeadm(
      operation='"version"/"reset"/"init"/"init phase"/"token create"/"upgrade"';
      kubeadmVersion='"version"';
      phase='"kubelet-start"/"certs"/"kubeconfig"/"control-plane"/..."'
      action='"plan"/"apply"/"node"/"apply v1.22.x"/..."';
      flag='"-f PathToYAML -n kube-system -o wide"/..."';
      outputVar: '"outputStorage"';
      token='"kubeadmToken"';
      sudo='"true"';
      sudoPassword="Drowssap");
}

4.21 - kubectl-1.4.0

KOSI Plugin Kubectl

Release-Notes

Version 1.4.0

New

  • nothing

Updates

  • update toolchain dependencies 1.0.15

Summary

This plugin can be used to execute kubectl commands.

Keys

Key Description
operation mandatory set it to the required subcommand of kubectl.
resource mandatory for most operations set it to the type of resource on which the operation should be executed. Every official kubernetes resource is supported.
resourceName optional This key specifies the name of the resource. Names are case-sensitive. If this key is set the operation to the resources with the given names.
flags optional set it to the flag supported by the given kubectl operation. When using the flag “-f” you need to include the absolute path to the file which you want to pass. You can append multiple flag separated by space Example: “-f PathToYAML -A -o wide”'
verb optional set this to a verb supported by Kubernetes. Use this key in combination with operations like “config” or “can-i”.
outputVar optional set it to a new variable name in which you want to save the output of the kubectl command
outputFile optional Use this key if you want to save the output of the executed command to a file. The value has to be an absolute path.
sudo optional Set to true to execute the Plugin with sudo privileges.
sudoPassword mandatory If you use sudo, sudoPassword will be mandatory

Example

Example 1

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

install
{
    kubectl(
        operation='"get"'; 
        resource='"pods"'; 
        resourceName='"testDeployment"'; 
        flags='"-n kube-system -o wide"'; 
        outputVar='"outputGet"'; 
        outputFile='"/root/outputKubectlGet.txt"'; 
        sudo='"true"';
        sudoPassword='"Drowssap"'
    );
}

Example 2

When performing an operation on multiple resources with the same type, you can specify each resource by type and name:

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

install
{
    kubectl(
        operation='"get"'; 
        resource='"pod"'; 
        resourceName='"example-pod1 example-pod2"'; 
        sudo='"true"';
        sudoPassword='"Drowssap"'
    );
}

4.22 - loop-1.4.0

KOSI Plugin loop Version 1.4.0

Changelog Plugin loop 1.4.0

Updates

  • update dependencies

Summary

The loop plugin allows you to repeatedly execute parts of your KOSI package yaml while iterating over a list. A iterator variable is used to access the current element in the list. Loop behaves similar to ‘for each’ in other languages.

Keys

Key Description
iterator Mandatory Allows a string representing any valid variable name.
The iterator allows you to specify the name of the variable containing the list item for the current repetition.
list Mandatory when listVar is not set set a list that you want to loop over in yaml format.
listVar Mandatory when list is not set set a valid variable which stored a list that was previously set by another plugin. Expects a string representing a valid variable that was previously set.
ListVar is an alternative to list allowing you to loop over a variable that contains a list and was set by another plugin.
tasks Mandatory set a list of plugins and their parameters.
Tasks acts the exact same way as the global list of tasks in your Package. All tasks will be repeated for every element of the list given to loop.

Example

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files = 
{
  input="template.yaml";
}

containers = 
{
    example=["docker.io", "nginx", "latest"];
}


install 
{  
    loop(iterator='"number"';list='["1","2","3"]')
    {
       fprint(message= '"Hello {0}"';variables='"number"');
    }
}
[ 06/18/2021 13:04:29 Info    default ] Hello 1
[ 06/18/2021 13:04:29 Info    default ] Hello 2
[ 06/18/2021 13:04:29 Info    default ] Hello 3

4.23 - merge-1.4.0

KOSI Plugin merge Version 1.4.0

Summary

The merge plugin allows to merge two files.
Currently only XML files are supported.

Keys

Key Description
backupPath A backup of file1 is created in this path.
file1 Mandatory This is the file that is used as the target for merging.
file2 Mandatory This is the source that will be added to target file1.

Note: If file2 is a file, then the file is used as source for merging. If file2 is a directory, then all files in the folder are used as source for merging.

Example

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files = 
{
  input="template.yaml";
}

containers = 
{
    example=["docker.io", "nginx", "latest"];
}


install 
{  
  merge(file1= '"myXML.xml"';file2='"/root/filesIwantToMergeDirectory/"';backupPath='"/root/backupPath/forFile1/"');
}

4.24 - osCheck-1.4.0

KOSI Plugin osCheck Version 1.4.0

Changelog Plugin osCheck 1.4.0

Bug Fixes

  • Fixed issue with osCheck Plugin where oscheck variables were not usable

Summary

With the osCheck plugin you can gather the name and version of the operating system on which the plugin is running.
The osCheck plugin saves its findings in temporary variables that are accessible to other plugins such as the fPrint plugin.

Keys

Key Description
getOSVar Mandatory set a variable_name in which the os name should be stored
getOSVersionVar Mandatory set a variable_name in which os version should be stored

Usage

In example below os name will be stored in temporary variable os and version name in variable ``version`.

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files = 
{
  input="template.yaml";
}

containers = 
{
    example=["docker.io", "nginx", "latest"];
}


install 
{  
  osCheck(getOSVar= '"os"';getOSVersionVar='"version"');
}

4.25 - packagemanager-1.4.0

KOSI Plugin packagemanager Version 1.4.0

Summary

With the packagemanager plugin you can install, remove and update packages for your operating system distribution as well as search for or list specific packages.

Requirements

This plugin only works with the following linux distributions and package managers:

  • CentOS (packagemanager: yum)
  • OpenSUSE (packagemanager: zypper)

Keys

Key Description
operation Mandatory Set the value to the packagemanager command you want to use. It takes only one command at a time.
packages Mandatory Set the packages that you want to execute the operation. You can list multiple packages (Refer example 2).
flags Optional It stores information on which options you want to enable. You have to confirm which options the package manager of your distribution allows. Examples for CentOS are “-y” for assumeyes or “-v” for verbose.The option “-y” is set by default. You can append multiple flags , Refer example 6.
sudo true/false If it is set to true, the Plugin will be execute with sudo privileges.
sudoPassword - If you set sudo true, sudoPassword is mandatory.

Usage

The examples below show usecases of this plugin on a CentOS machine.

Example 1 - Install a package or packages on your system

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files = 
{
  input="template.yaml";
}

containers = 
{
    example=["docker.io", "nginx", "latest"];
}


install 
{  
  packagemanager(operation= '"install"';packages='"nano containerd-1.4.10"';sudo='"True"';sudoPassword='"Drowssap"');
}

Example 2 - Update a package or packages on your system

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files = 
{
  input="template.yaml";
}

containers = 
{
    example=["docker.io", "nginx", "latest"];
}


install 
{  
  packagemanager(operation= '"update"';packages='"docker containerd"';sudo='"True"';sudoPassword='"Drowssap"');
}

Example 3 - Remove a package or packages on your system

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files = 
{
  input="template.yaml";
}

containers = 
{
    example=["docker.io", "nginx", "latest"];
}


install 
{  
  packagemanager(operation= '"remove"';packages='"nano"';sudo='"True"';sudoPassword='"Drowssap"');
}

Example 4 - List a package or groups of packages

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files = 
{
  input="template.yaml";
}

containers = 
{
    example=["docker.io", "nginx", "latest"];
}


install 
{  
  packagemanager(operation= '"list"';packages='"containerd"';sudo='"True"';sudoPassword='"Drowssap"');
}

Example 5 - Search package details for the given string

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files = 
{
  input="template.yaml";
}

containers = 
{
    example=["docker.io", "nginx", "latest"];
}


install 
{  
  packagemanager(operation= '"search"';packages='"kubernetes"';sudo='"True"';sudoPassword='"Drowssap"');
}

Example 6 - Use plugin keys consecutively

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files = 
{
  input="template.yaml";
}

containers = 
{
    example=["docker.io", "nginx", "latest"];
}


install 
{  
  packagemanager(operation= '"list"';packages='"kubeadm"';sudo='"True"';sudoPassword='"Drowssap"');
  packagemanager(operation= '"list"';packages='"kubeadm"';flags='"-y -v"';sudo='"True"';sudoPassword='"Drowssap"');
}

4.26 - pia-1.4.0

KOSI Plugin Pia Version 1.4.0

Summary

The cmd command calls either the bash plugin (the plugin that executes commands in the bash terminal in linux), or if not available the sh plugin (the plugin that executes commands in the sh terminal in linux) and passes the parameters through.
This plugin also supports chaining of multiple commands with the semicolon ; as a divider.

Keys

Key Description
mode Mandatory set mode which pia will user. Available modes are “ssh” and “k8s”
nodes Mandatory/Optional set nodes which pia will use. You have to set either nodes or labels.
labels Mandatory/Optional set labels which pia will use. You have to set either nodes or labels.
files - set the files which will be uploaded and used by pia.
command Mandatory set this to a command which pia will executed on the node.
user Mandatory/Optional have to be set if you use the mode ssh

Note: user key is only needed if you use the mode “ssh”

usage

Example 1 - SSH-Mode

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    pia(mode='"ssh"';nodes='["cluster2master1","cluster2master2"]';files='["template.yaml"]';command='"echo Hello World"';user='"root"');
    cmd(command='"echo Hello World"');
}

Result

This package will send you a Hello World to each node, which is set. The template.yaml will be uploaded to the nodes and the connection is under the root user.

Note: It is recommended that the user have root privileges

Example 2 - k8s Mode

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    cmd(command='"echo Using the cmd-plugin"');
    pia(mode='"k8s"';nodes='["cluster2master1","cluster2master2"]';files='["template.yaml"]';command='"echo Hello World"');

}

Result

The plugin creates a customressource.yaml in the KUBEOPSROOT/pia directory. The plugin uploads the files and deployes the customressource.yaml for the pia-operator.

[root@cluster2admin1 Test_Pia-Plugin]# kosi install -p package.tgz
2024-01-24 12:12:03 Info:      KOSI version: 2.9.0_Beta0_1704450448
2024-01-24 12:12:05 Info:      template.yaml start uploading to webserver.
2024-01-24 12:12:05 Info:      template.yaml successfully uploaded to webserver.
pia.kubeops.net/example-pia created
2024-01-24 12:12:08 Info:      Installation successful

Pia-Operator (Plugin based Infrastructure Administrator)

Installation

  1. create values.yaml with pullsecret
pullsecretRegistry: "https://registry.preprod.kubernative.net"
pullsecretUser: "<username>"
pullsecretPassword: "<userpassword>"
piaWebserverNodePort: 31213
  1. install the pia -operator package
kosi install --hub public kubeops/piaoperator:0.1.0 -f values.yaml

Use of the pia-operator

There are two ways to use the operator. First way is to use the pia-plugin like the example above. The second way ist to deploy a custom ressource.

Pia custom resource example

apiVersion: kubeops.net/v1alpha1
kind: Pia
metadata:
  name: hello-world
  namespace: pia-test
spec:
  command: "echo Hello world; sleep 60;"
  jobId: abcdef
  nodes:
  - cluster2worker1
  - cluster2worker3
  labels:
  #- kubeops-zone=zone2
  files:
  #- file1

4.27 - print-1.4.0

KOSI Plugin print Version 1.4.0

Summary

The print plugin allows you to print a message on the command line.

Keys

Key Description
message Mandatory set a message to be displayed on command line

Examples

Example 1 - printing a message

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    cmd(command='"echo Using the print-plugin"');
    print(message='"Printing example message with print plugin."');
}

Output

Using the print-plugin
2023-12-01 13:38:14 Info:      Printing example message with print plugin.

Example 2 - printing several messages

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}
install
{
    cmd(command='"echo Using the print-plugin"');
    print(message='"Printing example message with print plugin."');
    print(message='"Printing example message 2 with print plugin."');
}

Output

Using the print-plugin
2023-12-01 13:41:20 Info:      Printing example message with print plugin.
2023-12-01 13:41:20 Info:      Printing example message 2 with print plugin.

4.28 - service-1.4.0

KOSI Plugin service Version 1.4.0

Summary

With the service plugin you can start, stop, restart and display the current status of a system service.
It is based on the console command systemctl.

Keys

Key Description
name Mandatory Set the name of the service
status Mandatory Set the command you want to execute on the service. Supported commands: -
start to start the service.
stop to stop the service.
restart to restart the service.
status to show the current status of the service.
sudo true/false If it is set to true, the Plugin will be execute with sudo privileges.
sudoPassword - If you set sudo true, sudoPassword is mandatory.

Usage

Example 1 - start service

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    service(name='"httpd"'; state='"start"';sudo='"true"';sudoPassword='"Drowssap"');
}

Example 2 - stop service

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    service(name='"httpd"'; state='"stop"';sudo='"true"';sudoPassword='"Drowssap"');
}

Example 3 - restart service

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    service(name='"httpd"'; state='"restart"';sudo='"true"';sudoPassword='"Drowssap"');
}

Example 4 - show status of the service

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    service(name='"httpd"'; state='"status"';sudo='"true"';sudoPassword='"Drowssap"');
}

4.29 - sh-1.4.0

KOSI Plugin sh version 1.4.0

Summary

The sh plugin executes commands in the shell. Commands can either be written one below the other, or split by a “;”.

Keys

command

The value consists of a string, which represents a command line command. Multiple commands can be specified separated by a semicolon.

sudo (optional)

Set to true to execute the Plugin with sudo privileges.

sudoPassword (mandatory if you use sudo)

Set sudo password

Example

Example 1

Execute a single command

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-shell-package";
description = "kosi-example-shell-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

install
{
    sh(
        command='"echo hello world"'; 
    );
}

Example 2

Execute multiple commands

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-shell-package";
description = "kosi-example-shell-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

install
{
    sh(
        command='"echo foo; echo bar"'; 
    );
}

Example 3

Execute command with sudo

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-shell-package";
description = "kosi-example-shell-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

install
{
    sh(
        command='"reboot now"';
        sudo='"true"';
        sudoPassword='"topsecret"';
    );
}

Release-Notes

Version 0.0.2

New

  • nothing

Updates

  • update toolchain dependencies 1.0.15

Version 0.0.1

New

  • initial version

4.30 - sudo-1.4.0

KOSI Plugin sudo Version 1.4.0

Changelog Plugin sudo 1.4.0

Updates

  • update dependencies

Summary

With the sudo plugin you can execute commands with sudo privileges.
The sudo plugin has only one key: tasks. List all the plugins you want to execute with sudo priviledges under this key.
The following usage is supported:

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files = 
{
  input="template.yaml";
}

containers = 
{
    example=["docker.io", "nginx", "latest"];
}


install 
{ 
   cmd(command='"echo Using the sudo plugin."');
   sudo(password='"test"')
   {
     cmd(command='"touch ~/kosiExample1"');
   }
}

The sudo plugin does need a sudo password, if nopasswd is not set. If you have nopasswd set on your host. Then you do not need the password parameter.

Supported Plugins

4.31 - tempalte-1.4.0

KOSI Plugin template Version 1.4.0

Summary

By giving a template name and a saveTo-fileName we can read the corresponding template and save the generated file from the template engine to the process folder with the value of target.

Keys

target

The target file, where the the results of the templating will be written into.

Example template for using KOSI globals:

api: {{package.apiversion}}
package:
  name: {{package.name}}
  package: {{package.version}}
  file: {{package.includes.files.input}}
  container-registry: {{package.includes.containers.registry.image}}
values:
  values-ip0: {{values.ipNormal}}
  values-ip1: {{values.IPList[0]}}

tmpl

The tmpl key refers to the template .yaml file, which requests values from other files uses the templating.

Example

install
{
    template(tmpl='"template.yaml"'; target='"result.yaml"');
}

How to use the template engine

This template is based on scriban. (Click here for a Demo)

When you use kosi install -f…

kosi install -f uservalues.yaml

…the content of the stated yaml files will be written into the mergeduservalues.yaml. For the mergeduervalues.yaml the keyword is values, which references the content of the mergeduservalues.yaml.

Example for mergeduservalues.yaml:

IPList:
  - ip1: 127.0.0.1
  - ip2: 192.128.16.1
  - ip3: 192.128.18.14
ipNormal: 12.10.45.23

The template plugin can be used to read the content from the package.yaml and the mergeduservalues.yaml and write the requested values from the template.yaml into the file which is stated in the target parameter.

You can use a point structure to use values of keys in the yaml files.
The keyword for the package.yaml is package.

Example of a package.kosi:

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/kosi/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
  input="template.yaml";
}

containers =
{
    example=["docker.io", "nginx", "latest"];
}

install
{
    template(tmpl='"template.yaml"'; target='"result.yaml"');
}

The target path can also be an absolute path, for example /user/target.yaml.

So for example when you want the value of the name element in the package.yaml, you have to use package.name in the template.yaml.

name: {{package.name}}

The key can have any name.

It is important to know that you have to use the root element for navigating through the elements of a .yaml file. So for example the input-element in the package.yaml is accessible with package.includes.files.input, because the input-element is a subelement of the files-Tree in the includes-tree. Because the template.yaml is a yaml file, you have to use a key value structure, without the key-value structure the template engine cannot read the template.yaml.

Example for reading the value of input:

input_file: {{package.includes.files.input}}

4.32 - writeplugin

how to write a plugin

A plugin is a task a task that can be executed in a kosi package. The Plugins are selsected in the tasks tree in the batch.yaml. The plugin gets passed a parameter tree, which can be read in the plugin.

classes in the plugin

There are two important classes: the version class and the info class. An overview of the versions of the plugins is in the info class. The class must inherit from the iplugininfo class. a forwarding to the individual version classes is important: Also there is a function which returns a list with all versions of the plugin.

The Logic of the plugin lies in run method in the version class.
The run method gets a sandbox and the parameter-tree passed.

public void Run(ISandbox sandbox, ITree parameter) {

the lint function of the version class checks the tree for the plugin if the parameter-tree is correct. A function for returning the name and version of The plugin is also obligatory.

Sandbox is a class which contains data for the plugin. An example would be the storage space of the package.yaml, which defines the kosi package. You can also set variables in the sandbox.

ITree config = sandbox.GetVariable("config");

You can also get an instance of the logger from the sandbox. with the getlogginmanager() method you can access the logger.

sandbox.GetLoggingManager().Debug1("plugin-template", $"run template plugin");

The method after get logging menager determines the logging level. There are four logging levels:

  • info
  • debug1
  • debug2
  • debug3

The first parameter determines the channel. It is recommended that you name it after your plugin. The message for the logging is the second parameter.

The sandbox can create a instance of a fio file, which can be written on hard disk. This fio file has a Tree, which can be modified with the fio-tool.

IFile templateYaml = sandbox.NewFio();

the element of the tree can be accessed with the fio-tool. Fio is included in the toolchain.dll. These Tree have elements and/or subtrees. A element in Fio has only one key and an associated value.

string kosiFileName = (string)templateyaml.GetElement($"apiversion").Value;

when you want to access a subtree, you can use a point structure.

string kosiFileName = (string)templateyaml.GetElement($"import.files.{fileElement}").Value;

In contrast, a subtree can have multiple elements with associated values. “Value” is the keyword for using the value of the element-key.

ITree mergeduservalues = config.GetSubTree("mergedFioFiles");

You have to possibility to use other plugins, the sandbox has also the runPLugin() function. In this example we use the print plugin with a tree as a parameter for the print plugin. The tree have to be the same as the tree you use within the run tree in the batch.yaml for the plugin.

sandbox.RunPlugin("print", parameter);

the parameter-tree can be created with fio. the name of the plguin does not have to be within the parameter-tree. Fio has the option to set parameters, so for example the creation of the parameter-tree for the print-plugin can be like that:

Itree parameter = new Tree();
parameter.setElement("message","now the print plugin can be run!");
sandbox.RunPlugin("print", parameter);