Full Documentation KOSI-2.9.x

KubeOps KOSI

How to use KOSI

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

General commands

Overview of all KOSI commands

kosi:
  Kosi is a SoftwareINstAller for kubernetes cluster

Usage:
  Kosi [options] [command]

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

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

Command ‘kosi –help’

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

kosi --help

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

Command ‘kosi version’

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

kosi version

The output should be:

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

Command ‘kosi create’

Note: The command works in the current directory.

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

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

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

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

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

kosi create

Created files:

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

Command ‘kosi build’

Note: The command works in the current working directory.

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

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

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

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

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

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

kosi build

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

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

Command ‘kosi lint’

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

kosi lint

Command ‘kosi login’

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

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

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

kosi login -u <username>

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

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

-u flag

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

kosi login -u

This parameter is required.

-p flag

The -p parameter is used to specify the password.

kosi login -p

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

Command ‘kosi logout’

The kosi logout command logs out from the KubeOps services.

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

kosi logout

Command ‘kosi push’

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

kosi push --hub <hubname>

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

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

–hub flag

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

kosi push --hub public

Command ‘kosi pull’

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

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

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

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

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

Example:

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

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

–hub flag

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

kosi pull --hub public kubeops/harbor:1.1.0  

-r flag

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

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

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

Example:

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

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

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

-t flag

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

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

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

Example:

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

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

KOSI_retag_registry

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

kosi search --hub <hubname>

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

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

–ps flag

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

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

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

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

–hub flag

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

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

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

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

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

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

Command ‘kosi encrypt’

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

-f flag

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

This parameter is required.

kosi encrypt -f <user.yaml>

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

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

Command ‘kosi install’

The kosi install command installs a KOSI package:

kosi install --hub <hubname> <package>

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

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

kosi install --hub public kosi/livedemo:2.7.1 

–hub flag

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

kosi install --hub <hubname> <package>

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

kosi install --hub public kosi/livedemo:2.7.1

-p flag

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

kosi install -p package.kosi

-f flag

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

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

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

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

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

–cf flag

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

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

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

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

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

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

Example:

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

–namespace flag

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

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

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

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

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

–dname flag

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

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

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

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

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

Command ‘kosi list’

The kosi list command lists all installed KOSI packages:

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

Command ‘kosi update’

The kosi update command updates an already installed KOSI package:

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

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

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

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

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

–hub flag

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

kosi update --hub <hubname> <package>

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

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

-p flag

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

kosi update -p package.tgz

-f flag

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

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

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

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

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

–cf flag

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

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

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

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

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

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

Example:

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

–namespace flag

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

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

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

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

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

–dname flag

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

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

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

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

Command ‘kosi delete’

The kosi delete command deletes an already installed KOSI package:

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

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

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

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

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

–hub flag

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

kosi delete --hub <hubname> <package>

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

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

-p flag

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

kosi delete -p package.tgz

-f flag

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

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

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

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

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

–cf flag

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

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

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

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

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

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

Example:

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

–namespace flag

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

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

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

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

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

–dname flag

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

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

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

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

Command ‘kosi remove’

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

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

kosi remove --hub <hubname> <package>

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

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

kosi remove --hub public kosi/livedemo:2.7.1 

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

Command ‘kosi check’

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

kosi check -p <localpackagename> <sha256 hash>

Example:

kosi check -p examplepackage c83f3db9639e175f82e7d07d342533866873e2d9ca2f0fd5ee607ea395417edb

File Formats

package.kosi

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

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

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

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

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

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

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

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

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

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

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

package.yaml

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

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

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

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

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

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

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

default.yaml

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

config.yaml

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

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

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

Usage

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

$KUBEOPSROOT Variable

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

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

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

How to use templating within the package.kosi

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

First we need to create this package.kosi:

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

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

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

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

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

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

Now we create a template.yaml:

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

Next we create a default.yaml:

example: example
target: target.yaml

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

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

kosi build

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

kosi install -p package.tgz --dname example

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

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

the content of target.yaml is:

package:
  file: template.yaml
  uservalues: example

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

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

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

Plugins

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