Skip to content

Commit a795b5b

Browse files
committed
Add crds slides
1 parent a94c840 commit a795b5b

File tree

2 files changed

+109
-1
lines changed

2 files changed

+109
-1
lines changed
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
---
2+
layout: two-cols
3+
transition: fade
4+
title: Custom Resource Definitions
5+
---
6+
7+
# [Custom Resource Definitions](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/#customresourcedefinitions)
8+
9+
They allow the extension of Kubernetes API by introducing new resource types, according to the <Link to="operator-pattern">operator pattern</Link>
10+
11+
<v-clicks>
12+
13+
Several operators that can be installed as `helm charts` provide their own `CRDs`
14+
15+
</v-clicks>
16+
17+
---
18+
layout: two-cols
19+
transition: fade
20+
hideInToc: true
21+
---
22+
23+
# [Custom Resource Definitions](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/#customresourcedefinitions)
24+
25+
`CRDs` define the schema for the custom resources
26+
27+
<v-click at="3">
28+
29+
The custom resource can be `Namespace` specific or defined `Cluster` wide
30+
31+
</v-click>
32+
33+
<v-click at="7">
34+
35+
Version name must follow a [specific schema](https://kubernetes.io/docs/reference/using-api/#api-versioning)
36+
37+
</v-click>
38+
39+
<v-click at="10">
40+
41+
The resource structure is defined via [OpenAPI v3.0 schemas](https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/#specifying-a-structural-schema)
42+
43+
</v-click>
44+
45+
<div class="mt-25"/>
46+
47+
<small v-click="5">
48+
49+
N.B. the `name` cannot be chosen arbitrarily; it must be set as `"{.spec.names.plural}.{.spec.group}"` and be a valid [DNS subdomain name](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-subdomain-names)
50+
51+
</small>
52+
53+
::right::
54+
55+
<Transform :scale="0.9" origin="top center">
56+
<<<@/snippets/manifests/custom-resource-definitions/crd-distro.yaml yaml[crd-distro.yaml]{all|1-2|6|7|8-10|4|11-28|12|13|14|15-28}{lines:true}
57+
</Transform>
58+
59+
<!--
60+
- [click]: `apiVersion` and `kind`
61+
- [click]: `group`
62+
- [click]: `scope`
63+
- [click]: `names`
64+
- [click]: `name`
65+
- [click]: `versions`
66+
- [click]: `name`
67+
68+
- [click]: `served`
69+
- [click]: `storage`
70+
Only one version must have this field set to `true`.
71+
It indicates which version is used to serialize the resource to be stored it in etcd
72+
- [click]: `schema`
73+
74+
```shell
75+
kubectl apply -f ./snippets/manifests/custom-resource-definitions/crd-distro.yaml
76+
kubectl get crds
77+
```
78+
-->
79+
80+
---
81+
layout: two-cols
82+
hideInToc: true
83+
---
84+
85+
# [Custom Resource Definitions](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/#customresourcedefinitions)
86+
Once the `CRDs` are defined, the relative resources are managed as the native ones
87+
88+
::right::
89+
90+
<<<@/snippets/manifests/custom-resource-definitions/distro-fedora.yaml yaml[distro-fedora.yaml]{all|1-2|5-8|all}{lines:true}
91+
<div class="mt-5"/>
92+
<<<@/snippets/manifests/custom-resource-definitions/distro-ubuntu.yaml yaml[distro-ubuntu.yaml]{all|1-2|5-8|all}{lines:true,at:1}
93+
94+
<!--
95+
- [click]: `apiVersion` and `kind`
96+
- [click]: `spec`
97+
98+
```shell
99+
kubectl apply -f ./snippets/manifests/custom-resource-definitions/distro-fedora.yaml
100+
kubectl apply -f ./snippets/manifests/custom-resource-definitions/distro-ubuntu.yaml
101+
kubectl get distro
102+
kubectl describe distro
103+
```
104+
-->

slides.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,17 @@ src: ./pages/20-helm.md
6868
src: ./pages/21-ingresses.md
6969
---
7070

71+
---
72+
src: ./pages/22-custom-resource-definitions.md
73+
---
74+
7175
---
7276
hideInToc: true
7377
---
7478

7579
# Table of contents
7680

77-
<Toc maxDepth="1" columns="1"/>
81+
<Toc maxDepth="1" columns="2"/>
7882

7983
---
8084
layout: outro

0 commit comments

Comments
 (0)