Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.

Commit

Permalink
Demo fit and finish (#317)
Browse files Browse the repository at this point in the history
Signed-off-by: Prafulla Mahindrakar <[email protected]>
  • Loading branch information
pmahindrakar-oss authored Apr 22, 2022
1 parent 6e92a88 commit a65028a
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 7 deletions.
6 changes: 3 additions & 3 deletions cmd/demo/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func startDemoCluster(ctx context.Context, args []string, cmdCtx cmdCore.Command
return err
}
primeFlytekitPod(ctx, k8sClient.CoreV1().Pods("default"))
util.PrintSandboxMessage(util.DemoConsolePort)
util.PrintDemoMessage(util.DemoConsolePort)
}
return nil
}
Expand All @@ -186,7 +186,7 @@ func startDemo(ctx context.Context, cli docker.Docker, reader io.Reader) (*bufio
return nil, err
}
fmt.Printf("Existing details of your demo cluster")
util.PrintSandboxMessage(util.DemoConsolePort)
util.PrintDemoMessage(util.DemoConsolePort)
return nil, nil
}

Expand All @@ -198,7 +198,7 @@ func startDemo(ctx context.Context, cli docker.Docker, reader io.Reader) (*bufio
Host: "localhost:30081",
Insecure: true,
}
if err := configutil.SetupConfig(configutil.FlytectlConfig, configutil.GetSandboxTemplate(), templateValues); err != nil {
if err := configutil.SetupConfig(configutil.ConfigFile, configutil.GetDemoTemplate(), templateValues); err != nil {
return nil, err
}

Expand Down
5 changes: 5 additions & 0 deletions pkg/configutil/configutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ func GetSandboxTemplate() string {
return AdminConfigTemplate + StorageConfigTemplate
}

// GetDemoTemplate return demo cluster config
func GetDemoTemplate() string {
return AdminConfigTemplate
}

// GetAWSCloudTemplate return aws Flyte config with storage config
func GetAWSCloudTemplate() string {
return AdminConfigTemplate + StorageS3ConfigTemplate
Expand Down
1 change: 1 addition & 0 deletions pkg/configutil/configutil_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,5 @@ func TestAwsConfig(t *testing.T) {
assert.Equal(t, AdminConfigTemplate+StorageS3ConfigTemplate, GetAWSCloudTemplate())
assert.Equal(t, AdminConfigTemplate+StorageGCSConfigTemplate, GetGoogleCloudTemplate())
assert.Equal(t, AdminConfigTemplate+StorageConfigTemplate, GetSandboxTemplate())
assert.Equal(t, AdminConfigTemplate, GetDemoTemplate())
}
13 changes: 9 additions & 4 deletions pkg/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@ import (
"io"
"io/ioutil"
"net/http"

"os"
"strings"

hversion "github.com/hashicorp/go-version"

"github.com/enescakir/emoji"
"github.com/flyteorg/flytectl/pkg/configutil"
"github.com/flyteorg/flytectl/pkg/docker"
f "github.com/flyteorg/flytectl/pkg/filesystemutils"

"github.com/enescakir/emoji"
hversion "github.com/hashicorp/go-version"
)

const (
Expand Down Expand Up @@ -66,6 +65,12 @@ func PrintSandboxMessage(flyteConsolePort int) {
fmt.Printf("export FLYTECTL_CONFIG=%v \n", configutil.FlytectlConfig)
}

// PrintDemoMessage will print demo success message
func PrintDemoMessage(flyteConsolePort int) {
successMsg := fmt.Sprintf("%v http://localhost:%v/console", ProgressSuccessMessage, flyteConsolePort)
fmt.Printf("%v %v %v %v %v \n", emoji.ManTechnologist, successMsg, emoji.Rocket, emoji.Rocket, emoji.PartyPopper)
}

// SendRequest will create request and return the response
func SendRequest(method, url string, option io.Reader) (*http.Response, error) {
client := &http.Client{}
Expand Down
6 changes: 6 additions & 0 deletions pkg/util/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ func TestPrintSandboxMessage(t *testing.T) {
})
}

func TestPrintDemoMessage(t *testing.T) {
t.Run("Print Demo Message", func(t *testing.T) {
PrintDemoMessage(DemoConsolePort)
})
}

func TestSendRequest(t *testing.T) {
t.Run("Successful get request", func(t *testing.T) {
response, err := SendRequest("GET", "https://github.com", nil)
Expand Down

0 comments on commit a65028a

Please sign in to comment.