Skip to content

Commit 7fee42c

Browse files
committed
feat: vendir and kustomization setup
1 parent 882fc11 commit 7fee42c

16 files changed

Lines changed: 134 additions & 222 deletions

.github/workflows/build-images-manifests.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ jobs:
2424
- image: presidio-analyzer
2525
platform: linux/amd64
2626
runner: ubuntu-latest
27-
- image: presidio-image-redactor
28-
platform: linux/amd64
29-
runner: ubuntu-latest
27+
# Note: do we want this part of presidio ? Maybe future feature ?
28+
# - image: presidio-image-redactor
29+
# platform: linux/amd64
30+
# runner: ubuntu-latest
3031
steps:
3132
# SDSC ADD-ON
3233
- name: Get latest Presidio release tag

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
.direnv/
2+
3+
# third party manifests
4+
external/helm/*
5+
external/ytt/*
6+
external/.vendir*
7+
28
# Byte-compiled / optimized / DLL files
39
__pycache__/
410
*.py[codz]

docs/services.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Services management
2+
3+
The deployment defines multiple service (or application), each being a
4+
collection of kubernetes manifests located in `src/<service>/`.
5+
6+
## Structure
7+
8+
- `external/`: third party resources
9+
- `src/`: deployable manifests
10+
- secrets are encrypted with sops+age and persisted in `src/secrets/`
11+
12+
Each service is structured as follows (supported tools are `ytt` and `helm`):
13+
14+
```text
15+
├── external
16+
│ └── <tool>
17+
│ └── <service>/... # <- third party templates
18+
└── src
19+
└── <service>
20+
├── additional-manifest.yaml # <- custom manifests for this deployment
21+
├── kustomization.yaml # <- kustomization file to select resources
22+
└── <tool>
23+
├── out/... # <- rendered manifests
24+
└── values.yaml # <- values used for templating
25+
```
26+
27+
## Templating
28+
29+
[ytt](https://carvel.dev/ytt) is the preferred rendering engine, but helm is
30+
also supported as many upstream templates are distributed with
31+
[helm](https://helm.sh).
32+
33+
When running `just render`, we attempt to render each service with helm and then
34+
with ytt and save the rendered manifests in the repository.
35+
36+
## Deployment
37+
38+
When deploying with `just deploy`, deployment is done with kustomize
39+
(`kubectl -k`). This means that the `src` and each of its subdirectories contain
40+
a `kustomization.yaml` file which determine what manifests are included in the
41+
deployment.
42+
43+
For example, running `just deploy src/` will recursively parse
44+
`src/kustomization.yaml` and the `kustomization.yaml` from each resources
45+
declared in that file. This allows to simply exclude services or manifests by
46+
commenting them out of `kustomization.yaml`.
47+
48+
## Updating a service
49+
50+
Here is the typical workflow to re-deploy a service that has been updated
51+
upstream.
52+
53+
1. Update the external manifest templates. This will update the `vendir` lock
54+
file and fetch the latest templates into `external/<tool>/<service>`.
55+
56+
```bash
57+
just external::refresh
58+
```
59+
60+
2. Render the manifests with the new templates.
61+
62+
```bash
63+
just render
64+
```
65+
66+
> [!NOTE]
67+
> This may fail if the new templates broke compatibility with existing values,
68+
> in which case you will need to update your values in
69+
> `src/<service>/<tool>/values.yaml`. Also watch out in case the upstream added
70+
> new template files, as you may need to include them in the service
71+
> `kustomization.yaml`.
72+
73+
3. Deploy the updated manifests.
74+
75+
```bash
76+
just deploy src/<service>
77+
```
78+
79+
> [!IMPORTANT]
80+
> In some cases, you may want to manually delete resources related to the
81+
> service. You can achieve that with `just delete src/<service>` or use
82+
> `kubectl delete` to delete specific resoruces.
83+
84+
## Adding custom manifests
85+
86+
Custom manifests (e.g. additional volumes) can be added inside `src/<service>/`,
87+
but they need to be added as a resource in `kustomization.yaml` file in the same
88+
directory.

external/vendir.lock.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: vendir.k14s.io/v1alpha1
2+
directories:
3+
- contents:
4+
- git:
5+
commitTitle: Add label to external PRs (#1707)...
6+
sha: af1c524460ad62e17313520a3cbb618b062b75cb
7+
tags:
8+
- 2.2.360
9+
path: .
10+
path: ytt/presidio
11+
kind: LockConfig

external/vendir.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: vendir.k14s.io/v1alpha1
2+
kind: Config
3+
directories:
4+
- path: ytt/presidio
5+
contents:
6+
- path: .
7+
git:
8+
url: https://github.com/microsoft/presidio
9+
ref: refs/tags/2.2.360
10+
newRootPath: docs/samples/deployments/k8s/charts/presidio

src/kustomization.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- ./presidio

src/presidio/kustomization.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- ./namespaces.yaml
5+
- ./presidio-pvc.yaml
6+
- ./helm/out/presidio/templates/analyzer-deployment.yaml
7+
- ./helm/out/presidio/templates/anonymizer-deployment.yaml
8+
- ./helm/out/presidio/templates/analyzer-service.yaml
9+
- ./helm/out/presidio/templates/anonymizer-service.yaml
10+
- ./helm/out/presidio/templates/analyzer-ingress.yaml
11+
namespace: presidio
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
registry: ghcr.io
22

33
# Image pull secret
4-
# privateRegistry: acr-auth
54
tag: latest
65

76
# supported types are nginx (wip: traefik and istio)

tools/deploy/presidio/.helmignore

Lines changed: 0 additions & 21 deletions
This file was deleted.

tools/deploy/presidio/Chart.yaml

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)