Skip to content

Commit

Permalink
Bug fix in sandbix start (#161)
Browse files Browse the repository at this point in the history
* Added version compare check and bug fix in sandbox start

Signed-off-by: Yuvraj <[email protected]>
  • Loading branch information
yindia authored Aug 19, 2021
1 parent 5e45344 commit 3a48b4a
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 7 deletions.
1 change: 1 addition & 0 deletions flytectl/.github/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ newPRWelcomeComment: >
Thank you for opening this pull request! 🙌
These tips will help get your PR across the finish line:
- Most of the repos have a PR template; if not, fill it out to the best of your knowledge.
- Sign off your commits (Reference: [DCO Guide](https://github.com/src-d/guide/blob/master/developer-community/fix-DCO.md)).
Expand Down
3 changes: 0 additions & 3 deletions flytectl/.github/workflows/sandbox.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ jobs:
key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }}
- name: Build Flytectl binary
run: make compile
- name: Setup env
run: |
mkdir -p ~/.flyte/k3s && touch ~/.flyte/k3s/k3s.yaml && chmod 666 ~/.flyte/k3s/k3s.yaml
- name: Create a sandbox cluster
run: bin/flytectl sandbox start
- name: Setup flytectl config
Expand Down
1 change: 1 addition & 0 deletions flytectl/boilerplate/flyte/welcome_bot/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ newPRWelcomeComment: >
Thank you for opening this pull request! 🙌
These tips will help get your PR across the finish line:
- Most of the repos have a PR template; if not, fill it out to the best of your knowledge.
- Sign off your commits (Reference: [DCO Guide](https://github.com/src-d/guide/blob/master/developer-community/fix-DCO.md)).
Expand Down
4 changes: 2 additions & 2 deletions flytectl/cmd/sandbox/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ Mount your source code repository inside sandbox
bin/flytectl sandbox start --source=$HOME/flyteorg/flytesnacks
Run specific version of flyte, Only available after v0.14.0+
Run specific version of flyte, Only available after v0.13.0+
::
bin/flytectl sandbox start --version=v0.14.0
Usage
`
k8sEndpoint = "https://127.0.0.1:30086"
flyteMinimumVersionSupported = "v0.14.0"
flyteMinimumVersionSupported = "v0.13.0"
generatedManifest = "/flyteorg/share/flyte_generated.yaml"
flyteNamespace = "flyte"
diskPressureTaint = "node.kubernetes.io/disk-pressure"
Expand Down
2 changes: 2 additions & 0 deletions flytectl/cmd/upgrade/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ Upgrade flytectl
bin/flytectl upgrade
Note: Please use upgrade with sudo, Without sudo it will cause permission issue
Rollback flytectl binary
::
Expand Down
8 changes: 6 additions & 2 deletions flytectl/pkg/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ func WriteIntoFile(data []byte, file string) error {

// SetupFlyteDir will create .flyte dir if not exist
func SetupFlyteDir() error {
if err := os.MkdirAll(f.FilePathJoin(f.UserHomeDir(), ".flyte"), os.ModePerm); err != nil {
if err := os.MkdirAll(f.FilePathJoin(f.UserHomeDir(), ".flyte", "k3s"), os.ModePerm); err != nil {
return err
}
// Created a empty file with right permission
if err := ioutil.WriteFile(docker.Kubeconfig, []byte(""), os.ModePerm); err != nil {
return err
}
return nil
Expand All @@ -48,7 +52,7 @@ func IsVersionGreaterThan(version1, version2 string) (bool, error) {
if err != nil {
return false, err
}
return semanticVersion2.LessThanOrEqual(semanticVersion1), nil
return semanticVersion1.GreaterThan(semanticVersion2), nil
}

// PrintSandboxMessage will print sandbox success message
Expand Down
5 changes: 5 additions & 0 deletions flytectl/pkg/util/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ func TestIsVersionGreaterThan(t *testing.T) {
assert.Nil(t, err)
assert.Equal(t, true, ok)
})
t.Run("Compare flytectl version greater then for equal value", func(t *testing.T) {
ok, err := IsVersionGreaterThan(testVersion, testVersion)
assert.Nil(t, err)
assert.Equal(t, false, ok)
})
t.Run("Compare flytectl version smaller then", func(t *testing.T) {
ok, err := IsVersionGreaterThan("v0.1.19", testVersion)
assert.Nil(t, err)
Expand Down

0 comments on commit 3a48b4a

Please sign in to comment.