Skip to content

Commit

Permalink
remove okteto cloud mentions
Browse files Browse the repository at this point in the history
Signed-off-by: Andrea Falzetti <[email protected]>
  • Loading branch information
andreafalzetti committed Jun 14, 2024
1 parent 7870e0e commit ca3ccf3
Show file tree
Hide file tree
Showing 25 changed files with 66 additions and 254 deletions.
8 changes: 4 additions & 4 deletions cmd/context/context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,18 @@ func Test_initFromDeprecatedToken(t *testing.T) {
}{
{
name: "token-create-kubeconfig",
tokenUrl: "https://cloud.okteto.com",
tokenUrl: "https://okteto.example.com",
kubeconfigCtx: test.KubeconfigFields{
Name: []string{"test"},
Namespace: []string{"test"},
CurrentContext: "cloud_okteto_com",
CurrentContext: "okteto_example_com",
},
},
{
name: "token-token-but-not-in-kubeconfig",
tokenUrl: "https://cloud.okteto.com",
tokenUrl: "https://okteto.example.com",
kubeconfigCtx: test.KubeconfigFields{
Name: []string{"cloud_okteto_com"},
Name: []string{"okteto_example_com"},
Namespace: []string{"test"},
CurrentContext: "test",
},
Expand Down
56 changes: 28 additions & 28 deletions cmd/context/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,21 @@ func Test_createContext(t *testing.T) {
name: "change namespace",
ctxStore: &okteto.ContextStore{
Contexts: map[string]*okteto.Context{
"https://okteto.cloud.com": {},
"https://okteto.example.com": {},
},
CurrentContext: "https://okteto.cloud.com",
CurrentContext: "https://okteto.example.com",
},
ctxOptions: &Options{
IsOkteto: true,
Save: true,
Context: "https://okteto.cloud.com",
Context: "https://okteto-2.example.com",
Namespace: "test",
},
user: &types.User{
Token: "test",
},
kubeconfigCtx: test.KubeconfigFields{
Name: []string{"cloud_okteto_com"},
Name: []string{"okteto_example_com"},
Namespace: []string{"test"},
CurrentContext: ""},
expectedErr: false,
Expand All @@ -85,22 +85,22 @@ func Test_createContext(t *testing.T) {
name: "change namespace forbidden",
ctxStore: &okteto.ContextStore{
Contexts: map[string]*okteto.Context{
"https://okteto.cloud.com": {},
"https://okteto.example.com": {},
},
CurrentContext: "https://okteto.cloud.com",
CurrentContext: "https://okteto.example.com",
},
ctxOptions: &Options{
IsOkteto: true,
Save: true,
Context: "https://okteto.cloud.com",
Context: "https://okteto.example.com",
Namespace: "not-found",
CheckNamespaceAccess: true,
},
user: &types.User{
Token: "test",
},
kubeconfigCtx: test.KubeconfigFields{
Name: []string{"cloud_okteto_com"},
Name: []string{"okteto_example_com"},
Namespace: []string{"test"},
CurrentContext: "",
},
Expand All @@ -110,21 +110,21 @@ func Test_createContext(t *testing.T) {
name: "change to personal namespace if namespace is not found",
ctxStore: &okteto.ContextStore{
Contexts: map[string]*okteto.Context{
"https://okteto.cloud.com": {},
"https://okteto.example.com": {},
},
CurrentContext: "https://okteto.cloud.com",
CurrentContext: "https://okteto.example.com",
},
ctxOptions: &Options{
IsOkteto: true,
Save: true,
Context: "https://okteto.cloud.com",
Context: "https://okteto.example.com",
Namespace: "not-found",
},
user: &types.User{
Token: "test",
},
kubeconfigCtx: test.KubeconfigFields{
Name: []string{"cloud_okteto_com"},
Name: []string{"okteto_example_com"},
Namespace: []string{"test"},
CurrentContext: "",
},
Expand All @@ -137,10 +137,10 @@ func Test_createContext(t *testing.T) {
},
ctxOptions: &Options{
IsOkteto: false,
Context: "cloud_okteto_com",
Context: "okteto_example_com",
},
kubeconfigCtx: test.KubeconfigFields{
Name: []string{"cloud_okteto_com"},
Name: []string{"okteto_example_com"},
Namespace: []string{"test"},
},
user: &types.User{
Expand Down Expand Up @@ -168,13 +168,13 @@ func Test_createContext(t *testing.T) {
},
ctxOptions: &Options{
IsOkteto: false,
Context: "cloud_okteto_com",
Context: "okteto_example_com",
},
user: &types.User{
Token: "test",
},
kubeconfigCtx: test.KubeconfigFields{
Name: []string{"cloud_okteto_com"},
Name: []string{"okteto_example_com"},
Namespace: []string{"test"},
},
expectedErr: false,
Expand All @@ -186,13 +186,13 @@ func Test_createContext(t *testing.T) {
},
ctxOptions: &Options{
IsOkteto: false,
Context: "cloud_okteto_com",
Context: "okteto_example_com",
},
user: &types.User{
Token: "test",
},
kubeconfigCtx: test.KubeconfigFields{
Name: []string{"cloud_okteto_com"},
Name: []string{"okteto_example_com"},
Namespace: []string{"test"},
},
expectedErr: false,
Expand All @@ -205,13 +205,13 @@ func Test_createContext(t *testing.T) {
},
ctxOptions: &Options{
IsOkteto: false,
Context: "cloud_okteto_com",
Context: "okteto_example_com",
},
user: &types.User{
Token: "test",
},
kubeconfigCtx: test.KubeconfigFields{
Name: []string{"cloud_okteto_com"},
Name: []string{"okteto_example_com"},
Namespace: []string{""},
},
expectedErr: false,
Expand All @@ -231,10 +231,10 @@ func Test_createContext(t *testing.T) {
},
ctxOptions: &Options{
IsOkteto: false,
Context: "cloud_okteto_com",
Context: "okteto_example_com",
},
kubeconfigCtx: test.KubeconfigFields{
Name: []string{"cloud_okteto_com"},
Name: []string{"okteto_example_com"},
Namespace: []string{"test"},
CurrentContext: "",
},
Expand All @@ -259,7 +259,7 @@ func Test_createContext(t *testing.T) {
},
kubeconfigCtx: test.KubeconfigFields{

Name: []string{"cloud_okteto_com"},
Name: []string{"okteto_example_com"},
Namespace: []string{"test"},
CurrentContext: "",
},
Expand All @@ -283,7 +283,7 @@ func Test_createContext(t *testing.T) {
Context: "https://cloud.okteto.com",
},
kubeconfigCtx: test.KubeconfigFields{
Name: []string{"cloud_okteto_com"},
Name: []string{"okteto_example_com"},
Namespace: []string{"test"},
CurrentContext: "",
},
Expand All @@ -296,14 +296,14 @@ func Test_createContext(t *testing.T) {
},
ctxOptions: &Options{
IsOkteto: true,
Context: "https://okteto.cloud.com",
Context: "https://okteto.example.com",
Token: "this is a token",
},
user: &types.User{
Token: "test",
},
kubeconfigCtx: test.KubeconfigFields{
Name: []string{"cloud_okteto_com"},
Name: []string{"okteto_example_com"},
Namespace: []string{"test"},
CurrentContext: "",
},
Expand Down Expand Up @@ -365,7 +365,7 @@ func TestAutoAuthWhenNotValidTokenOnlyWhenOktetoContextIsRun(t *testing.T) {
name: "okteto context triggers auto auth",
ctxOptions: &Options{
IsOkteto: true,
Context: "https://okteto.cloud.com",
Context: "https://okteto.example.com",
Token: "this is a invalid token",
IsCtxCommand: true,
},
Expand All @@ -377,7 +377,7 @@ func TestAutoAuthWhenNotValidTokenOnlyWhenOktetoContextIsRun(t *testing.T) {
name: "non okteto context command gives unauthorized message",
ctxOptions: &Options{
IsOkteto: true,
Context: "https://okteto.cloud.com",
Context: "https://okteto.example.com",
Token: "this is a invalid token",
IsCtxCommand: false,
},
Expand Down
2 changes: 1 addition & 1 deletion cmd/context/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func List() *cobra.Command {
}

func executeListContext() error {
contexts := getOktetoClusters(false)
contexts := getOktetoClusters()
contexts = append(contexts, getK8sClusters(getKubernetesContextList(true))...)

if len(contexts) == 0 {
Expand Down
13 changes: 2 additions & 11 deletions cmd/context/selector.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,21 @@ func getAvailableContexts(ctxOptions *Options) []utils.SelectorItem {
}
clusters := make([]utils.SelectorItem, 0)

clusters = append(clusters, getOktetoClusters(true)...)
clusters = append(clusters, getOktetoClusters()...)
if len(k8sClusters) > 0 {
clusters = append(clusters, getK8sClusters(k8sClusters)...)
}

return clusters
}

func getOktetoClusters(skipCloud bool) []utils.SelectorItem {
func getOktetoClusters() []utils.SelectorItem {
orderedOktetoClusters := make([]utils.SelectorItem, 0)
ctxStore := okteto.GetContextStore()
for ctxName, okCtx := range ctxStore.Contexts {
if !okCtx.IsOkteto {
continue
}
if skipCloud && ctxName == okteto.CloudURL {
continue
}
orderedOktetoClusters = append(
orderedOktetoClusters,
utils.SelectorItem{
Expand All @@ -59,12 +56,6 @@ func getOktetoClusters(skipCloud bool) []utils.SelectorItem {
})
}
sort.Slice(orderedOktetoClusters, func(i, j int) bool {
if orderedOktetoClusters[i].Name == okteto.CloudURL {
return true
}
if orderedOktetoClusters[j].Name == okteto.CloudURL {
return false
}
return strings.Compare(orderedOktetoClusters[i].Name, orderedOktetoClusters[j].Name) < 0
})
return orderedOktetoClusters
Expand Down
4 changes: 2 additions & 2 deletions cmd/context/use.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ This will prompt you to select one of your existing contexts or to create a new
You can also specify an Okteto URL:
$ okteto context use https://cloud.okteto.com
$ okteto context use https://okteto.example.com
Or a Kubernetes context:
Expand Down Expand Up @@ -209,7 +209,7 @@ func getContext(ctxOptions *Options) (string, error) {
}
if isCreateNewContextOption(oktetoContext) {
ctxStore := okteto.GetContextStore()
clusterURL := okteto.CloudURL
clusterURL := ""
if oCtx, ok := ctxStore.Contexts[ctxStore.CurrentContext]; ok && oCtx.IsOkteto {
clusterURL = ctxStore.CurrentContext
}
Expand Down
4 changes: 0 additions & 4 deletions cmd/up/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,6 @@ func Up(at analyticsTrackerInterface, insights buildDeployTrackerInterface, ioCt
manifestOpts := contextCMD.ManifestOptions{Filename: upOptions.ManifestPath, Namespace: upOptions.Namespace, K8sContext: upOptions.K8sContext}
oktetoManifest, err := contextCMD.LoadManifestWithContext(ctx, manifestOpts, afero.NewOsFs())
if err != nil {
if err.Error() == fmt.Errorf(oktetoErrors.ErrNotLogged, okteto.CloudURL).Error() {
return err
}

if !errors.Is(err, discovery.ErrOktetoManifestNotFound) {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion integration/actions/actions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ var (
oktetoVersion = ""
user = ""
kubectlBinary = "kubectl"
appsSubdomain = "cloud.okteto.net"
appsSubdomain = ""
)

func TestMain(m *testing.M) {
Expand Down
3 changes: 0 additions & 3 deletions integration/actions/context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ func executeContextAction() error {
defer integration.DeleteGitRepo(actionFolder)

oktetoURL := os.Getenv(model.OktetoURLEnvVar)
if oktetoURL == "" {
oktetoURL = okteto.CloudURL
}
log.Printf("login into %s", oktetoURL)
command := fmt.Sprintf("%s/entrypoint.sh", actionFolder)
args := []string{token, oktetoURL}
Expand Down
3 changes: 0 additions & 3 deletions integration/actions/login_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ func executeLoginAction() error {
defer integration.DeleteGitRepo(actionFolder)

oktetoURL := os.Getenv(model.OktetoURLEnvVar)
if oktetoURL == "" {
oktetoURL = okteto.CloudURL
}
log.Printf("login into %s", oktetoURL)
command := fmt.Sprintf("%s/entrypoint.sh", actionFolder)
args := []string{token, oktetoURL}
Expand Down
2 changes: 1 addition & 1 deletion integration/build/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import (
var (
user = ""
kubectlBinary = "kubectl"
appsSubdomain = "cloud.okteto.net"
appsSubdomain = ""
token = ""
)

Expand Down
2 changes: 1 addition & 1 deletion integration/deploy/deploy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
var (
user = ""
kubectlBinary = "kubectl"
appsSubdomain = "cloud.okteto.net"
appsSubdomain = ""
token = ""
)

Expand Down
2 changes: 1 addition & 1 deletion integration/deprecated/push/push_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var (
user = ""
token = ""
kubectlBinary = "kubectl"
appsSubdomain = "cloud.okteto.net"
appsSubdomain = ""
)

const (
Expand Down
2 changes: 1 addition & 1 deletion integration/deprecated/stack/stack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var (
user = ""
token = ""
kubectlBinary = "kubectl"
appsSubdomain = "cloud.okteto.net"
appsSubdomain = ""
)

func TestMain(m *testing.M) {
Expand Down
2 changes: 1 addition & 1 deletion integration/okteto/okteto_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
var (
user = ""
kubectlBinary = "kubectl"
appsSubdomain = "cloud.okteto.net"
appsSubdomain = ""
token = ""
)

Expand Down
2 changes: 1 addition & 1 deletion integration/up/up_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var (
user = ""
token = ""
kubectlBinary = "kubectl"
appsSubdomain = "cloud.okteto.net"
appsSubdomain = ""
ErrUpNotRunning = errors.New("Up command is no longer running")
)

Expand Down
Loading

0 comments on commit ca3ccf3

Please sign in to comment.