fix: chicken and egg problem (#57)

This commit is contained in:
Andrei Kvapil
2024-04-02 08:53:34 +02:00
committed by GitHub
parent c58db33712
commit 2e3314b2dd
4 changed files with 27 additions and 9 deletions

View File

@@ -2,13 +2,13 @@ NAMESPACE=cozy-cilium
NAME=cilium
show:
helm template --dry-run=server -n $(NAMESPACE) $(NAME) .
kubectl get hr -n cozy-cilium cilium -o jsonpath='{.spec.values}' | helm template --dry-run=server -n $(NAMESPACE) $(NAME) . -f -
apply:
helm upgrade -i -n $(NAMESPACE) $(NAME) .
kubectl get hr -n cozy-cilium cilium -o jsonpath='{.spec.values}' | helm upgrade -i -n $(NAMESPACE) $(NAME) . -f -
diff:
helm diff upgrade --allow-unreleased --normalize-manifests -n $(NAMESPACE) $(NAME) .
kubectl get hr -n cozy-cilium cilium -o jsonpath='{.spec.values}' | helm diff upgrade --allow-unreleased --normalize-manifests -n $(NAMESPACE) $(NAME) . -f -
update:
rm -rf charts

View File

@@ -7,6 +7,14 @@ show:
apply:
helm upgrade -i -n $(NAMESPACE) $(NAME) .
apply-crds:
helm template -n $(NAMESPACE) $(NAME) . $(addprefix -s ,$(wildcard charts/flux2/templates/*.crds.yaml)) | kubectl apply -f -
kubectl annotate $$(kubectl get crd -o name | grep '\.fluxcd\.io$$') meta.helm.sh/release-namespace=$(NAMESPACE) meta.helm.sh/release-name=$(NAME)
kubectl label $$(kubectl get crd -o name | grep '\.fluxcd\.io$$') app.kubernetes.io/managed-by=Helm
diff-crds:
helm template -n $(NAMESPACE) $(NAME) . $(addprefix -s ,$(wildcard charts/flux2/templates/*.crds.yaml)) | kubectl apply -f -
diff:
helm diff upgrade --allow-unreleased --normalize-manifests -n $(NAMESPACE) $(NAME) .

View File

@@ -2,13 +2,13 @@ NAMESPACE=cozy-kubeovn
NAME=kubeovn
show:
helm template --dry-run=server -n $(NAMESPACE) $(NAME) .
kubectl get hr -n $(NAMESPACE) $(NAME) -o jsonpath='{.spec.values}' | helm template --dry-run=server -n $(NAMESPACE) $(NAME) . -f -
apply:
helm upgrade -i -n $(NAMESPACE) $(NAME) .
kubectl get hr -n $(NAMESPACE) $(NAME) -o jsonpath='{.spec.values}' | helm upgrade -i -n $(NAMESPACE) $(NAME) . -f -
diff:
helm diff upgrade --allow-unreleased --normalize-manifests -n $(NAMESPACE) $(NAME) .
kubectl get hr -n $(NAMESPACE) $(NAME) -o jsonpath='{.spec.values}' | helm diff upgrade --allow-unreleased --normalize-manifests -n $(NAMESPACE) $(NAME) . -f -
update:
rm -rf charts && mkdir -p charts/kube-ovn

View File

@@ -20,8 +20,13 @@ flux_is_ok() {
}
install_basic_charts() {
bundle=$(kubectl get configmap -n cozy-system cozystack -o 'go-template={{index .data "bundle-name"}}')
if [ "$bundle" = "full-paas" ] || [ "$bundle" = "full-distro" ]; then
make -C packages/system/cilium apply
make -C packages/system/kubeovn apply
fi
if [ "$bundle" = "full-paas" ]; then
make -C packages/system/kubeovn apply
fi
make -C packages/system/fluxcd apply
}
@@ -33,9 +38,9 @@ run_migrations
# Install namespaces
make -C packages/core/platform namespaces-apply
# Install basic system charts
# Install fluxcd CRDs
if ! flux_is_ok; then
install_basic_charts
make -C packages/system/fluxcd apply-crds
fi
# Reconcile Helm repositories
@@ -44,6 +49,11 @@ kubectl annotate helmrepositories.source.toolkit.fluxcd.io -A -l cozystack.io/re
# Install platform chart
make -C packages/core/platform apply
# Install basic system charts (should be after platform chart applied)
if ! flux_is_ok; then
install_basic_charts
fi
# Reconcile platform chart
trap 'exit' INT TERM
while true; do