Create Kosi package
3 minute read
Creating Kosi package
kosi create
To create a Kosi package, you must first run the kosi create
command in your directory.
The kosi create
command creates four files (package.yaml, template.yaml, logo.png and docs.tgz) in the current directory. These files can be edited.
[root@localhost ~]# kosi create
Created files:
- package.yaml - Defines properties of the Kosi package. (see below)
- template.yaml - Required if the template engine Scriban is to be used.
- logo.png - A package-thumbnail with the size of 50x50px, for showing logo on the KubeOpsHub.
- docs.tgz - A zipped directory with the documentation of the package, for showing documentation on the KubeOpsHub.
The documentation of the package is written in markdown. The file for the documentation is called readme.md.
To edit the markdown, you can unzip the docs.tgz in your directory with the commandtar -xzf docs.tgz
and zip it again with the commandtar -czf docs.tgz docs/
after you finished.
Note: Please name your markdown files inside docs.tgz without a version-tag (docs/documentation-1.0.0.md).
Do not change the file names of any of the files above generated with thekosi create
command.
package.yaml
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.
Elements:
includes.files
: Describes the files which are inluded in the Kosi package.includes.containers
: Used for docker images. A container for the docker images will be created when thekosi install
,kosi update
orkosi delete
command is used.installation.tasks
: The tree describes the tasks (Kosi plugins), which are executed with thekosi install
command.update.tasks
: The tree describes the tasks (Kosi plugins), which are executed with thekosi update
command.delete.tasks
: The tree describes the tasks (Kosi plugins), which are executed with thekosi delete
command.
IMPORTANT: It is required to enter the package name in lowercase.
Do not use any docker tags (:v1.0.0) in your package name.
Example package.yaml
apiversion: kubernative/kubeops/sina/user/v3 # Required field
name: kosi-example-packagev3 # Required field
description: kosi-example-package # Required field
version: 0.1.0 # Required field
includes: # Required field: When "files" or "containers" are needed.
files: # Optional field: IF file is attached, e.g. "rpm, .extension"
input: "template.yaml"
containers: # Optional field: When "containers" are needed.
example:
registry: docker.io
image: nginx
tag: latest
docs: docs.tgz
logo: logo.png
installation: # Required field
includes: # Optional field: When "files" or "containers" are needed.
files: # Optional field:
- input # Reference to includes
containers: # Optional field:
- example # Reference to includes
tasks:
- cmd:
command: "touch ~/kosiExample1"
update: # Required field
includes: # Optional field: When "files" or "containers" are needed.
files: # Optional field:
- input # Reference to includes
containers: # Optional field:
- example # Reference to includes
tasks:
- cmd:
command: "touch ~/kosiExample2"
delete: # Required field
includes: # Optional field: When "files" or "containers" are needed.
files: # Optional field:
- input # Reference to includes
containers: # Optional field:
- example # Reference to includes
tasks:
- cmd:
command: "rm ~/kosiExample1"
- cmd:
command: "rm ~/kosiExample2"
kosi build
Now, after you created and edited the files from kosi create
, you can simply build a Kosi package by just running the kosi build
command in your directory.
[root@localhost ~]# kosi build
All files specified in the package.yaml are combined together with the package.yaml to form a kosi package.
In these few steps, you can successfully create and use the kosi package. This is the basic functionality offered by Kosi.
You can always explore Full Documentation to go through all the functionality and features provided by Kosi.