Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Convention Server Open API spec #74

Merged
merged 13 commits into from
Apr 26, 2022
16 changes: 16 additions & 0 deletions docs/design.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- [PodIntent (conventions.carto.run/v1alpha1)](#podintent-conventionscartorunv1alpha1)
- [ClusterPodConvention (conventions.carto.run/v1alpha1)](#clusterpodconvention-conventionscartorunv1alpha1)
- [PodConventionContext (webhooks.conventions.carto.run/v1alpha1)](#podconventioncontext-webhooksconventionscartorunv1alpha1)
- [Webhook contract](#webhook-contract)
- [Lifecycle](#lifecycle)
- [Security](#security)
- [Supportability](#supportability)
Expand Down Expand Up @@ -237,6 +238,21 @@ status: # the response

In the future other mechanisms may be defined to provide conventions other than webhooks. In particular, mechanisms that are safe to execute within the controller process like a YTT overlay or WebAssembly. Each mechanism will define the specifics of its own contract similar in scope to the `PodConventionContext`.

#### Webhook Contract
katmutua marked this conversation as resolved.
Show resolved Hide resolved

In order for the conventions controller to apply a set of conventions, it requires these conventions to be authored in the form of a webhook.

The authored webhook is registered as follows:
```
http.HandleFunc(< url >, webhook.ConventionHandler(ctx, conventions_name))
katmutua marked this conversation as resolved.
Show resolved Hide resolved
```
The convention controller handler function expects a `ctx Context` and a function describing conventions to be applied. See [springboot-convetions example](../samples/spring-convention-server/server.go)
katmutua marked this conversation as resolved.
Show resolved Hide resolved
```
http.HandleFunc("/", webhook.ConventionHandler(ctx, addSpringBootConventions))
```

The ```HandleFunc``` in ```cartographer-conventions``` is therefore responsible for invoking various reconcilers to apply the various conventions ordered by priority.
katmutua marked this conversation as resolved.
Show resolved Hide resolved

## Lifecycle

Cartographer Conventions lives entirely within the user space of a Kubernetes cluster. It can be installed, upgraded and removed like any other CRDs with a controller. Upgrade instructions will be included with each release.
Expand Down