fix problem with old charts

This commit is contained in:
Andrei Kvapil
2024-01-04 15:04:42 +01:00
parent 3d0f2ce93a
commit f2015d656c
13 changed files with 340 additions and 29 deletions

2
packages/.gitignore vendored
View File

@@ -1 +1 @@
repos/**
_out

View File

@@ -1,10 +1,16 @@
REPO=apps
OUT=../_out/apps
repo:
rm -rf ../repos/$(REPO)
mkdir -p ../repos/$(REPO)
cd ../repos/$(REPO) && helm package $$(find ../../$(REPO) -mindepth 2 -maxdepth 2 -name Chart.yaml | awk 'sub("/Chart.yaml", "")')
cd ../repos/$(REPO) && helm repo index .
rm -rf "$(OUT)"
mkdir -p "$(OUT)"
cat versions_map | while read chart version commit; do git archive "$$commit" "$$chart" | gzip > "$(OUT)/$$chart-$$version.tgz"; done
cd $(OUT) && helm repo index .
fix-chartnames:
find . -name Chart.yaml -maxdepth 2 | awk -F/ '{print $$2}' | while read i; do sed -i "s/^name: .*/name: $$i/" "$$i/Chart.yaml"; done
gen-versions-map: fix-chartnames
./gen_versions_map.sh
check-version-map: gen-versions-map
git diff --exit-code -- versions_map

View File

@@ -1,6 +1,6 @@
#!/bin/sh
set -e
file=$1
file=versions_map
charts=$(find . -mindepth 2 -maxdepth 2 -name Chart.yaml | awk 'sub("/Chart.yaml", "")')
# <chart> <version> <commit>
@@ -28,4 +28,4 @@ resolved_miss_map=$(
done
)
printf "%s\n" "$new_map" "$resolved_miss_map" | sort -k1,1 -k2,2 -V > "$file"
printf "%s\n" "$new_map" "$resolved_miss_map" | sort -k1,1 -k2,2 -V | awk '$1' > "$file"

247
packages/apps/index.yaml Normal file
View File

@@ -0,0 +1,247 @@
apiVersion: v1
entries:
http-balancer:
- apiVersion: v2
appVersion: 1.16.0
created: "2024-01-04T13:40:01.389746+01:00"
description: Layer7 load balacner and caching service
digest: e32d7f84ad89888473a3f64d113fc6271b83b935cc8f2ad176eb02f715eaa531
icon: https://www.svgrepo.com/show/373924/nginx.svg
name: http-balancer
type: application
urls:
- http-balancer-0.1.0.tgz
version: 0.1.0
- apiVersion: v2
appVersion: 1.16.0
created: "2024-01-04T13:40:01.405121+01:00"
description: Layer7 load balacner and caching service
digest: 57b3eb78ebd3a588d28411767b8e943be67480297a7fce3ba687c89d5f34383c
icon: https://www.svgrepo.com/show/373924/nginx.svg
name: http-balancer
type: application
urls:
- _out/http-balancer-0.1.0.tgz
version: 0.1.0
kubernetes:
- apiVersion: v2
appVersion: 1.16.0
created: "2024-01-04T13:40:01.389987+01:00"
description: Managed Kubernetes service
digest: bcd65b7c84497e23cf9bac12cde8a8f09b397b8319bc0955846123b715fb7584
icon: https://upload.wikimedia.org/wikipedia/commons/thumb/3/39/Kubernetes_logo_without_workmark.svg/723px-Kubernetes_logo_without_workmark.svg.png
name: kubernetes
type: application
urls:
- kubernetes-0.1.0.tgz
version: 0.1.0
- apiVersion: v2
appVersion: 1.16.0
created: "2024-01-04T13:40:01.405429+01:00"
description: Managed Kubernetes service
digest: 49eeedef417ab9fcd1c571fe44dde09fee6aea465a7cfbe0b6bddbdaf11c34c3
icon: https://upload.wikimedia.org/wikipedia/commons/thumb/3/39/Kubernetes_logo_without_workmark.svg/723px-Kubernetes_logo_without_workmark.svg.png
name: kubernetes
type: application
urls:
- _out/kubernetes-0.1.0.tgz
version: 0.1.0
monitoring-hub:
- apiVersion: v1
created: "2024-01-04T13:40:01.403315+01:00"
digest: 982979e27ced053dcd0b28c69611d62c8ce5f6a59c0f93ea3aa21f1cc31928a4
name: monitoring-hub
urls:
- monitoring-hub-0.0.0.tgz
version: 0.0.0
- apiVersion: v1
created: "2024-01-04T13:40:01.407014+01:00"
digest: 3bcd1bcadfdd5afe41ce05ea15355705e86ca3ed6bbd860490614d3241192301
name: monitoring-hub
urls:
- _out/monitoring-hub-0.0.0.tgz
version: 0.0.0
mysql:
- apiVersion: v2
appVersion: 1.16.0
created: "2024-01-04T13:40:01.403522+01:00"
description: Managed MariaDB service
digest: 382eff482300afadfff849aea6b0f701b769d8d8ce11fc0b5a64dc96e2ff7c74
icon: https://static-00.iconduck.com/assets.00/mariadb-icon-512x340-txozryr2.png
name: mysql
type: application
urls:
- mysql-0.1.0.tgz
version: 0.1.0
- apiVersion: v2
appVersion: 1.16.0
created: "2024-01-04T13:40:01.407297+01:00"
description: Managed MariaDB service
digest: 8cede12978ba19517442c2d9120e96b9d16faf0548f8d5048d8c9083fa1bc74a
icon: https://static-00.iconduck.com/assets.00/mariadb-icon-512x340-txozryr2.png
name: mysql
type: application
urls:
- _out/mysql-0.1.0.tgz
version: 0.1.0
postgres:
- apiVersion: v2
appVersion: 1.16.0
created: "2024-01-04T13:40:01.40371+01:00"
description: Managed PostgreSQL service
digest: 5bab72e61ad4c0eea56d83c189be6f4aba9beefccc6c6563823575e8f66b423a
icon: https://cdn-icons-png.flaticon.com/512/5968/5968342.png
name: postgres
type: application
urls:
- postgres-0.1.0.tgz
version: 0.1.0
- apiVersion: v2
appVersion: 1.16.0
created: "2024-01-04T13:40:01.407627+01:00"
description: Managed PostgreSQL service
digest: 365daa1cf207fcaf690f7987406d29ff27d3599f1ddf8391e1d26b184d737946
icon: https://cdn-icons-png.flaticon.com/512/5968/5968342.png
name: postgres
type: application
urls:
- _out/postgres-0.1.0.tgz
version: 0.1.0
rabbitmq:
- apiVersion: v2
appVersion: 1.16.0
created: "2024-01-04T13:40:01.403904+01:00"
description: Managed RabbitMQ service
digest: 1167d0a1ef77749a47d8d1bd26f87c78b7de4f0ba1516d07623715903f86ea09
icon: https://static-00.iconduck.com/assets.00/rabbitmq-icon-484x512-s9lfaapn.png
name: rabbitmq
type: application
urls:
- rabbitmq-0.1.0.tgz
version: 0.1.0
- apiVersion: v2
appVersion: 1.16.0
created: "2024-01-04T13:40:01.40787+01:00"
description: Managed RabbitMQ service
digest: 5ded32dc9bcdd71b631df56c6c60ae22c251d458935a665328357f3992e6e7c6
icon: https://static-00.iconduck.com/assets.00/rabbitmq-icon-484x512-s9lfaapn.png
name: rabbitmq
type: application
urls:
- _out/rabbitmq-0.1.0.tgz
version: 0.1.0
redis:
- apiVersion: v2
appVersion: 1.16.0
created: "2024-01-04T13:40:01.404092+01:00"
description: Managed Redis service
digest: f3367044ad045e7898b4241c7a9753d7f68b577ded2e065bc15945b0d4c578c8
icon: https://cdn4.iconfinder.com/data/icons/redis-2/1451/Untitled-2-512.png
name: redis
type: application
urls:
- redis-0.1.0.tgz
version: 0.1.0
- apiVersion: v2
appVersion: 1.16.0
created: "2024-01-04T13:40:01.408108+01:00"
description: Managed Redis service
digest: d1c0a3bd7985d47770de607307edc28b16d0c3127d11a925d7210cbe54d6e74a
icon: https://cdn4.iconfinder.com/data/icons/redis-2/1451/Untitled-2-512.png
name: redis
type: application
urls:
- _out/redis-0.1.0.tgz
version: 0.1.0
tcp-balancer:
- apiVersion: v2
appVersion: 1.16.0
created: "2024-01-04T13:40:01.404271+01:00"
description: Layer4 load balancer service
digest: a71b137f7c9ba5507b2efd50308c5ff403e3f967600897dc357e6fb96622a859
icon: https://cdn.icon-icons.com/icons2/2699/PNG/512/haproxy_logo_icon_171017.png
name: tcp-balancer
type: application
urls:
- tcp-balancer-0.1.0.tgz
version: 0.1.0
- apiVersion: v2
appVersion: 1.16.0
created: "2024-01-04T13:40:01.408342+01:00"
description: Layer4 load balancer service
digest: 66429a4a8f6a1b74280c7abbfffb5a613dc609f160c5d46bceaf6cf013c18e54
icon: https://cdn.icon-icons.com/icons2/2699/PNG/512/haproxy_logo_icon_171017.png
name: tcp-balancer
type: application
urls:
- _out/tcp-balancer-0.1.0.tgz
version: 0.1.0
virtual-machine:
- apiVersion: v2
appVersion: 1.16.1
created: "2024-01-04T13:40:01.404549+01:00"
description: Virtual machine instance
digest: 6853ca5c09bf8cf47b8a298b376f45a54e046bf89446188eb6eeff74134c1dae
icon: https://www.svgrepo.com/show/448273/azure-vms.svg
name: virtual-machine
type: application
urls:
- virtual-machine-0.1.4.tgz
version: 0.1.4
- apiVersion: v2
appVersion: 1.16.1
created: "2024-01-04T13:40:01.408747+01:00"
description: Virtual machine instance
digest: 7f3d766938bb31ecc0de40e3a642f478cec2c06ccdd25654a8a80c87924ad1c1
icon: https://www.svgrepo.com/show/448273/azure-vms.svg
name: virtual-machine
type: application
urls:
- _out/virtual-machine-0.1.4.tgz
version: 0.1.4
- apiVersion: v2
appVersion: 1.16.1
created: "2024-01-04T13:40:01.404417+01:00"
description: Virtual machine instance
digest: 1cb6b31fe0afcfb7634b0467ff1d4aa6250feea09ea9f4e99acfcfc405c92751
icon: https://www.svgrepo.com/show/448273/azure-vms.svg
name: virtual-machine
type: application
urls:
- virtual-machine-0.1.3.tgz
version: 0.1.3
- apiVersion: v2
appVersion: 1.16.1
created: "2024-01-04T13:40:01.408567+01:00"
description: Virtual machine instance
digest: 9beea9abe8f73abb8730e46493f7a58630ae8ae8bcc3a84dc0d0ad7b3a27139d
icon: https://www.svgrepo.com/show/448273/azure-vms.svg
name: virtual-machine
type: application
urls:
- _out/virtual-machine-0.1.3.tgz
version: 0.1.3
vpn:
- apiVersion: v2
appVersion: 1.16.0
created: "2024-01-04T13:40:01.404736+01:00"
description: Establish a connection from your computer
digest: dfbe42216e419ac276a29a2bf8c30fae4b3af69c78af812e41f9d497badbd9b8
icon: https://www.telepresence.io/static/telepresence-edgy-3cf14d0402757769e6aff3f0ea4067d5.svg
name: vpn
type: application
urls:
- vpn-0.1.0.tgz
version: 0.1.0
- apiVersion: v2
appVersion: 1.16.0
created: "2024-01-04T13:40:01.408973+01:00"
description: Establish a connection from your computer
digest: ec3265090171a4c1009d313c59320c725168656c6f92b5a32569f40f45f08521
icon: https://www.telepresence.io/static/telepresence-edgy-3cf14d0402757769e6aff3f0ea4067d5.svg
name: vpn
type: application
urls:
- _out/vpn-0.1.0.tgz
version: 0.1.0
generated: "2024-01-04T13:40:01.389297+01:00"

View File

@@ -0,0 +1,11 @@
http-balancer 0.1.0 HEAD
kubernetes 0.1.0 HEAD
monitoring-hub 0.0.0 HEAD
mysql 0.1.0 HEAD
postgres 0.1.0 HEAD
rabbitmq 0.1.0 HEAD
redis 0.1.0 HEAD
tcp-balancer 0.1.0 HEAD
virtual-machine 0.1.3 be43e42
virtual-machine 0.1.4 HEAD
vpn 0.1.0 HEAD

View File

@@ -1,2 +1,4 @@
gen: fix-chartnames
fix-chartnames:
find . -name Chart.yaml -maxdepth 2 | awk -F/ '{print $$2}' | while read i; do printf "name: cozy-%s\nversion: 1.0.0\n" "$$i" > "$$i/Chart.yaml"; done

View File

@@ -1,5 +1,7 @@
NAMESPACE=cozy-installer
NAME=installer
PUSH=1
LOAD=0
show:
helm template -n $(NAMESPACE) $(NAME) .
@@ -11,4 +13,13 @@ diff:
helm template -n $(NAMESPACE) $(NAME) . | kubectl diff -f -
image:
docker build -f images/installer/Dockerfile ../../..
#docker build -f images/installer/Dockerfile ../../..
docker buildx build -f images/installer/Dockerfile ../../.. \
--provenance false \
--tag ghcr.io/aenix-io/cozystack/installer:latest \
--cache-from type=registry,ref=ghcr.io/aenix-io/cozystack/installer:latest \
--cache-to type=inline \
--metadata-file images/installer.json \
--push=$(PUSH) \
--load=$(LOAD)

View File

@@ -0,0 +1,14 @@
{
"containerimage.config.digest": "sha256:7a384d055bdc344a927817201d8582649c7848e297ef100d05becce1562e2f05",
"containerimage.descriptor": {
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"digest": "sha256:b32bc78343d41fdbfc655a50134abc79b39294dc84d020d30019f7639cf67071",
"size": 1878,
"platform": {
"architecture": "amd64",
"os": "linux"
}
},
"containerimage.digest": "sha256:b32bc78343d41fdbfc655a50134abc79b39294dc84d020d30019f7639cf67071",
"image.name": "ghcr.io/aenix-io/cozystack/installer:latest"
}

View File

@@ -1,12 +1,26 @@
FROM alpine:3.19 AS builder
RUN apk add --no-cache make git
RUN apk add helm --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community
COPY . /src/
WORKDIR /src
# Check that versions_map is not changed
RUN make -C packages/apps check-version-map
RUN make -C packages/system repo \
&& make -C packages/apps repo
FROM alpine:3.19
RUN apk add --no-cache make darkhttpd
RUN apk add helm kubectl --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community
COPY packages /cozystack/packages
RUN make -C /cozystack/packages/system repo
RUN make -C /cozystack/packages/apps repo
COPY packages/core/installer/images/installer/scripts/* /cozystack/
COPY --from=builder /src/packages/core /cozystack/packages/core
COPY --from=builder /src/packages/system /cozystack/packages/system
COPY --from=builder /src/packages/_out /cozystack/repos
RUN ln -s /cozystack/packages/core/installer/images/installer/scripts /scripts
ENTRYPOINT [ "/scripts/run.sh" ]
WORKDIR /cozystack
ENTRYPOINT [ "/cozystack/run.sh" ]

View File

@@ -11,13 +11,13 @@ flux_is_ok() {
}
install_basic_charts() {
make -C /cozystack/packages/system/cilium apply
make -C /cozystack/packages/system/kubeovn apply
make -C /cozystack/packages/system/fluxcd apply
make -C packages/system/cilium apply
make -C packages/system/kubeovn apply
make -C packages/system/fluxcd apply
}
# Install namespaces
make -C /cozystack/packages/core/platform namespaces-apply
make -C packages/core/platform namespaces-apply
# Install basic system charts
if ! flux_is_ok; then
@@ -28,10 +28,12 @@ fi
run_migrations
# Install platform chart
make -C /cozystack/packages/core/platform apply
make -C packages/core/platform apply
trap 'exit' INT TERM
# Reconcile platform chart
while true; do
sleep 60 & wait
make -C /cozystack/packages/core/platform apply
make -C packages/core/platform apply
done

View File

@@ -52,17 +52,17 @@ spec:
serviceAccountName: cozystack
containers:
- name: cozystack
image: ghcr.io/kvaps/test:cozystack-installer
image: ghcr.io/aenix-io/cozystack/installer:latest
env:
- name: KUBERNETES_SERVICE_HOST
value: localhost
- name: KUBERNETES_SERVICE_PORT
value: "7445"
- name: darkhttpd
image: ghcr.io/kvaps/test:cozystack-installer
image: ghcr.io/aenix-io/cozystack/installer:latest
command:
- /usr/bin/darkhttpd
- /cozystack/packages/repos
- /cozystack/repos
- --port
- "8123"
ports:

View File

@@ -1,10 +1,12 @@
REPO=system
OUT=../_out/system
gen: fix-chartnames
repo: fix-chartnames
rm -rf ../repos/$(REPO)
mkdir -p ../repos/$(REPO)
cd ../repos/$(REPO) && helm package $$(find ../../$(REPO) -mindepth 2 -maxdepth 2 -name Chart.yaml | awk 'sub("/Chart.yaml", "")')
cd ../repos/$(REPO) && helm repo index .
rm -rf "$(OUT)"
mkdir -p "$(OUT)"
helm package -d "$(OUT)" $$(find . -mindepth 2 -maxdepth 2 -name Chart.yaml | awk 'sub("/Chart.yaml", "")')
cd "$(OUT)" && helm repo index .
fix-chartnames:
find . -name Chart.yaml -maxdepth 2 | awk -F/ '{print $$2}' | while read i; do printf "name: cozy-%s\nversion: 1.0.0\n" "$$i" > "$$i/Chart.yaml"; done

View File

@@ -1,5 +1,7 @@
NAME=kubeapps
NAMESPACE=cozy-kubeapps
PUSH=1
LOAD=0
show:
helm template --dry-run=server -n $(NAMESPACE) $(NAME) .