Overview
This repository contains code for a Kubernetes SylvaWorkloadCluster CRD and operator that provides a declarative API for defining and managing the desired state of Sylva workload clusters and ensuring that the actual state of the clusters matches the desired state.
Users define workload clusters through YAML files, specifying configuration details such as k8s version, desired infrastructure platform, machine details, or enabled units. The operator handles the creation, update, scaling, and deletion of clusters, abstracting away the complexity involved in managing workload clusters, making it more accessible to users without deep Kubernetes expertise.
This operator uses another CRD, SylvaUnitsRelease to manage the creation of a FluxCD HelmRelease for the sylva-units Helm chart, which encapsulates the desired state and configuration of Sylva workload clusters.
Details about how to pass values to the final HelmRelease
You can define values that will be consumed by the final HelmRelease in several fields of a SylvaWorkloadCluster custom resource.
In order of priority, they are as follows:
- Named resource fields like
SylvaSourceVersion or Infrastructure (most are optional)
ClusterSettings - an object mapped to:
spec.values.cluster field in the SylvaUnitsRelease
cluster field in the sylva-units values
OverridingValues - an object mapped to:
spec.values field in the SylvaUnitsRelease
- the sylva-units values
This allows you to override any value except those set in
ClusterSettings or named CRD fields
ValuesFrom items – ConfigMaps, Secrets, External Secrets, Git repositories, or OCI repositories (see the [API](https://gitlab.com/sylva-projects/sylva-elements/workload-cluster-operator/-/blob/main/api/v1alpha1/sylvaworkloadcluster_types.go?ref_type=heads] for the full list). Each item is mapped to:
- A
valuesFrom item in the SylvaUnitsRelease
- A
valuesFrom item in the HelmRelease SylvaUnitsRelease
Presets – a SylvaUnitsReleasePrest that defines values and a valuesFrom list.
Example
The CAPI infrastructure provider can be defined (with more and more priority)
- In the values of a preset listed in the
presets field
- In an OCI repository listed in the
valuesFrom field
- In the
ClusterSettings field
- In the
Infrastructure field
Typical use cases are:
- The SylvaWorkloadCluster explicitly defines the infrastructure provider
- The management cluster admin has defined the target infrastructure in a preset, and people declaring a SylvaWorkloadCluster do not need to worry about the underlying infrastructure (they only need a running cluster)
Other examples
In the operator end to end tests, one can find further tests