MetalK8s Solutions are a concept mostly centered around the Operator pattern. While there is no explicit requirements except the ones described below (see solution-operator-requirements
), we recommend using the Operator SDK as it will embed best practices from the Kubernetes community.
All Operator-related files except for the container images (see solution-archive-images
) should be stored under /operator
in the ISO archive. Those files should be organized as follows:
operator
└── deploy
├── crds
│ └── some_crd.yaml
└── role.yaml
Most of these files are generated when using the Operator SDK.
MetalK8s does not handle the monitoring of a Solution application, which means:
- the user, manually or through the Solution UI, should create
Service
andServiceMonitor
objects for each Operator instance - Operators should create
Service
andServiceMonitor
objects for each deployed component they own
The Prometheus Operator deployed by MetalK8s has cluster-scoped permissions, and is able to read the aforementioned ServiceMonitor
objects to set up monitoring of your application services.
Solution Operator must implement a --config
option which will be used by MetalK8s to provide various useful information needed by the Operator, such as the endpoints for the container images. The given configuration looks like:
apiVersion: solutions.metalk8s.scality.com/v1alpha1
kind: OperatorConfig
repositories:
<solution-version-x>:
- endpoint: metalk8s-registry/<solution-name>-<solution-version-x>
images:
- <image-x>:<tag-x>
- <image-y>:<tag-y>
<solution-version-y>:
- endpoint: metalk8s-registry/<solution-name>-<solution-version-y>
images:
- <image-x>:<tag-x>
- <image-y>:<tag-y>
In example, for an online installation without MetalK8s providing the repository, this configuration could be:
apiVersion: solutions.metalk8s.scality.com/v1alpha1
kind: OperatorConfig
repositories:
1.0.0:
- endpoint: registry.scality.com/zenko
images:
- cloudserver:1.0.0
- zenko-quorum:1.0.0
- endpoint: quay.io/coreos
images:
- prometheus-operator:v0.34.0
This configuration allows the Operator to retrieve dynamically where the container images are stored for each version of a given Solution.
Solution must ship a role.yaml
file located in /operator/deploy
directory. This file is a manifest which declares all necessary Role
and ClusterRole
objects needed by the Operator. MetalK8s will take care of deploying these objects, create a ServiceAccount
named <solution_name>-operator
and all needed RoleBinding
to bind these roles to this account.
Warning
Only Role
and ClusterRole
kinds are allowed in this file, the deployment of the Solution fails if any other resource is found.