Skip to content

Commit

Permalink
Added Columnar cluster type annotation for cloud deployer.
Browse files Browse the repository at this point in the history
  • Loading branch information
brett19 committed Aug 14, 2024
1 parent 944ef9e commit 2836165
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion deployment/clouddeploy/clusterinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

type ClusterInfo struct {
ClusterID string
Type deployment.ClusterType
CloudProjectID string
CloudClusterID string
Region string
Expand All @@ -18,7 +19,7 @@ type ClusterInfo struct {
var _ (deployment.ClusterInfo) = (*ClusterInfo)(nil)

func (i ClusterInfo) GetID() string { return i.ClusterID }
func (i ClusterInfo) GetType() deployment.ClusterType { return deployment.ClusterTypeServer }
func (i ClusterInfo) GetType() deployment.ClusterType { return i.Type }
func (i ClusterInfo) GetPurpose() string { return "" }
func (i ClusterInfo) GetExpiry() time.Time { return i.Expiry }
func (i ClusterInfo) GetState() string { return i.State }
Expand Down
7 changes: 6 additions & 1 deletion deployment/clouddeploy/deployer.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import (
"context"
"encoding/base64"
"fmt"
"github.com/couchbaselabs/cbdinocluster/utils/webhelper"
"path/filepath"
"strings"
"time"

"github.com/couchbaselabs/cbdinocluster/utils/webhelper"

"github.com/couchbaselabs/cbdinocluster/clusterdef"
"github.com/couchbaselabs/cbdinocluster/deployment"
"github.com/couchbaselabs/cbdinocluster/utils/capellacontrol"
Expand Down Expand Up @@ -244,6 +245,7 @@ func (p *Deployer) ListClusters(ctx context.Context) ([]deployment.ClusterInfo,
if cluster.IsCorrupted {
out = append(out, &ClusterInfo{
ClusterID: cluster.Meta.ID.String(),
Type: deployment.ClusterTypeUnknown,
CloudProjectID: cluster.Project.ID,
CloudClusterID: "",
Region: "",
Expand All @@ -254,6 +256,7 @@ func (p *Deployer) ListClusters(ctx context.Context) ([]deployment.ClusterInfo,
} else if cluster.Cluster == nil && cluster.Columnar == nil {
out = append(out, &ClusterInfo{
ClusterID: cluster.Meta.ID.String(),
Type: deployment.ClusterTypeUnknown,
CloudProjectID: cluster.Project.ID,
CloudClusterID: "",
Region: "",
Expand All @@ -266,6 +269,7 @@ func (p *Deployer) ListClusters(ctx context.Context) ([]deployment.ClusterInfo,
if cluster.Cluster != nil {
out = append(out, &ClusterInfo{
ClusterID: cluster.Meta.ID.String(),
Type: deployment.ClusterTypeServer,
CloudProjectID: cluster.Project.ID,
CloudClusterID: cluster.Cluster.Id,
Region: cluster.Cluster.Provider.Region,
Expand All @@ -275,6 +279,7 @@ func (p *Deployer) ListClusters(ctx context.Context) ([]deployment.ClusterInfo,
} else if cluster.Columnar != nil {
out = append(out, &ClusterInfo{
ClusterID: cluster.Meta.ID.String(),
Type: deployment.ClusterTypeColumnar,
CloudProjectID: cluster.Project.ID,
CloudClusterID: cluster.Columnar.ID,
Region: cluster.Columnar.Config.Region,
Expand Down
1 change: 1 addition & 0 deletions deployment/deployer.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
type ClusterType string

const (
ClusterTypeUnknown ClusterType = "unknown"
ClusterTypeServer ClusterType = "server"
ClusterTypeColumnar ClusterType = "columnar"
)
Expand Down

0 comments on commit 2836165

Please sign in to comment.