-
Notifications
You must be signed in to change notification settings - Fork 660
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: customize demo cluster port (#5969)
* Fix: allows users to specify port for demo cluster Signed-off-by: Vincent <0426vincent@gmail.com> * Fix: --help layout Signed-off-by: Vincent <0426vincent@gmail.com> * Update flytectl/cmd/config/subcommand/sandbox/sandbox_config.go Co-authored-by: Kevin Su <pingsutw@gmail.com> Signed-off-by: 0xffv <68840528+vincent0426@users.noreply.github.com> * Fix: regenerate config flags Signed-off-by: Vincent <0426vincent@gmail.com> --------- Signed-off-by: Vincent <0426vincent@gmail.com> Signed-off-by: 0xffv <68840528+vincent0426@users.noreply.github.com> Co-authored-by: Kevin Su <pingsutw@gmail.com>
- Loading branch information
1 parent
172e816
commit 121665d
Showing
10 changed files
with
97 additions
and
53 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
flytectl/cmd/config/subcommand/sandbox/config_flags_test.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package sandbox | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
sandboxCmdConfig "github.com/flyteorg/flyte/flytectl/cmd/config/subcommand/sandbox" | ||
"github.com/flyteorg/flyte/flytectl/pkg/docker" | ||
"github.com/flyteorg/flyte/flytectl/pkg/k8s" | ||
"github.com/flyteorg/flyte/flytestdlib/logger" | ||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
const ( | ||
flyteNs = "flyte" | ||
labelSelector = "app.kubernetes.io/name=flyte-binary" | ||
) | ||
|
||
// LegacyReloadDemoCluster will kill the flyte binary pod so the new one can pick up a new config file | ||
func LegacyReloadDemoCluster(ctx context.Context, sandboxConfig *sandboxCmdConfig.Config) error { | ||
k8sEndpoint := sandboxConfig.GetK8sEndpoint() | ||
k8sClient, err := k8s.GetK8sClient(docker.Kubeconfig, k8sEndpoint) | ||
if err != nil { | ||
fmt.Println("Could not get K8s client") | ||
return err | ||
} | ||
pi := k8sClient.CoreV1().Pods(flyteNs) | ||
podList, err := pi.List(ctx, v1.ListOptions{LabelSelector: labelSelector}) | ||
if err != nil { | ||
fmt.Println("could not list pods") | ||
return err | ||
} | ||
if len(podList.Items) != 1 { | ||
return fmt.Errorf("should only have one pod running, %d found, %v", len(podList.Items), podList.Items) | ||
} | ||
logger.Debugf(ctx, "Found %d pods\n", len(podList.Items)) | ||
var grace = int64(0) | ||
err = pi.Delete(ctx, podList.Items[0].Name, v1.DeleteOptions{ | ||
GracePeriodSeconds: &grace, | ||
}) | ||
if err != nil { | ||
fmt.Printf("Could not delete Flyte pod, old configuration may still be in effect. Err: %s\n", err) | ||
return err | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters