Skip to content

Commit

Permalink
chore(yaskfile): update volsync state task
Browse files Browse the repository at this point in the history
Signed-off-by: Devin Buhl <[email protected]>
  • Loading branch information
onedr0p committed Oct 27, 2024
1 parent 2eaa5b1 commit b3982c0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
8 changes: 4 additions & 4 deletions .taskfiles/talos/Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,16 @@ tasks:
down:
internal: true
cmds:
- flux --namespace flux-system suspend kustomization --all
- until kubectl wait jobs --all --all-namespaces --for=condition=complete --timeout=5m &>/dev/null; do sleep 5; done
- kubectl --namespace volsync-system scale deployment --all --replicas 0
- flux --namespace flux-system suspend kustomization --all
- task: :volsync:state-suspend

up:
internal: true
cmds:
- until kubectl wait cephcluster --for=jsonpath=.status.ceph.health=HEALTH_OK --timeout=10m --all --all-namespaces &>/dev/null; do sleep 5; done
- defer: flux --namespace flux-system resume kustomization --all
- defer: kubectl --namespace volsync-system scale deployment --all --replicas 1
- flux --namespace flux-system resume kustomization --all
- task: :volsync:state-resume

# Ref: https://github.com/go-task/task/issues/608
noop:
Expand Down
9 changes: 5 additions & 4 deletions .taskfiles/volsync/Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ tasks:
state-*:
desc: Suspend or resume Volsync [CLUSTER=main]
cmds:
- flux {{.STATE}} kustomization volsync
- flux --namespace flux-system {{.STATE}} kustomization volsync
- flux --namespace volsync-system {{.STATE}} helmrelease volsync
- kubectl --namespace volsync-system scale deployment --all --replicas {{if eq .STATE "suspend"}}0{{else}}1{{end}}
- '{{if eq .STATE "suspend"}}kubectl --namespace volsync-system scale deployment volsync --replicas 0{{end}}'
- '{{if eq .STATE "resume"}}flux --namespace volsync-system reconcile helmrelease volsync --force{{end}}'
vars:
STATE: '{{index .MATCH 0}}'
requires:
Expand Down Expand Up @@ -60,9 +61,9 @@ tasks:
- kubectl --namespace {{.NS}} wait job/{{.JOB}} --for=condition=complete --timeout=120m
- kubectl --namespace {{.NS}} delete replicationdestination {{.JOB}}
# Resume
- flux --namespace {{.NS}} resume helmrelease {{.APP}}
- flux --namespace flux-system resume kustomization {{.APP}}
- kubectl --namespace {{.NS}} scale {{.CONTROLLER}}/{{.APP}} --replicas 1
- flux --namespace {{.NS}} resume helmrelease {{.APP}}
- flux --namespace {{.NS}} reconcile helmrelease {{.APP}} --force
- kubectl --namespace {{.NS}} wait pod --for=condition=ready --selector="app.kubernetes.io/name={{.APP}}" --timeout=5m
vars:
NS: '{{.NS | default "default"}}'
Expand Down

0 comments on commit b3982c0

Please sign in to comment.