You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tutorial.adoc
+26-25Lines changed: 26 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,11 +13,11 @@
13
13
14
14
= Tutorial: Writing your First Commodore Component
15
15
16
-
This tutorial will guide you through the required steps to create your first Commodore component.
16
+
This tutorial will guide you through the required steps to create your first Commodore Component.
17
17
18
-
Commodore components allow you to customize and extend the number and variety of tasks that you can perform with https://syn.tools/[Project Syn]. Using Commodore components, you can customize and apply changes to all of your clusters, ensuring conformity, coherence, alignment, and drastically reducing the workload for DevOps engineers.
18
+
Commodore Components allow you to customize and extend the number and variety of tasks that you can perform with https://syn.tools/[Project Syn]. Using Commodore Components, you can customize and apply changes to all of your clusters, ensuring conformity, coherence, alignment, and drastically reducing the workload for DevOps engineers.
19
19
20
-
There are many https://github.com/topics/commodore-component[Commodore components] already published; they perform various tasks, all related to the maintenance of Kubernetes clusters of many different kinds, including https://www.openshift.com/[OpenShift] clusters.
20
+
There are many https://github.com/topics/commodore-component[Commodore Components] already published; they perform various tasks, all related to the maintenance of Kubernetes clusters of many different kinds, including https://www.openshift.com/[OpenShift] clusters.
21
21
22
22
WARNING: This tutorial has been prepared with version v0.2.0 of Commodore. Project Syn is moving fast, and we will update this tutorial accordingly as new features and capabilities are made available by the development team.
23
23
@@ -27,7 +27,7 @@ In this tutorial, we are going to do the following:
27
27
. Then, we are going to create a very simple component, one that will deploy a workload in both clusters at the same time.
28
28
. Finally, we are going to wrap up, not without first cleaning up all the different pieces of this experiment.
29
29
30
-
This tutorial should give you a good idea of how all the different pieces of Project Syn work together, and how Commodore components fit in the picture.
30
+
This tutorial should give you a good idea of how all the different pieces of Project Syn work together, and how Commodore Components fit in the picture.
31
31
32
32
== Requirements
33
33
@@ -118,7 +118,7 @@ IMPORTANT: Do not press the kbd:[Enter] key when prompted with the `If you don't
118
118
119
119
=== Install Steward on Minikube
120
120
121
-
Now that Lieutenant is installed we can install https://docs.syn.tools/steward/[Steward] on our cluster. This tool is in charge of watching the GitLab and GitHub repositories, and triggers the GitOps operations required to keep each cluster up-to-date.
121
+
Now that Lieutenant is installed we can install https://docs.syn.tools/steward/[Steward] on our cluster. This tool is in charge of bootstrapping https://argoproj.github.io/argo-cd/[Argo CD] which watches the GitLab and GitHub repositories, and triggers the GitOps operations required to keep each cluster up-to-date.
122
122
123
123
We can easily install Steward on Minikube using the `./3_steward_on_minikube.sh` script.
124
124
@@ -142,7 +142,7 @@ TIP: The term "synthesize" means performing all the required steps so that a clu
142
142
$ ./4_synthesize_on_k3s.sh
143
143
----
144
144
145
-
And now we are ready: we have two working Kubernetes clusters, one Minikube and one k3s, and both are assigned to the same tenant. To verify this, we ask now the Lieutenant API, installed in our Minikube cluster:
145
+
And now we are ready: we have two working Kubernetes clusters, one Minikube and one k3s, and both are assigned to the same tenant. To verify this, we ask now the Lieutenant Custom Resources, available in our Minikube cluster:
146
146
147
147
[source,bash]
148
148
----
@@ -175,7 +175,7 @@ If you feel adventurous enough, and still have enough available RAM in your syst
175
175
176
176
== Creating a Commodore Component
177
177
178
-
Now we're getting to the actual subject of this tutorial! Let us dive into the real task of creating a new Commodore component.
178
+
Now we're getting to the actual subject of this tutorial! Let us dive into the real task of creating a new Commodore Component.
The first step to create a Commodore component is what is usually referred to as "compiling the catalog." This catalog provides a unique reference point of information about all the configuration and workloads affecting a single cluster.
225
+
The first step to create a Commodore Component is what is usually referred to as "compiling the catalog." This catalog provides a unique reference point of information about all the configuration and workloads affecting a single cluster.
226
226
227
227
Now we are ready to compile our catalog. Every time you call the `commodore` tool you will have to enter the password of your SSH key.
228
228
@@ -254,7 +254,7 @@ Let us create the component first:
Commodore components are written using https://jsonnet.org/[Jsonnet] (pronounced "jay-sonnet"), a data templating language for app and tool developers. If you have never written Jsonnet before, do not worry; just know that all valid JSON files are valid Jsonnet files, and that Jsonnet provides useful extensions, such as variables and functions, and various export formats, which make it easy to write very complex JSON applications with it.
276
+
Commodore Components are usually written using https://jsonnet.org/[Jsonnet] (pronounced "jay-sonnet"), a data templating language for app and tool developers. If you have never written Jsonnet before, do not worry; just know that all valid JSON files are valid Jsonnet files, and that Jsonnet provides useful extensions, such as variables and functions, and various export formats, which make it easy to write very complex JSON applications with it.
277
277
278
278
In Visual Studio Code, open the `component/main.jsonnet` file, and replace its text with the following:
279
279
@@ -318,15 +318,15 @@ Open the `component/app.jsonnet` file and replace its contents with the followin
318
318
include::assets/code/app.jsonnet[]
319
319
----
320
320
321
-
The `secrets=false` parameter is required. This is due to an incompatibility of ArgoCD with the Kapitan plugin at the time of this writing, which prevents it from loading properly. Since we do not require secrets for this tutorial, we can safely disable this.
321
+
The `secrets=false` parameter is required. Since we do not require secrets for this tutorial, we can safely disable this.
322
322
323
323
=== Compiling the Component
324
324
325
325
Now that we have written our component, let's compile it to see if it's generating what we need:
Since ArgoCD, itself managed by Steward, is watching these repositories, it will pick up the new state and seamlessly deploy it across our two clusters in a few minutes.
471
+
Since Argo CD, itself managed by Steward, is watching these repositories, it will pick up the new state and seamlessly deploy it across our two clusters in a few minutes.
472
472
473
473
With https://k9scli.io/[K9s] we can watch our clusters as they pick up the changes and apply them in all transparency. The namespace `syn-fortune` will contain the required deployment, pods, and service.
474
474
@@ -478,11 +478,11 @@ image::k9s_k3d.png[]
478
478
.K9s showing the `syn-fortune` and `lieutenant` pods in Minikube
479
479
image::k9s_minikube.png[]
480
480
481
-
=== Accessing the ArgoCD Console
481
+
=== Accessing the Argo CD Console
482
482
483
-
https://argoproj.github.io/argo-cd/[ArgoCD] is a declarative GitOps continuous deployment tool for Kubernetes. It is managed by Steward, and takes care of synchronizing and automatically updating the state of our clusters following changes in the configuration. You can access the ArgoCD console in both clusters through these steps:
483
+
https://argoproj.github.io/argo-cd/[Argo CD] is a declarative GitOps continuous deployment tool for Kubernetes. It is managed by Steward, and takes care of synchronizing and automatically updating the state of our clusters following changes in the configuration. You can access the Argo CD console in both clusters through these steps:
484
484
485
-
First, retrieve the ArgoCD admin password with this command:
485
+
First, retrieve the Argo CD admin password with this command:
486
486
487
487
[source,bash]
488
488
----
@@ -491,17 +491,17 @@ $ kubectl --context minikube -n syn get secret/steward -o jsonpath='{.data.token
491
491
492
492
TIP: The `pbcopy` command is usually found in macOS. In Linux, you can `alias pbcopy="xclip -selection clipboard"`.
493
493
494
-
Second, redirect trafic to ArgoCD:
494
+
Second, redirect traffic to Argo CD:
495
495
496
496
[source,bash]
497
497
----
498
-
$ kubectl --context minikube -n syn port-forward svc/argocd-server 8080:80
498
+
$ kubectl --context minikube -n syn port-forward svc/Argo CD-server 8080:80
499
499
----
500
500
501
501
And third, open http://localhost:8080 with the username `admin` and the password you copied in the previous step.
502
502
503
-
.ArgoCD console
504
-
image::argocd.png[]
503
+
.Argo CD console
504
+
image::Argo CD.png[]
505
505
506
506
You can repeat this steps to access the console in the K3s cluster, by changing the value of the `kubectl --context` parameter.
507
507
@@ -533,7 +533,8 @@ We are done! You can now remove the clusters in your computer, and also remove t
533
533
534
534
* Run the `./5_delete.sh` script to deregister and stop all local clusters.
535
535
* Remove your clone of `commodore-defaults` on GitHub.
536
-
* Remove your GitLab projects: `tutorial-tenant`, `tutorial-cluster-minikube`, and `tutorial-cluster-k3s`
536
+
537
+
TIP: The GitLab projects `tutorial-tenant`, `tutorial-cluster-minikube`, and `tutorial-cluster-k3s` have been automatically deleted by the Lieutenant Operator.
I hope this tutorial has given you a good idea of what Commodore components are, and how they can help you in your DevOps workflow.
568
+
I hope this tutorial has given you a good idea of what Commodore Components are, and how they can help you in your DevOps workflow.
568
569
569
-
Commodore components can be used to deploy monitoring tools, to change the state of lots of clusters at once, to perform backup operations, to modify network policies, and many other tasks that otherwise would have to be performed manually.
570
+
Commodore Components can be used to deploy monitoring tools, to change the state of lots of clusters at once, to perform backup operations, to modify network policies, and many other tasks that otherwise would have to be performed manually.
570
571
571
-
Creating Commodore components at the moment is a long task, but the rewards are high in terms of the economies of scale DevOps reach when managing multi-cluster architectures.
572
+
Creating Commodore Components at the moment is a long task, but the rewards are high in terms of the economies of scale DevOps reach when managing multi-cluster architectures.
572
573
573
-
If you create a new open source Commodore component, add the https://github.com/topics/commodore-component[`commodore-component` tag] on your GitHub project and let us know about it! We will be thrilled to check it out and who knows? Maybe even contribute back to your effort.
574
+
If you create a new open source Commodore Component, add the https://github.com/topics/commodore-component[`commodore-component` tag] on your GitHub project and let us know about it! We will be thrilled to check it out and who knows? Maybe even contribute back to your effort.
0 commit comments