Skip to content

Commit

Permalink
chore(cmx): remove postgres cluster addon
Browse files Browse the repository at this point in the history
Signed-off-by: Kyle Squizzato <[email protected]>
  • Loading branch information
squizzi committed Dec 11, 2024
1 parent 33c0af9 commit 43143ec
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 234 deletions.
8 changes: 1 addition & 7 deletions cli/cmd/cluster_addon.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,11 @@ You can use various subcommands to create, list, remove, or check the status of
# Remove an add-on from a cluster
replicated cluster addon rm CLUSTER_ID --id ADDON_ID
# Create a Postgres database add-on for a cluster
replicated cluster addon create postgres CLUSTER_ID --version 13 --disk 100 --instance-type db.t3.micro
# Create an object store bucket add-on for a cluster
replicated cluster addon create object-store CLUSTER_ID --bucket-prefix mybucket
# List add-ons with JSON output
replicated cluster addon ls CLUSTER_ID --output json
# Create a Postgres add-on and wait for it to be ready
replicated cluster addon create postgres CLUSTER_ID --version 13 --wait 5m`,
replicated cluster addon ls CLUSTER_ID --output json`,
}
parent.AddCommand(cmd)

Expand Down
8 changes: 1 addition & 7 deletions cli/cmd/cluster_addon_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,9 @@ func (r *runners) InitClusterAddonCreate(parent *cobra.Command) *cobra.Command {
Use: "create",
Short: "Create cluster add-ons.",
Long: `Create new add-ons for a cluster. This command allows you to add functionality or services to a cluster by provisioning the required add-ons.`,
Example: ` # Create a Postgres database add-on for a cluster
replicated cluster addon create postgres CLUSTER_ID --version 13 --disk 100 --instance-type db.t3.micro
# Create an object store bucket add-on for a cluster
Example: ` # Create an object store bucket add-on for a cluster
replicated cluster addon create object-store CLUSTER_ID --bucket-prefix mybucket
# Create a Postgres add-on and wait for it to be ready
replicated cluster addon create postgres CLUSTER_ID --version 13 --wait 5m
# Perform a dry run for creating an object store add-on
replicated cluster addon create object-store CLUSTER_ID --bucket-prefix mybucket --dry-run`,
}
Expand Down
124 changes: 0 additions & 124 deletions cli/cmd/cluster_addon_create_postgres.go

This file was deleted.

19 changes: 10 additions & 9 deletions cli/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ const (
padChar = ' '
)

var appSlugOrID string
var apiToken string
var integrationTest string
var logAPICalls string
var platformOrigin = "https://api.replicated.com/vendor"
var kurlDotSHOrigin = "https://kurl.sh"
var cache *replicatedcache.Cache
var (
appSlugOrID string
apiToken string
integrationTest string
logAPICalls string
platformOrigin = "https://api.replicated.com/vendor"
kurlDotSHOrigin = "https://kurl.sh"
cache *replicatedcache.Cache
)

func init() {
originFromEnv := os.Getenv("REPLICATED_API_ORIGIN")
Expand Down Expand Up @@ -122,7 +124,7 @@ func Execute(rootCmd *cobra.Command, stdin io.Reader, stdout io.Writer, stderr i
Short: "List channels",
Long: "List channels",
}
var releaseCmd = &cobra.Command{
releaseCmd := &cobra.Command{
Use: "release",
Short: "Manage app releases",
Long: `The release command allows vendors to create, display, and promote their releases.`,
Expand Down Expand Up @@ -241,7 +243,6 @@ func Execute(rootCmd *cobra.Command, stdin io.Reader, stdout io.Writer, stderr i
runCmds.InitClusterAddonRm(clusterAddonCmd)
clusterAddonCreateCmd := runCmds.InitClusterAddonCreate(clusterAddonCmd)
runCmds.InitClusterAddonCreateObjectStore(clusterAddonCreateCmd)
runCmds.InitClusterAddonCreatePostgres(clusterAddonCreateCmd)

clusterPortCmd := runCmds.InitClusterPort(clusterCmd)
runCmds.InitClusterPortLs(clusterPortCmd)
Expand Down
24 changes: 9 additions & 15 deletions cli/print/cluster_addons.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@ import (
"github.com/replicatedhq/replicated/pkg/types"
)

var addonsTmplHeaderSrc = `ID TYPE STATUS DATA`
var addonsTmplRowSrc = `{{ range . -}}
var (
addonsTmplHeaderSrc = `ID TYPE STATUS DATA`
addonsTmplRowSrc = `{{ range . -}}
{{ .ID }} {{ Type . }} {{ printf "%-12s" .Status }} {{ Data . }}
{{ end }}`
var addonsTmplSrc = fmt.Sprintln(addonsTmplHeaderSrc) + addonsTmplRowSrc
var addonsTmpl = template.Must(template.New("addons").Funcs(addonsFuncs).Parse(addonsTmplSrc))
var addonsTmplNoHeader = template.Must(template.New("addons").Funcs(addonsFuncs).Parse(addonsTmplRowSrc))
)
var (
addonsTmplSrc = fmt.Sprintln(addonsTmplHeaderSrc) + addonsTmplRowSrc
addonsTmpl = template.Must(template.New("addons").Funcs(addonsFuncs).Parse(addonsTmplSrc))
addonsTmplNoHeader = template.Must(template.New("addons").Funcs(addonsFuncs).Parse(addonsTmplRowSrc))
)

var addonsFuncs = template.FuncMap{
"Type": func(addon *types.ClusterAddon) string {
Expand Down Expand Up @@ -81,8 +85,6 @@ func addonData(addon *types.ClusterAddon) string {
switch {
case addon.ObjectStore != nil:
return addonObjectStoreData(*addon.ObjectStore)
case addon.Postgres != nil:
return addonPostgresData(*addon.Postgres)
default:
return ""
}
Expand All @@ -95,11 +97,3 @@ func addonObjectStoreData(data types.ClusterAddonObjectStore) string {
}
return string(b)
}

func addonPostgresData(data types.ClusterAddonPostgres) string {
b, err := json.Marshal(data)
if err != nil {
log.Printf("failed to marshal postgres data: %v", err)
}
return string(b)
}
61 changes: 0 additions & 61 deletions pkg/kotsclient/cluster_addon_postgres_create.go

This file was deleted.

11 changes: 0 additions & 11 deletions pkg/types/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ type ClusterAddon struct {
CreatedAt time.Time `json:"created_at"`

ObjectStore *ClusterAddonObjectStore `json:"object_store,omitempty"`
Postgres *ClusterAddonPostgres `json:"postgres,omitempty"`
}

type ClusterAddonObjectStore struct {
Expand All @@ -112,20 +111,10 @@ type ClusterAddonObjectStore struct {
ServiceAccountNameReadOnly string `json:"service_account_name_read_only,omitempty"`
}

type ClusterAddonPostgres struct {
Version string `json:"version"`
DiskGiB int64 `json:"disk_gib"`
InstanceType string `json:"instance_type"`

URI string `json:"uri,omitempty"`
}

func (addon *ClusterAddon) TypeName() string {
switch {
case addon.ObjectStore != nil:
return "Object Store"
case addon.Postgres != nil:
return "Postgres"
default:
return "Unknown"
}
Expand Down

0 comments on commit 43143ec

Please sign in to comment.