Skip to content

Commit

Permalink
feature. update cluster status when workflow paused
Browse files Browse the repository at this point in the history
  • Loading branch information
ktkfree committed Jul 2, 2024
1 parent bc7a891 commit 4116410
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
7 changes: 7 additions & 0 deletions cmd/server/cluster_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ func processClusterStatus() error {
switch workflow.Status.Phase {
case "Running":
newStatus = domain.ClusterStatus_INSTALLING

if cluster.CloudService == "BYOH" {
paused, err := argowfClient.IsPausedWorkflow(context.TODO(), "argo", workflowId)
if err == nil && paused {
newStatus = domain.ClusterStatus_STOPPED
}
}
case "Stopped":
newStatus = domain.ClusterStatus_STOPPED
case "Succeeded":
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ toolchain go1.21.7

require (
github.com/gofrs/uuid v4.0.0+incompatible
github.com/openinfradev/tks-api v0.0.0-20240626013032-da099b77eb0e
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/pkg/errors v0.9.1
github.com/spf13/pflag v1.0.5
Expand Down Expand Up @@ -50,6 +49,7 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/openinfradev/tks-api v0.0.0-20240702055309-610554b9f520 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ github.com/onsi/ginkgo/v2 v2.4.0 h1:+Ig9nvqgS5OBSACXNk15PLdp0U9XPYROt9CFzVdFGIs=
github.com/onsi/ginkgo/v2 v2.4.0/go.mod h1:iHkDK1fKGcBoEHT5W7YBq4RFWaQulw+caOMkAt4OrFo=
github.com/onsi/gomega v1.23.0 h1:/oxKu9c2HVap+F3PfKort2Hw5DEU+HGlW8n+tguWsys=
github.com/onsi/gomega v1.23.0/go.mod h1:Z/NWtiqwBrwUt4/2loMmHL63EDLnYHmVbuBpDr2vQAg=
github.com/openinfradev/tks-api v0.0.0-20240626013032-da099b77eb0e h1:PcHoV29NDLHi55ZOosLkyZK0stbWro483nRKpZWa8NA=
github.com/openinfradev/tks-api v0.0.0-20240626013032-da099b77eb0e/go.mod h1:01x6TpTcRwEFo89/+f+6MHPri562UoxflwhiacIm978=
github.com/openinfradev/tks-api v0.0.0-20240702055309-610554b9f520 h1:h57Bw+UYtVIpmtmBgYyXPNS9E9JsC5i3hFfu/WE+J2Q=
github.com/openinfradev/tks-api v0.0.0-20240702055309-610554b9f520/go.mod h1:01x6TpTcRwEFo89/+f+6MHPri562UoxflwhiacIm978=
github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4=
Expand Down
1 change: 1 addition & 0 deletions internal/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type Cluster struct {
Status domain.ClusterStatus
StatusDesc string
IsStack bool
CloudService string
}

// Accessor accesses cluster info in DB.
Expand Down

0 comments on commit 4116410

Please sign in to comment.