Once the components are developed and their images published in some accesible registry, next step is to integrate them into the CaaS Framework. The CaaS Framework runs in a [Kubernetes](https://kubernetes.io/) cluster. The integration of a new component consist in adding the component manifests files to the repository and extending the Kustomization file to include those manifests files in the deployment.
Once a component is developed, and its image published in some accesible registry, we need to integrate it into the CaaS Framework. The CaaS Framework runs in a [Kubernetes](https://kubernetes.io/) cluster. The integration of a new component consist in adding the component manifests files to the repository and extending the Kustomization file to include those manifests files in the deployment.
This document contains the guidelines for integrating a new component into the CaaS Framework. The final step of the integration is to submit a merge request. The merge request will be reviewed by the project maintainers and, if accepted, merged into the main branch.
This document contains the guidelines for integrating a new component into the CaaS Framework. The integration is based in merge requests. The merge request will be reviewed by the project maintainers and, if accepted, merged into the main branch.
The merge request should contain the following information:
The merge request should be based in the followingpreliminar actions:
-A folder with the component manifests files.
-Creation of a folder containing the manifests files for the components.
-The required sections in the Kustomization file to include those manifests in the CaaS Framework deployment.
-Edit the required sections in the Kustomization file in order to include those manifests in the CaaS Framework deployment.
In the following sections we explain how to create the merge request with the required information.
In the following sections we explain how to create the merge request with the required information.
-[Getting the kubeconfig](#getting-the-kubeconfig)
-[Getting the kubeconfig](#getting-the-kubeconfig)
-[Check the deployment in the kubernetes cluster](#Acces-the-kubernetes-cluster)
-[Submit the merge request](#submit-the-merge-request)
-[Submit the merge request](#submit-the-merge-request)
## Merge request initialisation
## Merge request initialisation
There are many ways to create a merge request in GitLab. In this section we will explain two of them.
There are many ways to create a merge request in GitLab. In this section we will explain three of them.
- From an issue (recommended way).
- From an issue (recommended way).
- From a branch.
- From a branch (before adding the component)
- From a branch (after adding the component)
### From an issue
### From an issue
...
@@ -50,30 +51,29 @@ The merge request will be annotated as **draft** so that you can work without th
...
@@ -50,30 +51,29 @@ The merge request will be annotated as **draft** so that you can work without th
### From a branch *before* adding the component
### From a branch *before* adding the component
This is an alternative way to create a merge request. You can create a new branch in the repository and then create a merge request from that branch. when the merge request is accepted. It is recommended to create the merge request as a **draft**, so that you can work without the intervention of the project maintainers. Once the component is ready for review, you can change the status of the merge request to **ready for review**.
This is an alternative way to create a merge request. You can create a new branch in the repository and then create a merge request from that branch. It is recommended to create the merge request as a **draft**, so that you can work without the intervention of the project maintainers. Once the component is ready for review, you can change the status of the merge request to **ready for review**.
### From a branch *after* adding the component
#### (Optional) Download the branch and add the component
Another way to work is to clone the repository, add the component in a new branch, push it to the repository, and then create a merge request from that branch.
If you create the branch in the GitLab interface before adding the component, you can download the branch as follows:
## (Optional) Download the branch and add the component
Another way to work is to clone the GitLab repository, add the component in a new branch, push it to the repository, and then create a merge request from that branch.
This is applicable if you create the branch in the GitLab interface before adding the component. You can download the branch as follows:
The next step is to add the component manifests files to the created folder. We recommend to prepend the name of the file with a number to indicate the order in which the files should be applied. There are examples into the `rcm` component [folder](https://git.code.tecnalia.com/emerald/private/devops/caas-framework/-/tree/master/rcm?ref_type=heads)
The next step is to add the component manifests files to the created folder. We recommend to prepend the name of the file with a number to indicate the order in which the files should be applied. There are examples into the `rcm` component [folder](https://git.code.tecnalia.com/emerald/private/devops/caas-framework/-/tree/master/rcm?ref_type=heads)
### ConfigMaps
### ConfigMaps
It is recommended to create Configmaps using the `kustomize` tool. The contents of the ConfigMaps for the component should be stored in a folder named `configmaps` in the component folder.
It is recommended to create Configmaps using the `kustomize` tool. The contents of the ConfigMaps for the component should be stored in a folder named `configmaps` in the component folder.
### Secrets
### Secrets
...
@@ -102,8 +100,7 @@ The Secrets will be created using the `kustomize` tool. The files to be used for
...
@@ -102,8 +100,7 @@ The Secrets will be created using the `kustomize` tool. The files to be used for


## Extend the Kustomization file
## Extend the Kustomization file
The next step is to extend the Kustomization file. The Kustomization file (`kustomize.yaml`) is a YAML file, that contains the list of the manifests files that should be included in the deployment. It is located in the root of the repository of the CaaS Framework.
The next step is to extend the Kustomization file. The Kustomization file (`kustomization.yaml`) is a YAML file, located in the root of the repository, that contains the list of the manifests files that should be included in the deployment.
To extend the Kustomization file it is recommended to use the [`kustomize`](https://kubernetes.io/docs/reference/kubectl/generated/kubectl_kustomize/) CLI tool. To install the `kustomize` tool you can follow the instructions in the [official documentation](https://kubectl.docs.kubernetes.io/installation/kustomize/).
To extend the Kustomization file it is recommended to use the [`kustomize`](https://kubernetes.io/docs/reference/kubectl/generated/kubectl_kustomize/) CLI tool. To install the `kustomize` tool you can follow the instructions in the [official documentation](https://kubectl.docs.kubernetes.io/installation/kustomize/).
Once the secret is placed in the GitLab CI/CD variables, the `k8s-pre-apply.sh` script will add the secret to the root of the repository.
Once the secret is placed in the GitLab CI/CD variables, the `k8s-pre-apply.sh` script will add the secret to the root of the repository.
## Kustomize check configuration
## Check the kustomize configuration
The `Kustomize` tool allows you to check the configuration of the Kustomization file. The `kustomize` tool has a command to check the configuration of the Kustomization file. The command is:
The `Kustomize` tool allows you to check the configuration of the Kustomization file. The `kustomize` tool has a command to check the configuration of the Kustomization file. The command is:
Yo need the KubeConfig file to access to the Kubernetes cluster from kubctl.
To get the kubeconfig, login into kubernetes https://k8so.emerald.digital.tecnalia.dev/ and download the kubeconfig (see figure below). **Be aware that the kubeconfig is valid for one month**.
To get the kubeconfig, login into kubernetes https://k8so.emerald.digital.tecnalia.dev/ and download the kubeconfig (see figure below). **Be aware that the kubeconfig is valid for one month**.
The above is valid for one kubernetes cluster. If you have more than one kubernetes cluster, you can store the kubeconfig in different files and use the `KUBECONFIG` environment variable to select the kubeconfig file.
NOTE: The above is valid for one kubernetes cluster. If you have more than one kubernetes cluster, you can store the kubeconfig in different files and use the `KUBECONFIG` environment variable to select the kubeconfig file.
```bash
```bash
kubectl config get-contexts
kubectl config get-contexts
kubectl config use-context local
kubectl config use-context local
```
```
### Access the kubernetes cluster
### Check the deployment in the kubernetes cluster
The EMERALD kubernetes cluster includes a [Rancher server](https://ranchermanager.docs.rancher.com/) to access the cluster. The rancher is available at https://k8so.emerald.digital.tecnalia.dev/.
The kubernetes cluster includes a rancher server that allows you to access the kubernetes cluster. The rancher server is available at https://k8so.emerald.digital.tecnalia.dev/.
There you can access the kubernetes cluster and check the deployment of the component.
There, you can access the kubernetes cluster and check the deployment of the component.
{width=400}
{width=400}
## Submit the merge request
## Submit the merge request
Finally, you can submit as many commits as you need to the branch. Once the component is ready for review, you can change the status of the merge request to **ready for review**. The project maintainers will review the merge request and, if it is accepted, they will add a final commit for semantic versioning and willmerged it into the main branch.
You can submit as many commits as you need to the branch. Once the component is ready for review, you can change the status of the merge request to **ready for review**. The project maintainers will review the merge request and if it is accepted they will add a final commit for semantic versioning and it will be merged into the main branch.