This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

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.

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/"');
}

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.

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 - 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!

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"');
}

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”)

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"');
}

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! ⚠️

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"');
}

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"');
}

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

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"');
}

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"');
}

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"]"');
}

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"]'); 
}

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"');
}

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.

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"');
}

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"');
}

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");
}

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"'
    );
}

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

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/"');
}

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"');
}

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"');
}

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

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.

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"');
}

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

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

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}}

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);