Skip to content

Commit b817fe9

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

File tree

6 files changed

+326
-8
lines changed

6 files changed

+326
-8
lines changed

docs/crds/Makefile

Lines changed: 6 additions & 0 deletions
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

docs/crds/config.yaml

Lines changed: 14 additions & 0 deletions
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"

docs/crds/crd-docs.md

Lines changed: 299 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,299 @@
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+
- [ClusterSet](#clusterset)
14+
- [ClusterSetList](#clustersetlist)
15+
16+
17+
18+
#### Addon
19+
20+
21+
22+
23+
24+
25+
26+
_Appears in:_
27+
- [ClusterSpec](#clusterspec)
28+
29+
| Field | Description | Default | Validation |
30+
| --- | --- | --- | --- |
31+
| `secretNamespace` _string_ | | | |
32+
| `secretRef` _string_ | | | |
33+
34+
35+
#### Cluster
36+
37+
38+
39+
40+
41+
42+
43+
_Appears in:_
44+
- [ClusterList](#clusterlist)
45+
46+
| Field | Description | Default | Validation |
47+
| --- | --- | --- | --- |
48+
| `apiVersion` _string_ | `k3k.io/v1alpha1` | | |
49+
| `kind` _string_ | `Cluster` | | |
50+
| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | |
51+
| `spec` _[ClusterSpec](#clusterspec)_ | | \{ \} | |
52+
53+
54+
#### ClusterLimit
55+
56+
57+
58+
59+
60+
61+
62+
_Appears in:_
63+
- [ClusterSetSpec](#clustersetspec)
64+
- [ClusterSpec](#clusterspec)
65+
66+
| Field | Description | Default | Validation |
67+
| --- | --- | --- | --- |
68+
| `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 | | |
69+
| `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 | | |
70+
71+
72+
#### ClusterList
73+
74+
75+
76+
77+
78+
79+
80+
81+
82+
| Field | Description | Default | Validation |
83+
| --- | --- | --- | --- |
84+
| `apiVersion` _string_ | `k3k.io/v1alpha1` | | |
85+
| `kind` _string_ | `ClusterList` | | |
86+
| `metadata` _[ListMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#listmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | |
87+
| `items` _[Cluster](#cluster) array_ | | | |
88+
89+
90+
#### ClusterMode
91+
92+
_Underlying type:_ _string_
93+
94+
ClusterMode is the possible provisioning mode of a Cluster.
95+
96+
_Validation:_
97+
- Enum: [shared virtual]
98+
99+
_Appears in:_
100+
- [ClusterSetSpec](#clustersetspec)
101+
- [ClusterSpec](#clusterspec)
102+
103+
104+
105+
#### ClusterSet
106+
107+
108+
109+
110+
111+
112+
113+
_Appears in:_
114+
- [ClusterSetList](#clustersetlist)
115+
116+
| Field | Description | Default | Validation |
117+
| --- | --- | --- | --- |
118+
| `apiVersion` _string_ | `k3k.io/v1alpha1` | | |
119+
| `kind` _string_ | `ClusterSet` | | |
120+
| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | |
121+
| `spec` _[ClusterSetSpec](#clustersetspec)_ | Spec is the spec of the ClusterSet | \{ \} | |
122+
123+
124+
#### ClusterSetList
125+
126+
127+
128+
129+
130+
131+
132+
133+
134+
| Field | Description | Default | Validation |
135+
| --- | --- | --- | --- |
136+
| `apiVersion` _string_ | `k3k.io/v1alpha1` | | |
137+
| `kind` _string_ | `ClusterSetList` | | |
138+
| `metadata` _[ListMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#listmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | |
139+
| `items` _[ClusterSet](#clusterset) array_ | | | |
140+
141+
142+
#### ClusterSetSpec
143+
144+
145+
146+
147+
148+
149+
150+
_Appears in:_
151+
- [ClusterSet](#clusterset)
152+
153+
| Field | Description | Default | Validation |
154+
| --- | --- | --- | --- |
155+
| `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 | | |
156+
| `defaultLimits` _[ClusterLimit](#clusterlimit)_ | DefaultLimits are the limits used for servers/agents when a cluster in the set doesn't provide any | | |
157+
| `defaultNodeSelector` _object (keys:string, values:string)_ | DefaultNodeSelector is the node selector that applies to all clusters (server + agent) in the set | | |
158+
| `defaultPriorityClass` _string_ | DefaultPriorityClass is the priorityClassName applied to all pods of all clusters in the set | | |
159+
| `disableNetworkPolicy` _boolean_ | DisableNetworkPolicy is an option that will disable the creation of a default networkpolicy for cluster isolation | | |
160+
| `allowedNodeTypes` _[ClusterMode](#clustermode) array_ | AllowedNodeTypes are the allowed cluster provisioning modes. Defaults to [shared]. | [shared] | Enum: [shared virtual] <br />MinItems: 1 <br /> |
161+
| `podSecurityAdmissionLevel` _[PodSecurityAdmissionLevel](#podsecurityadmissionlevel)_ | PodSecurityAdmissionLevel is the policy level applied to the pods in the namespace. | | Enum: [privileged baseline restricted] <br /> |
162+
163+
164+
165+
166+
#### ClusterSpec
167+
168+
169+
170+
171+
172+
173+
174+
_Appears in:_
175+
- [Cluster](#cluster)
176+
177+
| Field | Description | Default | Validation |
178+
| --- | --- | --- | --- |
179+
| `version` _string_ | Version is a string representing the Kubernetes version to be used by the virtual nodes. | | |
180+
| `servers` _integer_ | Servers is the number of K3s pods to run in server (controlplane) mode. | 1 | |
181+
| `agents` _integer_ | Agents is the number of K3s pods to run in agent (worker) mode. | 0 | |
182+
| `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. | | |
183+
| `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. | | |
184+
| `clusterLimit` _[ClusterLimit](#clusterlimit)_ | Limit is the limits that apply for the server/worker nodes. | | |
185+
| `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. | | |
186+
| `clusterCIDR` _string_ | ClusterCIDR is the CIDR range for the pods of the cluster. Defaults to 10.42.0.0/16. | | |
187+
| `serviceCIDR` _string_ | ServiceCIDR is the CIDR range for the services in the cluster. Defaults to 10.43.0.0/16. | | |
188+
| `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. | | |
189+
| `serverArgs` _string array_ | ServerArgs are the ordered key value pairs (e.x. "testArg", "testValue") for the K3s pods running in server mode. | | |
190+
| `agentArgs` _string array_ | AgentArgs are the ordered key value pairs (e.x. "testArg", "testValue") for the K3s pods running in agent mode. | | |
191+
| `tlsSANs` _string array_ | TLSSANs are the subjectAlternativeNames for the certificate the K3s server will use. | | |
192+
| `addons` _[Addon](#addon) array_ | Addons is a list of secrets containing raw YAML which will be deployed in the virtual K3k cluster on startup. | | |
193+
| `mode` _[ClusterMode](#clustermode)_ | Mode is the cluster provisioning mode which can be either "shared" or "virtual". Defaults to "shared" | shared | Enum: [shared virtual] <br /> |
194+
| `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. | | |
195+
| `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. | | |
196+
197+
198+
199+
200+
#### ExposeConfig
201+
202+
203+
204+
205+
206+
207+
208+
_Appears in:_
209+
- [ClusterSpec](#clusterspec)
210+
211+
| Field | Description | Default | Validation |
212+
| --- | --- | --- | --- |
213+
| `ingress` _[IngressConfig](#ingressconfig)_ | | | |
214+
| `loadbalancer` _[LoadBalancerConfig](#loadbalancerconfig)_ | | | |
215+
| `nodePort` _[NodePortConfig](#nodeportconfig)_ | | | |
216+
217+
218+
#### IngressConfig
219+
220+
221+
222+
223+
224+
225+
226+
_Appears in:_
227+
- [ExposeConfig](#exposeconfig)
228+
229+
| Field | Description | Default | Validation |
230+
| --- | --- | --- | --- |
231+
| `enabled` _boolean_ | | | |
232+
| `ingressClassName` _string_ | | | |
233+
234+
235+
#### LoadBalancerConfig
236+
237+
238+
239+
240+
241+
242+
243+
_Appears in:_
244+
- [ExposeConfig](#exposeconfig)
245+
246+
| Field | Description | Default | Validation |
247+
| --- | --- | --- | --- |
248+
| `enabled` _boolean_ | | | |
249+
250+
251+
#### NodePortConfig
252+
253+
254+
255+
256+
257+
258+
259+
_Appears in:_
260+
- [ExposeConfig](#exposeconfig)
261+
262+
| Field | Description | Default | Validation |
263+
| --- | --- | --- | --- |
264+
| `enabled` _boolean_ | | | |
265+
266+
267+
#### PersistenceConfig
268+
269+
270+
271+
272+
273+
274+
275+
_Appears in:_
276+
- [ClusterSpec](#clusterspec)
277+
- [ClusterStatus](#clusterstatus)
278+
279+
| Field | Description | Default | Validation |
280+
| --- | --- | --- | --- |
281+
| `type` _string_ | Type can be ephemeral, static, dynamic | ephemeral | |
282+
| `storageClassName` _string_ | | | |
283+
| `storageRequestSize` _string_ | | | |
284+
285+
286+
#### PodSecurityAdmissionLevel
287+
288+
_Underlying type:_ _string_
289+
290+
PodSecurityAdmissionLevel is the policy level applied to the pods in the namespace.
291+
292+
_Validation:_
293+
- Enum: [privileged baseline restricted]
294+
295+
_Appears in:_
296+
- [ClusterSetSpec](#clustersetspec)
297+
298+
299+

pkg/apis/k3k.io/v1alpha1/register.go

Lines changed: 3 additions & 4 deletions
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 {

pkg/apis/k3k.io/v1alpha1/set_types.go

Lines changed: 2 additions & 2 deletions
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"`

pkg/apis/k3k.io/v1alpha1/types.go

Lines changed: 2 additions & 2 deletions
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)