Skip to content

Commit

Permalink
Restructure addons (YAKEcloud#897)
Browse files Browse the repository at this point in the history
Signed-off-by: Jens Schneider <schneider@23technologies.cloud>
Co-authored-by: Lothar Bach <bach@23technologies.cloud>
  • Loading branch information
JensAc and lotharbach authored Jun 30, 2023
1 parent 319a4ec commit 8fa8d49
Show file tree
Hide file tree
Showing 22 changed files with 89 additions and 19 deletions.
14 changes: 13 additions & 1 deletion .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,19 @@
},
{
"fileMatch": [
"^pre-gardener/addons/templates/velero.yaml$"
"^addons/addons/templates/dashboard.yaml$"
],
"datasourceTemplate": "helm",
"registryUrlTemplate": "https://gardener-community.github.io/gardener-charts",
"versioningTemplate": "semver-coerced",
"matchStrings": [
// https://regex101.com/r/KY8baj/1
"chart: (?<depName>[a-z-]+)\n +version: (?<currentValue>[0-9.]+)"
]
},
{
"fileMatch": [
"^addons/addons/templates/velero.yaml$"
],
"datasourceTemplate": "helm",
"registryUrlTemplate": "https://vmware-tanzu.github.io/helm-charts",
Expand Down
2 changes: 1 addition & 1 deletion .yamllint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ ignore: |
gardener/garden-content/templates/
hack/ci/secrets/
hack/ci/dev-env/config/charts
pre-gardener/addons/templates/
addons/addons/templates/
configuration/configuration/templates/
pre-gardener/dnsprovider/templates/
configuration/generated-secrets/templates/
Expand Down
2 changes: 1 addition & 1 deletion pre-gardener/addons.yaml → addons/addons.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ spec:
interval: 1m
chart:
spec:
chart: pre-gardener/addons
chart: addons/addons
reconcileStrategy: Revision
sourceRef:
kind: GitRepository
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
name: extensions
name: addons
description: A Helm chart for addons to install with the pre-gardener ks

type: application
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.dashboard.enabled }}
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
Expand Down Expand Up @@ -96,3 +97,4 @@ spec:
- kind: Secret
name: dashboard-values
optional: true
{{- end }}
File renamed without changes.
File renamed without changes.
17 changes: 17 additions & 0 deletions addons/addons/tests/dashboard_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
templates:
- dashboard.yaml
tests:
- it: should create HelmRelease with default values
asserts:
- isKind:
of: HelmRelease
documentIndex: 0
- isKind:
of: HelmRelease
documentIndex: 1
- it: should create HelmRelease when dashboard is disabled
set:
dashboard.enabled: false
asserts:
- hasDocuments:
count: 0
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions pre-gardener/addons/values.yaml → addons/addons/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ backups:
enabled: false
vpa:
enabled: false
dashboard:
enabled: true
4 changes: 4 additions & 0 deletions addons/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- addons.yaml
1 change: 0 additions & 1 deletion configuration/configuration/tests/dashboard_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ tests:
hosts:
- dashboard.mydomain.example.org
annotations:
kubernetes.io/ingress.class: nginx
cert.gardener.cloud/purpose: managed
cert.gardener.cloud/class: base-cert-class
dns.gardener.cloud/dnsnames: "*"
Expand Down
22 changes: 22 additions & 0 deletions docs/release-notes/next.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,28 @@ hide_table_of_contents: true
# Release Notes next

## 23KE release notes and upgrade guide
- Before upgrade
- The addons chart was moved to the top-level directory and is managed by its own `Kustomization` now. Moreover, the gardener dashboard is now part of the addons chart allowing to switch it off when not needed. Therefore, you should
```sh
flux suspend ks pre-gardener
kubectl label -n flux-system hr dashboard-runtime kustomize.toolkit.fluxcd.io/name-
kubectl label -n flux-system hr dashboard-runtime kustomize.toolkit.fluxcd.io/namespace-
kubectl label -n flux-system hr dashboard-runtime app.kubernetes.io/managed-by=Helm
kubectl annotate -n flux-system hr dashboard-runtime meta.helm.sh/release-name=addons
kubectl annotate -n flux-system hr dashboard-runtime meta.helm.sh/release-namespace=flux-system

kubectl label -n flux-system hr dashboard-application kustomize.toolkit.fluxcd.io/name-
kubectl label -n flux-system hr dashboard-application kustomize.toolkit.fluxcd.io/namespace-
kubectl label -n flux-system hr dashboard-application app.kubernetes.io/managed-by=Helm
kubectl annotate -n flux-system hr dashboard-application meta.helm.sh/release-name=addons
kubectl annotate -n flux-system hr dashboard-application meta.helm.sh/release-namespace=flux-system
```

- After upgrade
- Resume the pre-gardener `Kustomization` again
```sh
flux resume ks pre-gardener
```

## Related upstream release notes / changelogs

Expand Down
19 changes: 19 additions & 0 deletions flux/addons.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
kind: Kustomization
metadata:
name: addons
namespace: flux-system
spec:
interval: 1m
dependsOn:
- name: configuration
sourceRef:
kind: GitRepository
name: 23ke
path: ./addons
prune: true
healthChecks:
- apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
name: addons
namespace: flux-system
9 changes: 0 additions & 9 deletions flux/gardener.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ metadata:
spec:
interval: 1m
dependsOn:
- name: 23ke-env-config
- name: pre-gardener
sourceRef:
kind: GitRepository
Expand All @@ -18,14 +17,6 @@ spec:
kind: HelmRelease
name: cloudprofiles
namespace: flux-system
- apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
name: dashboard-runtime
namespace: flux-system
- apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
name: dashboard-application
namespace: flux-system
- apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
name: etcd
Expand Down
2 changes: 2 additions & 0 deletions flux/pre-gardener.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ metadata:
namespace: flux-system
spec:
interval: 1m
dependsOn:
- name: addons
sourceRef:
kind: GitRepository
name: 23ke
Expand Down
1 change: 0 additions & 1 deletion gardener/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ kind: Kustomization
resources:
- certificates.yaml
- cloudprofiles.yaml
- dashboard.yaml
- etcd.yaml
- etcd-events.yaml
- extensions.yaml
Expand Down
5 changes: 3 additions & 2 deletions hack/release/make-tmp-release-dir.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ cp -r 23kectl.yaml $tmpDir
cp -r kustomization.yaml $tmpDir
cp -r flux $tmpDir
cp -r configuration $tmpDir
cp -r addons $tmpDir
cp -r pre-gardener $tmpDir
cp -r flux-system $tmpDir
cp -r gardener $tmpDir
Expand All @@ -24,7 +25,7 @@ cwd=$(pwd)
cd $tmpDir

# replace GitRepository with $sourceType in 23ke-directories
for file in $(grep -lr GitRepository configuration pre-gardener gardener flux | sed 's/^\.\///'); do
for file in $(grep -lr GitRepository configuration addons pre-gardener gardener flux | sed 's/^\.\///'); do
sed -i s/GitRepository/$sourceType/ $file
done

Expand All @@ -36,7 +37,7 @@ for file in $(grep --exclude=configuration.yaml \
--exclude=dnsprovider.yaml \
--exclude=issuer.yaml \
--exclude=certificates.yaml \
-lr "kind: HelmRelease" configuration pre-gardener gardener)
-lr "kind: HelmRelease" configuration addons pre-gardener gardener)
do
# prepend helmcharts/ to chart:
sed -i -E "s/(chart: )(.+)/\1helmcharts\/\2/" $file
Expand Down
2 changes: 1 addition & 1 deletion hack/run-helm-unittest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ CONFIGVALUES="$($HELM template --kube-version 1.24.0 configuration/configuration

$HELM unittest configuration/configuration

for chart in pre-gardener/addons pre-gardener/dnsprovider pre-gardener/issuer gardener/certificates gardener/extensions gardener/garden-content; do
for chart in addons/addons pre-gardener/dnsprovider pre-gardener/issuer gardener/certificates gardener/extensions gardener/garden-content; do

CHARTNAME="$(basename $chart)"
export CHARTNAME
Expand Down
1 change: 1 addition & 0 deletions kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- flux/configuration.yaml
- flux/addons.yaml
- flux/pre-gardener.yaml
- flux/gardener.yaml
- flux/flux-system.yaml
1 change: 0 additions & 1 deletion pre-gardener/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- addons.yaml
- cert-management.yaml
- cert-manager.yaml
- dnsprovider.yaml
Expand Down

0 comments on commit 8fa8d49

Please sign in to comment.