Skip to content

Commit f29e5bf

Browse files
feat: chart index (#1759)
Co-authored-by: CasLubbers <[email protected]>
1 parent fef95dd commit f29e5bf

File tree

12 files changed

+193
-62
lines changed

12 files changed

+193
-62
lines changed

.github/renovate.json

-19
This file was deleted.

.github/workflows/renovate.yml

-19
This file was deleted.

.vscode/settings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"editor.defaultFormatter": "foxundermoon.shell-format"
1010
},
1111
"[javascript]": {
12-
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
12+
"editor.defaultFormatter": "esbenp.prettier-vscode"
1313
},
1414
"[typescript]": {
1515
"editor.defaultFormatter": "dbaeumer.vscode-eslint"

chart/chart-index/.helmignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

chart/chart-index/Chart.lock

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
dependencies:
2+
- name: argo-cd
3+
repository: https://argoproj.github.io/argo-helm
4+
version: 6.7.3
5+
- name: cert-manager
6+
repository: https://charts.jetstack.io
7+
version: v1.11.4
8+
- name: cloudnative-pg
9+
repository: https://cloudnative-pg.github.io/charts
10+
version: 0.18.0
11+
- name: external-dns
12+
repository: https://charts.bitnami.com/bitnami
13+
version: 6.20.4
14+
- name: external-secrets
15+
repository: https://charts.external-secrets.io
16+
version: 0.6.1
17+
- name: gitea
18+
repository: https://dl.gitea.io/charts
19+
version: 5.0.0
20+
- name: harbor
21+
repository: https://helm.goharbor.io
22+
version: 1.10.4
23+
- name: ingress-nginx
24+
repository: https://kubernetes.github.io/ingress-nginx
25+
version: 4.6.1
26+
- name: kube-prometheus-stack
27+
repository: https://prometheus-community.github.io/helm-charts
28+
version: 46.4.1
29+
- name: metrics-server
30+
repository: https://charts.bitnami.com/bitnami
31+
version: 6.8.0
32+
- name: oauth2-proxy
33+
repository: https://charts.bitnami.com/bitnami
34+
version: 3.7.4
35+
- name: prometheus-blackbox-exporter
36+
repository: https://prometheus-community.github.io/helm-charts
37+
version: 7.10.0
38+
- name: promtail
39+
repository: https://grafana.github.io/helm-charts
40+
version: 6.11.2
41+
- name: sealed-secrets
42+
repository: https://bitnami-labs.github.io/sealed-secrets/
43+
version: 2.14.1
44+
- name: tekton-pipeline
45+
repository: https://cdfoundation.github.io/tekton-helm-chart/
46+
version: 1.0.2
47+
- name: velero
48+
repository: https://vmware-tanzu.github.io/helm-charts/
49+
version: 5.4.1
50+
digest: sha256:9c7e5d75c1f8d3befa942e74b4b0896e36db7f040e100ff642a24c7199cdbdca
51+
generated: "2024-10-14T11:21:37.891213+02:00"

chart/chart-index/Chart.yaml

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
apiVersion: v2
2+
name: chart-index
3+
description: APL chart index
4+
5+
# Library charts provide useful utilities or functions for the chart developer. They're included as
6+
# a dependency of application charts to inject those utilities and functions into the rendering
7+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
8+
type: library
9+
10+
# This is the chart version. This version number should be incremented each time you make changes
11+
# to the chart and its templates, including the app version.
12+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
13+
version: 0.1.0
14+
15+
# # This is the version number of the application being deployed. This version number should be
16+
# # incremented each time you make changes to the application. Versions are not expected to
17+
# # follow Semantic Versioning. They should reflect the version the application is using.
18+
# # It is recommended to use it with quotes.
19+
# appVersion: "1.16.0"
20+
21+
# The below dependencies are used to download Helm chart archive to the charts directory. Note that charts directory is a symlink.
22+
dependencies:
23+
- name: argo-cd
24+
version: 6.7.3
25+
repository: https://argoproj.github.io/argo-helm
26+
- name: cert-manager
27+
version: v1.11.4
28+
repository: https://charts.jetstack.io
29+
- name: cloudnative-pg
30+
version: 0.18.0
31+
repository: https://cloudnative-pg.github.io/charts
32+
- name: external-dns
33+
version: 6.20.4
34+
repository: https://charts.bitnami.com/bitnami
35+
- name: external-secrets
36+
version: 0.6.1
37+
repository: https://charts.external-secrets.io
38+
- name: gitea
39+
version: 5.0.0
40+
repository: https://dl.gitea.io/charts
41+
- name: harbor
42+
version: 1.10.4
43+
repository: https://helm.goharbor.io
44+
- name: ingress-nginx
45+
version: 4.6.1
46+
repository: https://kubernetes.github.io/ingress-nginx
47+
- name: kube-prometheus-stack
48+
version: 46.4.1
49+
repository: https://prometheus-community.github.io/helm-charts
50+
- name: metrics-server
51+
version: 6.8.0
52+
repository: https://charts.bitnami.com/bitnami
53+
- name: oauth2-proxy
54+
version: 3.7.4
55+
repository: https://charts.bitnami.com/bitnami
56+
- name: prometheus-blackbox-exporter
57+
version: 7.10.0
58+
repository: https://prometheus-community.github.io/helm-charts
59+
- name: promtail
60+
version: 6.11.2
61+
repository: https://grafana.github.io/helm-charts
62+
- name: sealed-secrets
63+
version: 2.14.1
64+
repository: https://bitnami-labs.github.io/sealed-secrets/
65+
- name: tekton-pipeline
66+
version: 1.0.2
67+
repository: https://cdfoundation.github.io/tekton-helm-chart/
68+
- name: velero
69+
version: 5.4.1
70+
repository: https://vmware-tanzu.github.io/helm-charts/

chart/chart-index/Readme.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The chart-index Helm chart allows to manage most of the APL helm chart dependencies (a.k.a. core apps).
2+
The chart-index is so-called library Helm chart and cannot be installed by itself. It only defines dependencies in the `chart/chart-index/Chart.yaml` file. Each dependency follows the following format:
3+
```
4+
- name: <chart name>
5+
version: <chart version>
6+
repository: <chart url>
7+
```
8+
,thus Helm knows the chart registry URL, chart name and version.
9+
10+
In the future, the chart-index is going to be combined with Renovate to discover new versions.
11+
12+
Currently, adding a new version of the core app is performed manually:
13+
1. In the `chart/chart-index/Chart.yaml` file, change a given version in the `dependencies` list.
14+
2. Call `npm run charts-update`, so Helm charts archives are downloaded to the `charts/` directory
15+
3. In charts directory unpack the archive to the corresponding directory
16+
4. Commit your changes: git commit -m'feat: chart upgrade <app-name>'
17+
5. Perform smoke tests `npm run validate-templates`
18+
6. Carefully compare the rendered manifests (your feature branch vs main) by executing `bin/compare.sh`
19+
20+
21+
Note 1: some Helm charts do not have an official Helm chart repository. Those helm charts cannot be upgraded via the `chart-index`.
22+
Note 2: some charts resides in different directory name than the original app name, e.g.: argo-cd app resides in charts/argocd directory

chart/chart-index/charts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../charts

chart/chart-index/values.yaml

Whitespace-only changes.

charts/skeleton/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
apiVersion: v1
22
appVersion: "1.0"
33
description: A Helm chart for Kubernetes that will have it's manifests injected at runtime.
4-
name: ##CHART
4+
name: skeleton-##CHART
55
version: 0.1.0

docs/development.md

+21-21
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Effective development starts with an understanding the code structure and the re
99
- [Integrating core apps](#Integrating-core-apps)
1010
- [Working with the team-ns chart](#working-with-the-team-ns-chart)
1111
- [Testing](#testing)
12-
- [Otomi CLI](#otomi-cli)
12+
- [APL CLI](#otomi-cli)
1313
- [Troubleshooting](#troubleshooting)
1414

1515
# Navigating through code
@@ -20,21 +20,21 @@ Effective development starts with an understanding the code structure and the re
2020
apl-core
2121
├── .values # Boilerplate for initializing git repository
2222
├── adr # Architectural Decision Records [read more](https://adr.github.io/madr/)
23-
├── bin # Otomi CLI entrypoint (deprecated)
24-
├── binzx # Otomi CLI entrypoint
25-
├── chart # Helm chart for installing Otomi
26-
├── charts # All other Helm charts that comprise Otomi
23+
├── bin # APL CLI entrypoint (deprecated)
24+
├── binzx # APL CLI entrypoint
25+
├── chart # Helm chart for installing APL and upgrading APL Helm charts
26+
├── charts # All other Helm charts that comprise APL
2727
├── docs # Documentation
2828
├── helmfile.d/helmfile-*.yaml # Helmfile specs ordered by name and executed accordingly by otomi commands
2929
├── helmfile.d/snippets # Reusable code snippets
3030
├── helmfile.tpl # Additional Helmfiles that do not have corresponding chart and are not parsed on otomi apply|template command
3131
├── k8s # Kubernetes manifests that before any other chart
32-
├── src # Otomi CLI source code
32+
├── src # APL CLI source code
3333
├── tests # Values used for testing purposes
3434
├── upgrades.yaml # Upgrade presync hooks
3535
├── values # Value templates that serves as input to corresponding Helm charts
3636
├── values-changes.yaml # Definitions for performing data migrations
37-
├── values-schema.yaml # JSON schema that defines Otomi interface
37+
├── values-schema.yaml # JSON schema that defines APL interface
3838
└── versions.yaml # Version tags of otomi-api, otomi-console and otomi-tasks
3939
```
4040

@@ -56,13 +56,13 @@ Whenever you see `<<: *somename` then it means that [node anchor](<(https://yaml
5656

5757
# Values repo and data flow
5858

59-
A values repo is provided by a user. If Otomi is a function then `values repo` is input arguments. It is composed of many YAML files containing the configuration for various apps and teams.
59+
A values repo is provided by a user. If APL is a function then `values repo` is input arguments. It is composed of many YAML files containing the configuration for various apps and teams.
6060

61-
While rendering kubernetes manifests Otomi leverages Helmfile.
61+
While rendering kubernetes manifests APL leverages Helmfile.
6262

6363
> Helmfile is a declarative spec for deploying helm charts. You are encouraged to read more about Helmfile at https://github.com/helmfile/helmfile.
6464
65-
In Otomi, all Helmfile specs are defined in the `helmfile.d/` directory and executed in alphabetical order. The majority of Helmfile specs has the following structure:
65+
In APL, all Helmfile specs are defined in the `helmfile.d/` directory and executed in alphabetical order. The majority of Helmfile specs has the following structure:
6666

6767
```go-template
6868
#helmfiled./999-helmfile.yaml
@@ -106,7 +106,7 @@ flowchart LR
106106

107107
From the flow diagram, we can distinguish four stages of data, before `Kubernetes manifests` are rendered. These are: `Values repo`, `Helmfile bases`, `Helmfile release`, and `Helm chart`.
108108

109-
**Values repo**: It contains files that define input parameters for Otomi. This is where you can define teams, team, services, enabled applications and their configurations, etc. A user sets the `$ENV_DIR` env variable, so Otomi knows about its location.
109+
**Values repo**: It contains files that define input parameters for APL. This is where you can define teams, team, services, enabled applications and their configurations, etc. A user sets the `$ENV_DIR` env variable, so APL knows about its location.
110110

111111
**Helmfile bases**: From the flow diagram, three files incorporate the content of the `.Values` - a Helmfile variable, which is accessible while using Go templates. These files are merged together in the following order: `snippets/default.yaml` -> `snippets/env.gotmpl` -> `snippets/derived.gotmpl`.
112112

@@ -124,7 +124,7 @@ Almost each Helmfile spec loads `snippets/templates.gotmpl` file, which contains
124124

125125
# Validating data from the values repo
126126

127-
Otomi validates all parameters that a user can set in values repo by means checking values against JSON schema defined in the `values-schema.yaml` file. The validation can performed by calling `otomi validate-values` CLI command.
127+
APL validates all parameters that a user can set in values repo by means checking values against JSON schema defined in the `values-schema.yaml` file. The validation can performed by calling `otomi validate-values` CLI command.
128128

129129
The schema is also a great source of documentation as most of the defined properties have corresponding documentation.
130130

@@ -270,7 +270,7 @@ If your app has some parameters that a user should manipulate then make sure you
270270

271271
## Configuring Namespaces
272272

273-
Otomi defines Kubernetes namespaces and their labels in the `core.yaml` file, at the `k8s.namespaces` property.
273+
APL defines Kubernetes namespaces and their labels in the `core.yaml` file, at the `k8s.namespaces` property.
274274

275275
## Configuring Ingress
276276

@@ -307,19 +307,19 @@ Every team is deployed as a separate Helmfile release, thus targeting a specific
307307
otomi template -l name=team-ns-demo
308308
```
309309

310-
# Otomi CLI
310+
# APL CLI
311311

312312
## Developing CLI
313313

314314
TBD
315315

316316
## Using CLI while developing templates
317317

318-
Using Otomi CLI can be very helpful while integrating apps or developing new features that involve the execution of Helmfile because it allows you to render and validate manifests. It is possible to use Otomi CLI in development mode, so the Otomi CLI reflects changes made in your local `apl-core` directory.
318+
Using APL CLI can be very helpful while integrating apps or developing new features that involve the execution of Helmfile because it allows you to render and validate manifests. It is possible to use APL CLI in development mode, so the APL CLI reflects changes made in your local `apl-core` directory.
319319

320-
To run Otomi CLI in the development mode, you must:
320+
To run APL CLI in the development mode, you must:
321321

322-
- execute Otomi CLI commands from a root directory of the `apl-core` project
322+
- execute APL CLI commands from a root directory of the `apl-core` project
323323
- export `ENV_DIR`
324324

325325
First, run `npm install` to build all modules required for CLI.
@@ -344,7 +344,7 @@ export ENV_DIR=$HOME/otomi-values
344344
otomi bootstrap
345345
```
346346

347-
3. Now open `$ENV_DIR` directory in your favorite IDE. Otomi has bootstrapped the skeleton of the repo with default values.
347+
3. Now open `$ENV_DIR` directory in your favorite IDE. APL has bootstrapped the skeleton of the repo with default values.
348348
4. Last but not least provide information about your k8s cluster in `$ENV_DIR/env/cluster.yaml` file. Note, it can be fake data if you are not willing to deploy your changes to the cluster.
349349

350350
```
@@ -360,7 +360,7 @@ cluster:
360360
otomi validate-values
361361
```
362362

363-
Voila. You have built your values repo and can use it for Otomi development.
363+
Voila. You have built your values repo and can use it for APL development.
364364

365365
Below you can find some useful use cases:
366366

@@ -406,15 +406,15 @@ otomi x helmfile -l name=myapp write-values
406406

407407
# Troubleshooting
408408

409-
Some cloud providers are suing custom plugins to refresh the token. Since Otomi CLI executes by default in container some plugins may not be available. In order to solve this issue you can instruct Otomi CLI to execute directly on your host.
409+
Some cloud providers are suing custom plugins to refresh the token. Since APL CLI executes by default in container some plugins may not be available. In order to solve this issue you can instruct APL CLI to execute directly on your host.
410410

411411
First ensure that you have all required binaries
412412

413413
```
414414
npm run install-deps
415415
```
416416

417-
Then instruct Otomi to not run in docker:
417+
Then instruct APL to not run in docker:
418418

419419
```
420420
export IN_DOCKER=false

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@
118118
},
119119
"scripts": {
120120
"install-deps": "bin/install-deps.sh",
121-
"app-versions:csv": "echo 'name,appVersion,chartVersion'; for f in $(find charts -name Chart.yaml -type f -maxdepth 2| sort); do yq e -o=json -I=0 $f | jq -rc '. | [.name, .appVersion, .version] | @csv' | tr -d '\"'; done",
121+
"app-versions:csv": "echo 'name,appVersion,chartVersion'; for f in $(find charts -name Chart.yaml -type f -maxdepth 2| sort); do yq eval -o=json $f | jq -rc '. | [.name, .appVersion, .version] | @csv' | tr -d '\"'; done",
122+
"charts-update": "cd chart/chart-index && helm dep update",
123+
"charts-gen-deps": "for f in $(find charts -name Chart.yaml -type f -maxdepth 2| sort); do yq eval $f -o=json | jq '{name, version, repository}';done | jq -s '.' | yq eval -P",
122124
"adr": "adr-log -d adr -i",
123125
"check-policies": "ENV_DIR=$PWD/tests/fixtures NODE_ENV=test binzx/otomi check-policies",
124126
"clean": "rm -rf dist >/dev/null",

0 commit comments

Comments
 (0)