64 lines
2.1 KiB
YAML
64 lines
2.1 KiB
YAML
---
|
|
# yaml-language-server: $schema=https://taskfile.dev/schema.json
|
|
version: '3'
|
|
|
|
vars:
|
|
KUBECONFORM_SCRIPT: "{{.SCRIPTS_DIR}}/kubeconform.sh"
|
|
|
|
tasks:
|
|
|
|
apply-ks:
|
|
desc: Apply a Flux Kustomization resource for a cluster
|
|
summary: |-
|
|
PATH: Path to the Flux Kustomization resource from the apps base dir (required, e.g. network/echo-server)
|
|
NS: Namespace the Flux Kustomization exists in (default: flux-system)
|
|
cmd: >
|
|
flux build --namespace {{.NS}} ks {{base .PATH}}
|
|
--kustomization-file {{.KUBERNETES_DIR}}/apps/{{.PATH}}/ks.yaml
|
|
--path {{.KUBERNETES_DIR}}/apps/{{.PATH}}
|
|
{{- if contains "not found" .KS }}--dry-run \{{ end }}
|
|
| yq 'with(select(.apiVersion == "kustomize.toolkit.fluxcd.io/v1" and .kind == "Kustomization"); .metadata.namespace = "{{.NS}}")' -
|
|
| kubectl apply --server-side --field-manager=kustomize-controller -f -
|
|
requires:
|
|
vars: [PATH]
|
|
vars:
|
|
NS: '{{.NS | default "flux-system"}}'
|
|
KS:
|
|
sh: flux --namespace {{.NS}} get kustomizations {{base .PATH}} 2>&1
|
|
preconditions:
|
|
- test -f {{.KUBERNETES_DIR}}/apps/{{.PATH}}/ks.yaml
|
|
|
|
reconcile:
|
|
desc: Force update Flux to pull in changes from your Git repository
|
|
cmd: flux reconcile --namespace flux-system kustomization cluster --with-source
|
|
preconditions:
|
|
- msg: Missing kubeconfig
|
|
sh: test -f {{.KUBECONFIG}}
|
|
|
|
kubeconform:
|
|
desc: Validate Kubernetes manifests with kubeconform
|
|
cmd: bash {{.KUBECONFORM_SCRIPT}} {{.KUBERNETES_DIR}}
|
|
preconditions:
|
|
- msg: Missing kubeconform script
|
|
sh: test -f {{.KUBECONFORM_SCRIPT}}
|
|
|
|
resources:
|
|
desc: Gather common resources in your cluster, useful when asking for support
|
|
cmds:
|
|
- for: { var: RESOURCE }
|
|
cmd: kubectl get {{.ITEM}} {{.CLI_ARGS | default "-A"}}
|
|
vars:
|
|
RESOURCE: >-
|
|
nodes
|
|
gitrepositories
|
|
kustomizations
|
|
helmrepositories
|
|
helmreleases
|
|
certificates
|
|
certificaterequests
|
|
ingresses
|
|
pods
|
|
preconditions:
|
|
- msg: Missing kubeconfig
|
|
sh: test -f {{.KUBECONFIG}}
|