Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
dab613d
This commit stabilizes plugin go/v3-alpha to go/v3 and makes it
estroz Dec 3, 2020
a08bbfb
Fix the path of probes
zoetrope Dec 14, 2020
6e1f8d0
Merge pull request #1905 from zoetrope/fix-probe
k8s-ci-robot Dec 14, 2020
0a807f4
Merge pull request #1882 from estroz/feature/stabilize-go-v3
k8s-ci-robot Dec 14, 2020
7dc4d33
:sparkles: add new extension to markers in order to allow work with .yml
camilamacedo86 Dec 15, 2020
a4ad49a
Merge pull request #1907 from camilamacedo86/add-marker-extension
k8s-ci-robot Dec 15, 2020
90a7ad3
:warning: change structure to store crdVersion and webhkversion (go/v…
camilamacedo86 Dec 11, 2020
762211a
Merge pull request #1899 from camilamacedo86/fix-crd-web-version
k8s-ci-robot Dec 15, 2020
e604838
sparkles: (go/v3-alpha) Add the --force option for the webhook
prafull01 Dec 15, 2020
bba9577
Merge pull request #1903 from prafull01/force-webhook
k8s-ci-robot Dec 15, 2020
258470c
:sparkles: Add the unit tests for HasWebhook
prafull01 Dec 16, 2020
c9114ed
Merge pull request #1909 from prafull01/config-unit-test
k8s-ci-robot Dec 16, 2020
0c02833
:bug: Fix --force option to recreate the files by kubebuilder create api
prafull01 Nov 19, 2020
a4d0a3a
Merge pull request #1847 from prafull01/kb-force
k8s-ci-robot Dec 16, 2020
9ee7a30
Remove spaces from machine-readable comments (v3 only)
Adirio Dec 2, 2020
7245d41
Merge pull request #1868 from Adirio/machine-readable-markers
k8s-ci-robot Dec 17, 2020
6cf73c3
:book: update the docs by removng--plugin=v3/alpha since it no longer…
camilamacedo86 Dec 18, 2020
65f9853
:book: update samples
camilamacedo86 Dec 18, 2020
948887a
Merge pull request #1918 from camilamacedo86/update-docs-testdata-v3
k8s-ci-robot Dec 18, 2020
0082e95
:book: add info to tutorial about apis with examples
camilamacedo86 Dec 18, 2020
ea7e28e
Merge pull request #1920 from camilamacedo86/api-doc-add-info
k8s-ci-robot Dec 21, 2020
8097960
:seedling: Move the license year to 2021 in testdata
prafull01 Jan 5, 2021
23b7082
Merge pull request #1929 from prafull01/copyright-year
k8s-ci-robot Jan 5, 2021
aa9c2e0
Use lowered resource kind as file name
south37 Dec 29, 2020
f660017
Merge pull request #1927 from south37/use-lowered-resource-kind-as-fi…
k8s-ci-robot Jan 6, 2021
26d7b42
Merge pull request #1919 from camilamacedo86/fix-doc-v3-stable
k8s-ci-robot Jan 7, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
📖 add info to tutorial about apis with examples
  • Loading branch information
camilamacedo86 committed Dec 21, 2020
commit 0082e958f9a65948ac90f8607a84eb78aae8e34f
21 changes: 21 additions & 0 deletions docs/book/src/cronjob-tutorial/gvks.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,24 @@ a package.
Now that we have our terminology straight, we can *actually* create our
API!

## So, how can we create our API?

In the next section, [Adding a new API](./cronjob-tutorial/new-api.html) we will check how the tool help us to create our own API's with the command `kubebuilder create api`.

The goal of this command is to create Custom Resource (CR) and Custom Resource Definition (CRD) for our Kind(s). To check it further see; [Extend the Kubernetes API with CustomResourceDefinitions][kubernetes-extend-api].

## But, why create APIs at all?

New APIs are how we teach Kubernetes about our custom objects. The Go structs are used to generate a Custom Resource Definition (CRD) which includes the schema for our data as well as tracking data like what our new type is called. We can then create instances of our custom objects which will be managed by our [controllers][controllers].

Our APIs and resouces represent our solutions on the clusters. Basically, the CRDs are a definition of our customized Objects, and the CRs are an instance of it.

## Ah, do you have an example?

Let’s think about the classic scenario where the goal is to have an application and its database running on the platform with Kubernetes. Then, one CRD could represent the App, and another one could represent the DB. By having one CRD to describe the App and another one for the DB, we will not be hurting concepts such as encapsulation, the single responsibility principle, and cohesion. Damaging these concepts could cause unexpected side effects, such as difficulty in extending, reuse, or maintenance, just to mention a few.

In this way, we can create the App CRD which will have its controller and which would be responsible for things like creating Deployments that contain the App and creating Services to access it and etc. Similarly, we could create a CRD to represent the DB, and deploy a controller that would manage DB instances.

## Err, but what's that Scheme thing?

The `Scheme` we saw before is simply a way to keep track of what Go type
Expand All @@ -70,3 +88,6 @@ API server that says

or properly look up the group-version when we go to submit a `&CronJob{}`
in an update.

[kubernetes-extend-api]: https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/
[controllers]: ../cronjob-tutorial/controller-overview.md