Skip to content

Commit 7ca554f

Browse files
committed
added crd-ref-docs tool for CRDs documentation
1 parent 8982031 commit 7ca554f

File tree

6 files changed

+249
-8
lines changed

6 files changed

+249
-8
lines changed

Diff for: docs/crds/Makefile

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CRD_REF_DOCS_VER := v0.1.0
2+
CRD_REF_DOCS := go run github.com/elastic/crd-ref-docs@$(CRD_REF_DOCS_VER)
3+
4+
.PHONY: generate
5+
generate:
6+
$(CRD_REF_DOCS) --config=config.yaml --renderer=markdown --source-path=../../pkg/apis/k3k.io/v1alpha1 --output-path=crd-docs.md

Diff for: docs/crds/config.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
processor:
2+
# RE2 regular expressions describing types that should be excluded from the generated documentation.
3+
ignoreTypes:
4+
- ClusterSet
5+
- ClusterSetList
6+
7+
# RE2 regular expressions describing type fields that should be excluded from the generated documentation.
8+
ignoreFields:
9+
- "status$"
10+
- "TypeMeta$"
11+
12+
render:
13+
# Version of Kubernetes to use when generating links to Kubernetes API documentation.
14+
kubernetesVersion: "1.31"

Diff for: docs/crds/crd-docs.md

+222
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,222 @@
1+
# API Reference
2+
3+
## Packages
4+
- [k3k.io/v1alpha1](#k3kiov1alpha1)
5+
6+
7+
## k3k.io/v1alpha1
8+
9+
10+
### Resource Types
11+
- [Cluster](#cluster)
12+
- [ClusterList](#clusterlist)
13+
14+
15+
16+
#### Addon
17+
18+
19+
20+
21+
22+
23+
24+
_Appears in:_
25+
- [ClusterSpec](#clusterspec)
26+
27+
| Field | Description | Default | Validation |
28+
| --- | --- | --- | --- |
29+
| `secretNamespace` _string_ | | | |
30+
| `secretRef` _string_ | | | |
31+
32+
33+
#### Cluster
34+
35+
36+
37+
38+
39+
40+
41+
_Appears in:_
42+
- [ClusterList](#clusterlist)
43+
44+
| Field | Description | Default | Validation |
45+
| --- | --- | --- | --- |
46+
| `apiVersion` _string_ | `k3k.io/v1alpha1` | | |
47+
| `kind` _string_ | `Cluster` | | |
48+
| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | |
49+
| `spec` _[ClusterSpec](#clusterspec)_ | | \{ \} | |
50+
51+
52+
#### ClusterLimit
53+
54+
55+
56+
57+
58+
59+
60+
_Appears in:_
61+
- [ClusterSpec](#clusterspec)
62+
63+
| Field | Description | Default | Validation |
64+
| --- | --- | --- | --- |
65+
| `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 | | |
66+
| `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 | | |
67+
68+
69+
#### ClusterList
70+
71+
72+
73+
74+
75+
76+
77+
78+
79+
| Field | Description | Default | Validation |
80+
| --- | --- | --- | --- |
81+
| `apiVersion` _string_ | `k3k.io/v1alpha1` | | |
82+
| `kind` _string_ | `ClusterList` | | |
83+
| `metadata` _[ListMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#listmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | |
84+
| `items` _[Cluster](#cluster) array_ | | | |
85+
86+
87+
#### ClusterMode
88+
89+
_Underlying type:_ _string_
90+
91+
ClusterMode is the possible provisioning mode of a Cluster.
92+
93+
_Validation:_
94+
- Enum: [shared virtual]
95+
96+
_Appears in:_
97+
- [ClusterSpec](#clusterspec)
98+
99+
100+
101+
#### ClusterSpec
102+
103+
104+
105+
106+
107+
108+
109+
_Appears in:_
110+
- [Cluster](#cluster)
111+
112+
| Field | Description | Default | Validation |
113+
| --- | --- | --- | --- |
114+
| `version` _string_ | Version is a string representing the Kubernetes version to be used by the virtual nodes. | | |
115+
| `servers` _integer_ | Servers is the number of K3s pods to run in server (controlplane) mode. | 1 | |
116+
| `agents` _integer_ | Agents is the number of K3s pods to run in agent (worker) mode. | 0 | |
117+
| `nodeSelector` _object (keys:string, values:string)_ | NodeSelector is the node selector that will be applied to all server/agent pods.<br />In "shared" mode the node selector will be applied also to the workloads. | | |
118+
| `priorityClass` _string_ | PriorityClass is the priorityClassName that will be applied to all server/agent pods.<br />In "shared" mode the priorityClassName will be applied also to the workloads. | | |
119+
| `clusterLimit` _[ClusterLimit](#clusterlimit)_ | Limit is the limits that apply for the server/worker nodes. | | |
120+
| `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<br />assumes that the secret has a field "token" in its data, any other fields in the secret will be ignored. | | |
121+
| `clusterCIDR` _string_ | ClusterCIDR is the CIDR range for the pods of the cluster. Defaults to 10.42.0.0/16. | | |
122+
| `serviceCIDR` _string_ | ServiceCIDR is the CIDR range for the services in the cluster. Defaults to 10.43.0.0/16. | | |
123+
| `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.<br />Defaults to 10.43.0.10. | | |
124+
| `serverArgs` _string array_ | ServerArgs are the ordered key value pairs (e.x. "testArg", "testValue") for the K3s pods running in server mode. | | |
125+
| `agentArgs` _string array_ | AgentArgs are the ordered key value pairs (e.x. "testArg", "testValue") for the K3s pods running in agent mode. | | |
126+
| `tlsSANs` _string array_ | TLSSANs are the subjectAlternativeNames for the certificate the K3s server will use. | | |
127+
| `addons` _[Addon](#addon) array_ | Addons is a list of secrets containing raw YAML which will be deployed in the virtual K3k cluster on startup. | | |
128+
| `mode` _[ClusterMode](#clustermode)_ | Mode is the cluster provisioning mode which can be either "shared" or "virtual". Defaults to "shared" | shared | Enum: [shared virtual] <br /> |
129+
| `persistence` _[PersistenceConfig](#persistenceconfig)_ | Persistence contains options controlling how the etcd data of the virtual cluster is persisted. By default, no data<br />persistence is guaranteed, so restart of a virtual cluster pod may result in data loss without this field. | | |
130+
| `expose` _[ExposeConfig](#exposeconfig)_ | Expose contains options for exposing the apiserver inside/outside of the cluster. By default, this is only exposed as a<br />clusterIP which is relatively secure, but difficult to access outside of the cluster. | | |
131+
132+
133+
134+
135+
#### ExposeConfig
136+
137+
138+
139+
140+
141+
142+
143+
_Appears in:_
144+
- [ClusterSpec](#clusterspec)
145+
146+
| Field | Description | Default | Validation |
147+
| --- | --- | --- | --- |
148+
| `ingress` _[IngressConfig](#ingressconfig)_ | | | |
149+
| `loadbalancer` _[LoadBalancerConfig](#loadbalancerconfig)_ | | | |
150+
| `nodePort` _[NodePortConfig](#nodeportconfig)_ | | | |
151+
152+
153+
#### IngressConfig
154+
155+
156+
157+
158+
159+
160+
161+
_Appears in:_
162+
- [ExposeConfig](#exposeconfig)
163+
164+
| Field | Description | Default | Validation |
165+
| --- | --- | --- | --- |
166+
| `enabled` _boolean_ | | | |
167+
| `ingressClassName` _string_ | | | |
168+
169+
170+
#### LoadBalancerConfig
171+
172+
173+
174+
175+
176+
177+
178+
_Appears in:_
179+
- [ExposeConfig](#exposeconfig)
180+
181+
| Field | Description | Default | Validation |
182+
| --- | --- | --- | --- |
183+
| `enabled` _boolean_ | | | |
184+
185+
186+
#### NodePortConfig
187+
188+
189+
190+
191+
192+
193+
194+
_Appears in:_
195+
- [ExposeConfig](#exposeconfig)
196+
197+
| Field | Description | Default | Validation |
198+
| --- | --- | --- | --- |
199+
| `enabled` _boolean_ | | | |
200+
201+
202+
#### PersistenceConfig
203+
204+
205+
206+
207+
208+
209+
210+
_Appears in:_
211+
- [ClusterSpec](#clusterspec)
212+
- [ClusterStatus](#clusterstatus)
213+
214+
| Field | Description | Default | Validation |
215+
| --- | --- | --- | --- |
216+
| `type` _string_ | Type can be ephemeral, static, dynamic | ephemeral | |
217+
| `storageClassName` _string_ | | | |
218+
| `storageRequestSize` _string_ | | | |
219+
220+
221+
222+

Diff for: pkg/apis/k3k.io/v1alpha1/register.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@ import (
77
"k8s.io/apimachinery/pkg/runtime/schema"
88
)
99

10-
var SchemeGroupVersion = schema.GroupVersion{Group: k3k.GroupName, Version: "v1alpha1"}
11-
1210
var (
13-
SchemBuilder = runtime.NewSchemeBuilder(addKnownTypes)
14-
AddToScheme = SchemBuilder.AddToScheme
11+
SchemeGroupVersion = schema.GroupVersion{Group: k3k.GroupName, Version: "v1alpha1"}
12+
SchemBuilder = runtime.NewSchemeBuilder(addKnownTypes)
13+
AddToScheme = SchemBuilder.AddToScheme
1514
)
1615

1716
func Resource(resource string) schema.GroupResource {

Diff for: pkg/apis/k3k.io/v1alpha1/set_types.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
1010
// +kubebuilder:storageversion
1111
// +kubebuilder:subresource:status
12-
12+
// +kubebuilder:object:root=true
1313
type ClusterSet struct {
1414
metav1.ObjectMeta `json:"metadata,omitempty"`
1515
metav1.TypeMeta `json:",inline"`
@@ -77,7 +77,7 @@ type ClusterSetStatus struct {
7777
}
7878

7979
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
80-
80+
// +kubebuilder:object:root=true
8181
type ClusterSetList struct {
8282
metav1.ListMeta `json:"metadata,omitempty"`
8383
metav1.TypeMeta `json:",inline"`

Diff for: pkg/apis/k3k.io/v1alpha1/types.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import (
77

88
// +genclient
99
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
10+
// +kubebuilder:object:root=true
1011
// +kubebuilder:storageversion
1112
// +kubebuilder:subresource:status
12-
1313
type Cluster struct {
1414
metav1.ObjectMeta `json:"metadata,omitempty"`
1515
metav1.TypeMeta `json:",inline"`
@@ -125,7 +125,7 @@ type Addon struct {
125125
}
126126

127127
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
128-
128+
// +kubebuilder:object:root=true
129129
type ClusterList struct {
130130
metav1.ListMeta `json:"metadata,omitempty"`
131131
metav1.TypeMeta `json:",inline"`

0 commit comments

Comments
 (0)