mirror of
https://github.com/outbackdingo/cozystack.git
synced 2026-01-27 10:18:39 +00:00
[platform] Use cozypkg instead of helm
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
This commit is contained in:
@@ -1,37 +0,0 @@
|
||||
#!/bin/sh
|
||||
# This scripts adds common fluxcd labels to all objects
|
||||
|
||||
if [ -z "$NAME" ]; then
|
||||
echo 'Variable $NAME is not set!' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$NAMESPACE" ]; then
|
||||
echo 'Variable $NAMESPACE is not set!' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TMP_DIR=$(mktemp -d)
|
||||
cat - > "${TMP_DIR}/helm-generated-output.yaml"
|
||||
cat > "${TMP_DIR}/global-labels.yaml" <<EOT
|
||||
apiVersion: builtin
|
||||
kind: LabelTransformer
|
||||
metadata:
|
||||
name: global-labels
|
||||
labels:
|
||||
helm.toolkit.fluxcd.io/name: ${NAME}
|
||||
helm.toolkit.fluxcd.io/namespace: ${NAMESPACE:-$HELM_NAMESPACE}
|
||||
fieldSpecs:
|
||||
- path: metadata/labels
|
||||
create: true
|
||||
EOT
|
||||
cat > "${TMP_DIR}/kustomization.yaml" <<EOT
|
||||
resources:
|
||||
- helm-generated-output.yaml
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
transformers:
|
||||
- global-labels.yaml
|
||||
EOT
|
||||
kubectl kustomize "${TMP_DIR}"
|
||||
rm -rf "${TMP_DIR}"
|
||||
@@ -1,30 +1,26 @@
|
||||
.DEFAULT_GOAL=help
|
||||
.PHONY=help show diff apply delete update image
|
||||
.VALUES_FILES=$(shell kubectl get hr -n $(NAMESPACE) $(NAME) -o go-template='{{ range .spec.chart.spec.valuesFiles}}-f {{ . }} {{ end }}-f -')
|
||||
|
||||
help: ## Show this help.
|
||||
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
|
||||
|
||||
show: check ## Show output of rendered templates
|
||||
kubectl get hr -n $(NAMESPACE) $(NAME) -o jsonpath='{.spec.values}' | NAMESPACE=$(NAMESPACE) NAME=$(NAME) \
|
||||
helm template --dry-run=server --post-renderer ../../../scripts/fluxcd-kustomize.sh -n $(NAMESPACE) $(NAME) . $(.VALUES_FILES)
|
||||
cozypkg show -n $(NAMESPACE) $(NAME)
|
||||
|
||||
apply: check suspend ## Apply Helm release to a Kubernetes cluster
|
||||
kubectl get hr -n $(NAMESPACE) $(NAME) -o jsonpath='{.spec.values}' | NAMESPACE=$(NAMESPACE) NAME=$(NAME) \
|
||||
helm upgrade -i --post-renderer ../../../scripts/fluxcd-kustomize.sh -n $(NAMESPACE) $(NAME) . $(.VALUES_FILES)
|
||||
cozypkg apply -n $(NAMESPACE) $(NAME)
|
||||
|
||||
diff: check ## Diff Helm release against objects in a Kubernetes cluster
|
||||
kubectl get hr -n $(NAMESPACE) $(NAME) -o jsonpath='{.spec.values}' | NAMESPACE=$(NAMESPACE) NAME=$(NAME) \
|
||||
helm diff upgrade --dry-run=server --show-secrets --allow-unreleased --post-renderer ../../../scripts/fluxcd-kustomize.sh -n $(NAMESPACE) $(NAME) . $(.VALUES_FILES)
|
||||
cozypkg diff -n $(NAMESPACE) $(NAME)
|
||||
|
||||
suspend: check ## Suspend reconciliation for an existing Helm release
|
||||
kubectl patch hr -n $(NAMESPACE) $(NAME) -p '{"spec": {"suspend": true}}' --type=merge --field-manager=flux-client-side-apply
|
||||
cozypkg suspend -n $(NAMESPACE) $(NAME)
|
||||
|
||||
resume: check ## Resume reconciliation for an existing Helm release
|
||||
kubectl patch hr -n $(NAMESPACE) $(NAME) -p '{"spec": {"suspend": null}}' --type=merge --field-manager=flux-client-side-apply
|
||||
cozypkg resume -n $(NAMESPACE) $(NAME)
|
||||
|
||||
delete: check suspend ## Delete Helm release from a Kubernetes cluster
|
||||
helm uninstall -n $(NAMESPACE) $(NAME)
|
||||
cozypkg delete -n $(NAMESPACE) $(NAME)
|
||||
|
||||
check:
|
||||
@if [ -z "$(NAME)" ]; then echo "env NAME is not set!" >&2; exit 1; fi
|
||||
|
||||
Reference in New Issue
Block a user