fix: update flux taskfile to not check if installed

Signed-off-by: Devin Buhl <devin@buhl.casa>
This commit is contained in:
Devin Buhl committed 2024-02-02 20:12:57 -05:00
1 parent eab63476b7
commit 2c62c13905
1 file changed
+2 -7
+2 -7
View File
@@ -25,14 +25,13 @@ tasks:
- kubectl apply --kubeconfig {{.KUBECONFIG_FILE}} --server-side --kustomize {{.KUBERNETES_DIR}}/flux/config - kubectl apply --kubeconfig {{.KUBECONFIG_FILE}} --server-side --kustomize {{.KUBERNETES_DIR}}/flux/config
preconditions: preconditions:
- { msg: "Missing kubeconfig", sh: "test -f {{.KUBECONFIG_FILE}}" } - { msg: "Missing kubeconfig", sh: "test -f {{.KUBECONFIG_FILE}}" }
- { msg: "Flux already installed", sh: "kubectl get namespace flux-system --kubeconfig {{.KUBECONFIG_FILE}} &>/dev/null && exit 1 || exit 0" }
- { msg: "Missing Sops Age key file", sh: "test -f {{.AGE_FILE}}" } - { msg: "Missing Sops Age key file", sh: "test -f {{.AGE_FILE}}" }
apply: apply:
desc: Apply a Flux Kustomization resource for a cluster desc: Apply a Flux Kustomization resource for a cluster
summary: | summary: |
Args: Args:
path: Path under {{.KUBERNETES_DIR}}/apps/ containing the Flux Kustomization resource (ks.yaml) (required) path: Path under apps containing the Flux Kustomization resource (ks.yaml) (required)
ns: Namespace the Flux Kustomization exists in (default: flux-system) ns: Namespace the Flux Kustomization exists in (default: flux-system)
cmd: | cmd: |
flux --kubeconfig {{.KUBECONFIG_FILE}} build ks $(basename {{.path}}) \ flux --kubeconfig {{.KUBECONFIG_FILE}} build ks $(basename {{.path}}) \
@@ -48,12 +47,9 @@ tasks:
vars: vars:
ns: '{{.ns | default "flux-system"}}' ns: '{{.ns | default "flux-system"}}'
ks: ks:
sh: | sh: flux --kubeconfig {{.KUBECONFIG_FILE}} --namespace {{.ns}} get kustomizations $(basename {{.path}}) 2>&1
[ -f {{.KUBECONFIG_FILE}} ] || exit 0;
flux --kubeconfig {{.KUBECONFIG_FILE}} --namespace {{.ns}} get kustomizations $(basename {{.path}}) 2>&1
preconditions: preconditions:
- { msg: "Missing kubeconfig", sh: "test -f {{.KUBECONFIG_FILE}}" } - { msg: "Missing kubeconfig", sh: "test -f {{.KUBECONFIG_FILE}}" }
- { msg: "Namespace {{.ns}} does not exist", sh: "kubectl get namespace {{.ns}} --kubeconfig {{.KUBECONFIG_FILE}} &>/dev/null && exit 0 || exit 1" }
- { msg: "Missing Flux Kustomization for app {{.path}}", sh: "test -f {{.KUBERNETES_DIR}}/apps/{{.path}}/ks.yaml" } - { msg: "Missing Flux Kustomization for app {{.path}}", sh: "test -f {{.KUBERNETES_DIR}}/apps/{{.path}}/ks.yaml" }
reconcile: reconcile:
@@ -61,7 +57,6 @@ tasks:
cmd: flux --kubeconfig {{.KUBECONFIG_FILE}} reconcile --namespace flux-system kustomization cluster --with-source cmd: flux --kubeconfig {{.KUBECONFIG_FILE}} reconcile --namespace flux-system kustomization cluster --with-source
preconditions: preconditions:
- { msg: "Missing kubeconfig", sh: "test -f {{.KUBECONFIG_FILE}}" } - { msg: "Missing kubeconfig", sh: "test -f {{.KUBECONFIG_FILE}}" }
- { msg: "Flux not installed", sh: "kubectl get namespace flux-system --kubeconfig {{.KUBECONFIG_FILE}} &>/dev/null && exit 0 || exit 1" }
github-deploy-key: github-deploy-key:
cmds: cmds: