Skip to content

Commit

Permalink
update playground
Browse files Browse the repository at this point in the history
  • Loading branch information
AdheipSingh committed Dec 23, 2024
1 parent 7b48151 commit 9be2f43
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 23 deletions.
17 changes: 0 additions & 17 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,23 +186,6 @@ var query = &cobra.Command{
},
}

var install = &cobra.Command{
Use: "install",
Short: "Install parseable on kubernetes cluster",
Long: "\ninstall command is used to install parseable oss/enterprise on k8s cluster..",
PersistentPreRunE: combinedPreRun,
PersistentPostRun: func(cmd *cobra.Command, args []string) {
if os.Getenv("PB_ANALYTICS") == "disable" {
return
}
wg.Add(1)
go func() {
defer wg.Done()
analytics.PostRunAnalytics(cmd, "install", args)
}()
},
}

var cluster = &cobra.Command{
Use: "cluster",
Short: "Cluster operations for parseable.",
Expand Down
60 changes: 54 additions & 6 deletions pkg/installer/installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,56 @@ func waterFall(verbose bool) {
log.Fatalf("Failed to prompt for kubernetes context: %v", err)
}

if plan.Name == "Playground" {
chartValues = append(chartValues, "parseable.store=local-store")
chartValues = append(chartValues, "parseable.localModeSecret.enabled=true")

// Prompt for namespace and credentials
pbInfo, err := promptNamespaceAndCredentials()
if err != nil {
log.Fatalf("Failed to prompt for namespace and credentials: %v", err)
}

// Prompt for agent deployment
_, agentValues, err := promptAgentDeployment(chartValues, *pbInfo)
if err != nil {
log.Fatalf("Failed to prompt for agent deployment: %v", err)
}

if err := applyParseableSecret(pbInfo, LocalStore, ObjectStoreConfig{}); err != nil {
log.Fatalf("Failed to apply secret object store configuration: %v", err)
}

// Define the deployment configuration
config := HelmDeploymentConfig{
ReleaseName: pbInfo.Name,
Namespace: pbInfo.Namespace,
RepoName: "parseable",
RepoURL: "https://charts.parseable.com",
ChartName: "parseable",
Version: "1.6.6",
Values: agentValues,
Verbose: verbose,
}

if err := deployRelease(config); err != nil {
log.Fatalf("Failed to deploy parseable, err: %v", err)
}

if err := updateInstallerConfigMap(common.InstallerEntry{
Name: pbInfo.Name,
Namespace: pbInfo.Namespace,
Version: config.Version,
Status: "success",
}); err != nil {
log.Fatalf("Failed to update parseable installer file, err: %v", err)
}

printSuccessBanner(*pbInfo, config.Version, "parseable", "parseable")

return
}

// pb supports only distributed deployments
chartValues = append(chartValues, "parseable.highAvailability.enabled=true")

Expand Down Expand Up @@ -124,7 +174,9 @@ func waterFall(verbose bool) {
log.Fatalf("Failed to update parseable installer file, err: %v", err)
}

printSuccessBanner(*pbInfo, config.Version)
ingestorURL, queryURL := getParseableSvcUrls(pbInfo.Name, pbInfo.Namespace)

printSuccessBanner(*pbInfo, config.Version, ingestorURL, queryURL)

}

Expand Down Expand Up @@ -230,8 +282,6 @@ func applyParseableSecret(ps *ParseableInfo, store ObjectStore, objectStoreConfi
secretManifest = getParseableSecretGcs(ps, objectStoreConfig)
}

fmt.Println(secretManifest)

// apply the Kubernetes Secret
if err := applyManifest(secretManifest); err != nil {
return fmt.Errorf("failed to create and apply secret: %w", err)
Expand Down Expand Up @@ -742,9 +792,7 @@ func deployRelease(config HelmDeploymentConfig) error {
}

// printSuccessBanner remains the same as in the original code
func printSuccessBanner(pbInfo ParseableInfo, version string) {

ingestorURL, queryURL := getParseableSvcUrls(pbInfo.Name, pbInfo.Namespace)
func printSuccessBanner(pbInfo ParseableInfo, version, ingestorURL, queryURL string) {

// Encode credentials to Base64
credentials := map[string]string{
Expand Down
10 changes: 10 additions & 0 deletions pkg/installer/plans.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ type Plan struct {

// Plans define the plans with clear CPU and memory specs for consumption
var Plans = map[string]Plan{
"Playground": {
Name: "Playground",
IngestionSpeed: "100 events/sec",
PerDayIngestion: "~1GB",
QueryPerformance: "Basic performance",
CPUAndMemorySpecs: "1 CPUs, 1GB RAM",
CPU: "1",
Memory: "1Gi",
},
"Small": {
Name: "Small",
IngestionSpeed: "1000 events/sec",
Expand Down Expand Up @@ -66,6 +75,7 @@ var Plans = map[string]Plan{

func promptUserPlanSelection() (Plan, error) {
planList := []Plan{
Plans["Playground"],
Plans["Small"],
Plans["Medium"],
Plans["Large"],
Expand Down

0 comments on commit 9be2f43

Please sign in to comment.