10 Integration Projects

Integration Projects

An integration project is the repository where the legs of a solution are built as Java Klok routes: one repository per system and direction, all made from the same template, so their names, pipeline, logging and documentation look the same from the first commit. Integration projects lists them as GitLab has them, says what each one's last build on main reported, shows where the topics and access its routes need stand on the broker, and creates a new one from the template together with the merge request of its deploy manifest, with a list of what is left before it runs.

  • In the menu: Build → Integration projects (/integrations/projects)
  • For: developers and admins of a domain create and change the projects of that domain (of the tenant or common for the tenant-wide groups); everyone with a role in the tenant reads the projects of their domains, common and public
  • Reads: the <tenant>/integration group in GitLab, when the page opens; the routes, datamodels and commit that each build on main reported to klok.dev; the tenant's Pulsar file, the broker and the broker requests for Broker setup; the manifests repository and Argo CD for Before it runs

What You See

Column What it says
Project The project image, the name, which opens the project's page, and its description
Domain Follows from the repository's path: <tenant>/integration/domain/hr/… is hr, <tenant>/integration/<repo> is common
Access Can edit when you may change the project, otherwise Read only
Routes The ingress and egress legs of the last build on main: 1 in · 0 out
Build The commit the last build on main was made from, and when klok.dev received it; No build yet for a project that has never built on main
Docs The state of the project's documentation on docs.klok.dev, as the pipelines report it. No pipeline sends that report yet (frontend-klok-dev#43), so the column shows a dash
Updated GitLab's last activity on the repository

What a project contains comes from its builds, not from a scan of its files: every build on main publishes a description of itself, and klok.dev reads its routes from that. A project made by hand in GitLab is listed on the next page load, or at once with Refresh, and says No build yet until its first pipeline on main has run.

A project's page has four tabs:

  • Overview: the project's facts, among them its Contact, the owners of its domain (or the tenant's owners when the domain has none), and who reads its Documentation on docs.klok.dev, with Change for those who may set it; the routes the last build reported, with their leg, pattern and datamodels; Broker setup; and, while the service does not run yet, Before it runs.
  • Edit: the code as your draft (Files when you may only read it).
  • Datamodels: the datamodels the build takes, with the release in the project's catalog copy and the one the catalog names now.
  • Review: your draft on its way to a merge request.

Walkthrough: Check A Project And What It Needs

  1. Find the project with the search box or the domain filter, and read Build: if it is not the commit you just merged, the pipeline has not reported yet. Refresh reads the list again.

  2. Open the project. Contact names whom to ask about it, and Routes lists the legs the build reported, such as KLK010E1_KonvojEmploymentStore, an egress of solution KLK010.

  3. Read Broker setup. It has one row for every topic the routes publish or read, and says where each stands: in the owning tenant's Pulsar file in Git, on the broker, and granted to the service's broker client. After each build on main, klok.dev asks the owners for what is missing, so you usually ask for nothing: | Shows | Means | | --- | --- | | Ready | In Git, on the broker and granted | | Requested | Asked for, by klok.dev after the build or by someone of your tenant, and waiting for the owner the row names | | Approved, Not applied yet | In Git or on its way; the next Ensure applies it to the broker | | Rejected | The owner said no, and why: change the route, or Ask again with a reason | | Failed, Applied | Approved, yet the check still finds it: the row says why; Open the request, or check again with the card's refresh button | | Not asked for | The grant rules do not give it, such as publish in another domain's namespace; the row says why and keeps Request it | | Missing | Nobody has asked yet; the next build on main asks, or Request it now |

  4. Request it opens Broker → Request topic or access with the topic filled in, and By hand in Git has the exact lines for the owner's Pulsar file. Owners approve under Broker → Requests (Broker).

Walkthrough: Create An Integration Project

A project belongs to one solution, whose id starts every route id of the project, so the solution is reserved or active on the registry's main first (Solutions).

  1. Choose New integration. Choose the Solution, the Group (common for the whole tenant, public for partners, global for a platform service of every tenant, offered in tenant klok, or a domain), the System it connects, as one word, and the Type: an ingress brings data from the system to the broker, an egress takes it from the broker to the system, an api serves a REST API, a process works between datamodels. Say in one Description line what it does.

  2. What klok.dev creates shows what follows: the repository <tenant>/integration/<group>/<tenant>-<system>-<type>, the merge request that adds its deploy manifest <repository path>/<name>-crds.yaml to the manifests repository, the route prefix and the Java package. A repository that exists already is refused.

  3. Create the project creates the repository in GitLab from project-template-integration, with one commit that runs no pipeline, and its documentation project beside it. It also opens the merge request of the project's deploy manifest in klok/environment/ipaas/ipaas-service-deploy-manifests: the service account, the Deployment with replicas: 0 and the Service, so merging it starts nothing. Nothing builds or deploys yet; the project's page opens.

  4. Before it runs lists what is left, each step read from where it is true when the page opens, so a step done by hand in GitLab shows done on the next load: | Step | Done when | Who | | --- | --- | --- | | Its first route, merged | A build on main reported a route other than the template's <ID>I1_ExampleOnramp | You, in a merge request | | Its topics and grants | Every topic is in Git, on the broker and granted; while the owners decide, it waits on the requests klok.dev made after the build | klok.dev asks, an owner approves | | Its deploy manifest | The manifest is on main of the manifests repository; while klok.dev's merge request is open, linked as !N, it waits. Merge it before the first route, or the first main pipeline fails in update_manifest | A person merges | | Its Vault role and env secret | The service runs | A person creates the role <name>-role, its policy and the env secret | | Its broker client | The service runs | A person adds the service's Keycloak client, with the scope pulsar, in Ansible | | It runs | Argo CD reports the manifest's workloads healthy | A person sets replicas: 1 in the manifest, in a merge request |

klok.dev cannot see Vault or Keycloak yet (klok-environment-setup#34), so those steps show done once the service runs, and it creates none of their objects (frontend-klok-dev#41). The list goes away once every step is done or out of klok.dev's sight.

Walkthrough: Move To A New Datamodel Release

  1. Open the project and Datamodels. A datamodel whose release in the catalog is newer than the project's catalog copy has Analyse upgrade; the others say Up to date.

  2. Analyse upgrade has Kloker compare the two releases and find where the project uses the model. The report says whether the release is Compatible or Breaking, what changed, and for every place in the code whether it needs a change.

  3. Apply to my draft puts the proposal into your draft: the catalog copy as ./gradlew updateKlokLibsToml writes it, and the mappings, tests and documentation that should change. Read it on Edit, then Review and Create merge request. A Breaking release is a new datamodel by the platform's rule, so the report proposes nothing: moving to it is a change to the project's routes, planned with its owner.

Any other change goes the same way: Edit changes the code in your draft, Check build compiles and tests it without pushing, and Review → Create merge request pushes it to a branch of its own and opens the merge request, which the project's owner merges in GitLab. The steps are the same as for a solution, a datamodel or a system (Changing a project, a datamodel or a system).

What Happens In Git

In klok.dev In Git Merged by By hand
Create the project A new repository from project-template-integration, its first commit chore: initialize <name> from project-template-integration [skip ci] straight on main, which is then protected; and its documentation project Nobody: it is the repository's first commit Create the project from the template in GitLab, replace its __KLOK_*__ tokens, push
Create the project, or Open merge request under Before it runs <repository path>/<name>-crds.yaml on the branch klok-dev/manifest-<name> of klok/environment/ipaas/ipaas-service-deploy-manifests, and the merge request feat(<name>): add the deploy manifest of <name>, with replicas: 0 A person, in GitLab The same file in a merge request, modelled on another service's manifest
Edit, then Review → Create merge request Your draft as commits on a branch klok-dev/<project>-<id>, and a merge request with your Conventional Commits title The project's owner, in GitLab The same change on a branch of your own
Apply to my draft (Datamodels) Nothing until the merge request: Kloker's proposal goes into your draft The project's owner ./gradlew updateKlokLibsToml and the mapping changes in a clone
A build on main, or Request it (Broker setup) Nothing at first: a request in klok.dev, made by klok.dev for the build or by you; once approved, a merge request to the owning tenant's Pulsar file in klok/environment/klok-environment-setup, which klok.dev merges and applies The topic's owner approves in klok.dev The lines from By hand in Git in a merge request, then ansible-playbook playbooks/pulsar.yml
New image (a row's ⋮) klok-docs/project-image.json with the next revision, committed to the default branch, or in a merge request when the branch is protected — Edit klok-docs/project-image.json
Refresh Nothing: klok.dev reads GitLab again — —

Creating a project is one of the few places where klok.dev writes straight to main; the deploy manifest, which decides what runs, is a merge request that a person merges. See What klok.dev Does In Git for every page.

Who Does What

Automation Kloker You
Every build on main reports its routes, datamodels and documentation to klok.dev, which fills Routes and Build, and klok.dev then asks the owners for the topics and grants that are missing; Create the project opens the manifest's merge request; Before it runs reads each step from GitLab, the manifests repository, the broker and Argo CD; Check build compiles and tests your draft on Kloker's executor, without a model Analyse upgrade compares two releases of a model and proposes the change into your draft; on Edit, Kloker beside the page proposes changes you keep or reject part by part, and writes the merge request's title and description when you ask; a bead of an approved plan can be implemented by Kloker as a merge request (Changes) Choose the solution, group, system and type; write and review the code; merge, the manifest's merge request included; and have a person create the Vault role and secret and the broker client, and start the service with replicas: 1

See You, The Automation And Kloker.

How It Connects

A project builds the legs its solution's document names (Solutions), against the datamodels the catalog releases (Datamodels), for one of the systems (Systems). Its topics and grants are the Broker's, and its deploy manifest is what Argo CD runs. Every build on main then feeds the Context graph and the Documentation, the routes' runs show up in Logs, and Repositories shows its pipeline and what is deployed.

Read More