Skip to content

Commit

Permalink
chore(cli): fix namespace prefix in pro
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalbreuninger committed May 23, 2024
1 parent 190fbe0 commit d6edb67
Show file tree
Hide file tree
Showing 40 changed files with 122 additions and 2,764 deletions.
4 changes: 0 additions & 4 deletions cmd/pro/provider/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,6 @@ func DialWorkspace(baseClient client.Client, workspace *managementv1.DevPodWorks
}

host := restConfig.Host
if workspace.Annotations != nil && workspace.Annotations[storagev1.DevPodWorkspaceRunnerEndpointAnnotation] != "" {
host = workspace.Annotations[storagev1.DevPodWorkspaceRunnerEndpointAnnotation]
}

parsedURL, _ := url.Parse(host)
if parsedURL != nil && parsedURL.Host != "" {
host = parsedURL.Host
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ require (
github.com/google/uuid v1.6.0
github.com/gorilla/websocket v1.5.1
github.com/joho/godotenv v1.5.1
github.com/loft-sh/agentapi/v4 v4.0.0-alpha.1
github.com/loft-sh/api/v4 v4.0.0-alpha.3
github.com/loft-sh/agentapi/v4 v4.0.0-alpha.3
github.com/loft-sh/api/v4 v4.0.0-alpha.3.0.20240522135459-9e20254f7d4d
github.com/loft-sh/log v0.0.0-20240219160058-26d83ffb46ac
github.com/loft-sh/programming-language-detection v0.0.5
github.com/loft-sh/ssh v0.0.4
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -818,8 +818,12 @@ github.com/loft-sh/admin-apis v0.0.0-20240203010124-3600c1c582a8 h1:nuY9Vgvabh2F
github.com/loft-sh/admin-apis v0.0.0-20240203010124-3600c1c582a8/go.mod h1:MWczNwKvWssHo1KaeZKaWDdRLYSNbWqQBGsTLoCNd7U=
github.com/loft-sh/agentapi/v4 v4.0.0-alpha.1 h1:LJiX7z2DQU1UHrMnkYWeLk9r9KMD2RX3733eoRAjJDo=
github.com/loft-sh/agentapi/v4 v4.0.0-alpha.1/go.mod h1:6c1I63fh+Ku2wT7hZ1GrwfH9JZsyRb8MefocoKkojJI=
github.com/loft-sh/agentapi/v4 v4.0.0-alpha.3 h1:/OF23kjpecZHeRKSf3cflLuzB6Miv/UUslXXBQdqOQY=
github.com/loft-sh/agentapi/v4 v4.0.0-alpha.3/go.mod h1:6c1I63fh+Ku2wT7hZ1GrwfH9JZsyRb8MefocoKkojJI=
github.com/loft-sh/api/v4 v4.0.0-alpha.3 h1:zZsKKzeezOv/MtuGg/PfsYQVpANDjW2MSdUXOfqhw9U=
github.com/loft-sh/api/v4 v4.0.0-alpha.3/go.mod h1:hsFRiytpWwb9Wd/MnZrC/nCefHSCu/RoidgQipFXc2E=
github.com/loft-sh/api/v4 v4.0.0-alpha.3.0.20240522135459-9e20254f7d4d h1:bhispdYRuiZsi7AqOsMsePz7CopSmVrSApvYjDVeFyA=
github.com/loft-sh/api/v4 v4.0.0-alpha.3.0.20240522135459-9e20254f7d4d/go.mod h1:EQyRUQ9daLAyHgGNzTHlGMLZ9gyRjwEGQeYqb9IGSgo=
github.com/loft-sh/apiserver v0.0.0-20240129130254-7b9a55ab1744 h1:1Yhs86ugpnEsex4kkFpyvCHNy42O5vtJjY7Loty9JkI=
github.com/loft-sh/apiserver v0.0.0-20240129130254-7b9a55ab1744/go.mod h1:/QBF5drEoeQ0pggzT6q29+cyirRg5/MOJCq39ghku+8=
github.com/loft-sh/jspolicy v0.2.2 h1:+7QqVumYm225mSJsGOjnbCGYzh9XyKYQab6FgLiHYJU=
Expand Down
8 changes: 8 additions & 0 deletions pkg/loft/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/loft-sh/devpod/pkg/loft/kube"
"github.com/loft-sh/devpod/pkg/loft/project"
"github.com/loft-sh/devpod/pkg/version"
"github.com/loft-sh/log"
"github.com/mitchellh/go-homedir"
Expand Down Expand Up @@ -131,6 +132,13 @@ func (c *client) RefreshSelf(ctx context.Context) error {
return fmt.Errorf("get self: %w", err)
}

projectNamespacePrefix := project.DefaultProjectNamespacePrefix
if c.self.Status.ProjectNamespacePrefix != nil {
projectNamespacePrefix = *c.self.Status.ProjectNamespacePrefix
}

project.SetProjectNamespacePrefix(projectNamespacePrefix)

return nil
}

Expand Down
8 changes: 2 additions & 6 deletions pkg/loft/project/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,11 @@ var prefixMux sync.RWMutex

// SetProjectNamespacePrefix sets the global project namespace prefix
// Defaulting should be handled when reading the config via ParseProjectNamespacePrefix
func SetProjectNamespacePrefix(newPrefix *string) {
func SetProjectNamespacePrefix(newPrefix string) {
prefixMux.Lock()
defer prefixMux.Unlock()

if newPrefix == nil {
return
}

prefix = newPrefix
prefix = &newPrefix
}

func GetProjectNamespacePrefix() string {
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit d6edb67

Please sign in to comment.