diff --git a/docs/crds/Makefile b/docs/crds/Makefile
new file mode 100644
index 0000000..93df3d7
--- /dev/null
+++ b/docs/crds/Makefile
@@ -0,0 +1,6 @@
+CRD_REF_DOCS_VER := v0.1.0
+CRD_REF_DOCS := go run github.com/elastic/crd-ref-docs@$(CRD_REF_DOCS_VER)
+
+.PHONY: generate
+generate:
+ $(CRD_REF_DOCS) --config=config.yaml --renderer=markdown --source-path=../../pkg/apis/k3k.io/v1alpha1 --output-path=crd-docs.md
diff --git a/docs/crds/config.yaml b/docs/crds/config.yaml
new file mode 100644
index 0000000..981a835
--- /dev/null
+++ b/docs/crds/config.yaml
@@ -0,0 +1,14 @@
+processor:
+ # RE2 regular expressions describing types that should be excluded from the generated documentation.
+ ignoreTypes:
+ - ClusterSet
+ - ClusterSetList
+
+ # RE2 regular expressions describing type fields that should be excluded from the generated documentation.
+ ignoreFields:
+ - "status$"
+ - "TypeMeta$"
+
+render:
+ # Version of Kubernetes to use when generating links to Kubernetes API documentation.
+ kubernetesVersion: "1.31"
diff --git a/docs/crds/crd-docs.md b/docs/crds/crd-docs.md
new file mode 100644
index 0000000..959347a
--- /dev/null
+++ b/docs/crds/crd-docs.md
@@ -0,0 +1,299 @@
+# API Reference
+
+## Packages
+- [k3k.io/v1alpha1](#k3kiov1alpha1)
+
+
+## k3k.io/v1alpha1
+
+
+### Resource Types
+- [Cluster](#cluster)
+- [ClusterList](#clusterlist)
+- [ClusterSet](#clusterset)
+- [ClusterSetList](#clustersetlist)
+
+
+
+#### Addon
+
+
+
+
+
+
+
+_Appears in:_
+- [ClusterSpec](#clusterspec)
+
+| Field | Description | Default | Validation |
+| --- | --- | --- | --- |
+| `secretNamespace` _string_ | | | |
+| `secretRef` _string_ | | | |
+
+
+#### Cluster
+
+
+
+
+
+
+
+_Appears in:_
+- [ClusterList](#clusterlist)
+
+| Field | Description | Default | Validation |
+| --- | --- | --- | --- |
+| `apiVersion` _string_ | `k3k.io/v1alpha1` | | |
+| `kind` _string_ | `Cluster` | | |
+| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | |
+| `spec` _[ClusterSpec](#clusterspec)_ | | \{ \} | |
+
+
+#### ClusterLimit
+
+
+
+
+
+
+
+_Appears in:_
+- [ClusterSetSpec](#clustersetspec)
+- [ClusterSpec](#clusterspec)
+
+| Field | Description | Default | Validation |
+| --- | --- | --- | --- |
+| `serverLimit` _[ResourceList](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#resourcelist-v1-core)_ | ServerLimit is the limits (cpu/mem) that apply to the server nodes | | |
+| `workerLimit` _[ResourceList](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#resourcelist-v1-core)_ | WorkerLimit is the limits (cpu/mem) that apply to the agent nodes | | |
+
+
+#### ClusterList
+
+
+
+
+
+
+
+
+
+| Field | Description | Default | Validation |
+| --- | --- | --- | --- |
+| `apiVersion` _string_ | `k3k.io/v1alpha1` | | |
+| `kind` _string_ | `ClusterList` | | |
+| `metadata` _[ListMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#listmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | |
+| `items` _[Cluster](#cluster) array_ | | | |
+
+
+#### ClusterMode
+
+_Underlying type:_ _string_
+
+ClusterMode is the possible provisioning mode of a Cluster.
+
+_Validation:_
+- Enum: [shared virtual]
+
+_Appears in:_
+- [ClusterSetSpec](#clustersetspec)
+- [ClusterSpec](#clusterspec)
+
+
+
+#### ClusterSet
+
+
+
+
+
+
+
+_Appears in:_
+- [ClusterSetList](#clustersetlist)
+
+| Field | Description | Default | Validation |
+| --- | --- | --- | --- |
+| `apiVersion` _string_ | `k3k.io/v1alpha1` | | |
+| `kind` _string_ | `ClusterSet` | | |
+| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | |
+| `spec` _[ClusterSetSpec](#clustersetspec)_ | Spec is the spec of the ClusterSet | \{ \} | |
+
+
+#### ClusterSetList
+
+
+
+
+
+
+
+
+
+| Field | Description | Default | Validation |
+| --- | --- | --- | --- |
+| `apiVersion` _string_ | `k3k.io/v1alpha1` | | |
+| `kind` _string_ | `ClusterSetList` | | |
+| `metadata` _[ListMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#listmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | |
+| `items` _[ClusterSet](#clusterset) array_ | | | |
+
+
+#### ClusterSetSpec
+
+
+
+
+
+
+
+_Appears in:_
+- [ClusterSet](#clusterset)
+
+| Field | Description | Default | Validation |
+| --- | --- | --- | --- |
+| `maxLimits` _[ResourceList](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#resourcelist-v1-core)_ | MaxLimits are the limits that apply to all clusters (server + agent) in the set | | |
+| `defaultLimits` _[ClusterLimit](#clusterlimit)_ | DefaultLimits are the limits used for servers/agents when a cluster in the set doesn't provide any | | |
+| `defaultNodeSelector` _object (keys:string, values:string)_ | DefaultNodeSelector is the node selector that applies to all clusters (server + agent) in the set | | |
+| `defaultPriorityClass` _string_ | DefaultPriorityClass is the priorityClassName applied to all pods of all clusters in the set | | |
+| `disableNetworkPolicy` _boolean_ | DisableNetworkPolicy is an option that will disable the creation of a default networkpolicy for cluster isolation | | |
+| `allowedNodeTypes` _[ClusterMode](#clustermode) array_ | AllowedNodeTypes are the allowed cluster provisioning modes. Defaults to [shared]. | [shared] | Enum: [shared virtual]
MinItems: 1
|
+| `podSecurityAdmissionLevel` _[PodSecurityAdmissionLevel](#podsecurityadmissionlevel)_ | PodSecurityAdmissionLevel is the policy level applied to the pods in the namespace. | | Enum: [privileged baseline restricted]
|
+
+
+
+
+#### ClusterSpec
+
+
+
+
+
+
+
+_Appears in:_
+- [Cluster](#cluster)
+
+| Field | Description | Default | Validation |
+| --- | --- | --- | --- |
+| `version` _string_ | Version is a string representing the Kubernetes version to be used by the virtual nodes. | | |
+| `servers` _integer_ | Servers is the number of K3s pods to run in server (controlplane) mode. | 1 | |
+| `agents` _integer_ | Agents is the number of K3s pods to run in agent (worker) mode. | 0 | |
+| `nodeSelector` _object (keys:string, values:string)_ | NodeSelector is the node selector that will be applied to all server/agent pods.
In "shared" mode the node selector will be applied also to the workloads. | | |
+| `priorityClass` _string_ | PriorityClass is the priorityClassName that will be applied to all server/agent pods.
In "shared" mode the priorityClassName will be applied also to the workloads. | | |
+| `clusterLimit` _[ClusterLimit](#clusterlimit)_ | Limit is the limits that apply for the server/worker nodes. | | |
+| `tokenSecretRef` _[SecretReference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#secretreference-v1-core)_ | TokenSecretRef is Secret reference used as a token join server and worker nodes to the cluster. The controller
assumes that the secret has a field "token" in its data, any other fields in the secret will be ignored. | | |
+| `clusterCIDR` _string_ | ClusterCIDR is the CIDR range for the pods of the cluster. Defaults to 10.42.0.0/16. | | |
+| `serviceCIDR` _string_ | ServiceCIDR is the CIDR range for the services in the cluster. Defaults to 10.43.0.0/16. | | |
+| `clusterDNS` _string_ | ClusterDNS is the IP address for the coredns service. Needs to be in the range provided by ServiceCIDR or CoreDNS may not deploy.
Defaults to 10.43.0.10. | | |
+| `serverArgs` _string array_ | ServerArgs are the ordered key value pairs (e.x. "testArg", "testValue") for the K3s pods running in server mode. | | |
+| `agentArgs` _string array_ | AgentArgs are the ordered key value pairs (e.x. "testArg", "testValue") for the K3s pods running in agent mode. | | |
+| `tlsSANs` _string array_ | TLSSANs are the subjectAlternativeNames for the certificate the K3s server will use. | | |
+| `addons` _[Addon](#addon) array_ | Addons is a list of secrets containing raw YAML which will be deployed in the virtual K3k cluster on startup. | | |
+| `mode` _[ClusterMode](#clustermode)_ | Mode is the cluster provisioning mode which can be either "shared" or "virtual". Defaults to "shared" | shared | Enum: [shared virtual]
|
+| `persistence` _[PersistenceConfig](#persistenceconfig)_ | Persistence contains options controlling how the etcd data of the virtual cluster is persisted. By default, no data
persistence is guaranteed, so restart of a virtual cluster pod may result in data loss without this field. | | |
+| `expose` _[ExposeConfig](#exposeconfig)_ | Expose contains options for exposing the apiserver inside/outside of the cluster. By default, this is only exposed as a
clusterIP which is relatively secure, but difficult to access outside of the cluster. | | |
+
+
+
+
+#### ExposeConfig
+
+
+
+
+
+
+
+_Appears in:_
+- [ClusterSpec](#clusterspec)
+
+| Field | Description | Default | Validation |
+| --- | --- | --- | --- |
+| `ingress` _[IngressConfig](#ingressconfig)_ | | | |
+| `loadbalancer` _[LoadBalancerConfig](#loadbalancerconfig)_ | | | |
+| `nodePort` _[NodePortConfig](#nodeportconfig)_ | | | |
+
+
+#### IngressConfig
+
+
+
+
+
+
+
+_Appears in:_
+- [ExposeConfig](#exposeconfig)
+
+| Field | Description | Default | Validation |
+| --- | --- | --- | --- |
+| `enabled` _boolean_ | | | |
+| `ingressClassName` _string_ | | | |
+
+
+#### LoadBalancerConfig
+
+
+
+
+
+
+
+_Appears in:_
+- [ExposeConfig](#exposeconfig)
+
+| Field | Description | Default | Validation |
+| --- | --- | --- | --- |
+| `enabled` _boolean_ | | | |
+
+
+#### NodePortConfig
+
+
+
+
+
+
+
+_Appears in:_
+- [ExposeConfig](#exposeconfig)
+
+| Field | Description | Default | Validation |
+| --- | --- | --- | --- |
+| `enabled` _boolean_ | | | |
+
+
+#### PersistenceConfig
+
+
+
+
+
+
+
+_Appears in:_
+- [ClusterSpec](#clusterspec)
+- [ClusterStatus](#clusterstatus)
+
+| Field | Description | Default | Validation |
+| --- | --- | --- | --- |
+| `type` _string_ | Type can be ephemeral, static, dynamic | ephemeral | |
+| `storageClassName` _string_ | | | |
+| `storageRequestSize` _string_ | | | |
+
+
+#### PodSecurityAdmissionLevel
+
+_Underlying type:_ _string_
+
+PodSecurityAdmissionLevel is the policy level applied to the pods in the namespace.
+
+_Validation:_
+- Enum: [privileged baseline restricted]
+
+_Appears in:_
+- [ClusterSetSpec](#clustersetspec)
+
+
+
diff --git a/pkg/apis/k3k.io/v1alpha1/register.go b/pkg/apis/k3k.io/v1alpha1/register.go
index 6c2a6f6..6fb0e83 100644
--- a/pkg/apis/k3k.io/v1alpha1/register.go
+++ b/pkg/apis/k3k.io/v1alpha1/register.go
@@ -7,11 +7,10 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema"
)
-var SchemeGroupVersion = schema.GroupVersion{Group: k3k.GroupName, Version: "v1alpha1"}
-
var (
- SchemBuilder = runtime.NewSchemeBuilder(addKnownTypes)
- AddToScheme = SchemBuilder.AddToScheme
+ SchemeGroupVersion = schema.GroupVersion{Group: k3k.GroupName, Version: "v1alpha1"}
+ SchemBuilder = runtime.NewSchemeBuilder(addKnownTypes)
+ AddToScheme = SchemBuilder.AddToScheme
)
func Resource(resource string) schema.GroupResource {
diff --git a/pkg/apis/k3k.io/v1alpha1/set_types.go b/pkg/apis/k3k.io/v1alpha1/set_types.go
index 557256f..5cddfb4 100644
--- a/pkg/apis/k3k.io/v1alpha1/set_types.go
+++ b/pkg/apis/k3k.io/v1alpha1/set_types.go
@@ -9,7 +9,7 @@ import (
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:storageversion
// +kubebuilder:subresource:status
-
+// +kubebuilder:object:root=true
type ClusterSet struct {
metav1.ObjectMeta `json:"metadata,omitempty"`
metav1.TypeMeta `json:",inline"`
@@ -77,7 +77,7 @@ type ClusterSetStatus struct {
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-
+// +kubebuilder:object:root=true
type ClusterSetList struct {
metav1.ListMeta `json:"metadata,omitempty"`
metav1.TypeMeta `json:",inline"`
diff --git a/pkg/apis/k3k.io/v1alpha1/types.go b/pkg/apis/k3k.io/v1alpha1/types.go
index 01de3b6..3279cb3 100644
--- a/pkg/apis/k3k.io/v1alpha1/types.go
+++ b/pkg/apis/k3k.io/v1alpha1/types.go
@@ -7,9 +7,9 @@ import (
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
+// +kubebuilder:object:root=true
// +kubebuilder:storageversion
// +kubebuilder:subresource:status
-
type Cluster struct {
metav1.ObjectMeta `json:"metadata,omitempty"`
metav1.TypeMeta `json:",inline"`
@@ -125,7 +125,7 @@ type Addon struct {
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-
+// +kubebuilder:object:root=true
type ClusterList struct {
metav1.ListMeta `json:"metadata,omitempty"`
metav1.TypeMeta `json:",inline"`