Skip to content

Commit 307e0af

Browse files
committed
feat: add vcluster as local kubernetes
1 parent 9e06993 commit 307e0af

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

pkg/devspace/kubectl/util.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"k8s.io/client-go/transport/spdy"
1414
"net"
1515
"net/http"
16+
"strings"
1617
)
1718

1819
const minikubeContext = "minikube"
@@ -200,5 +201,11 @@ func NewPortForwarder(client Client, pod *corev1.Pod, ports []string, addresses
200201

201202
// IsLocalKubernetes returns true if the context belongs to a local Kubernetes cluster
202203
func IsLocalKubernetes(context string) bool {
203-
return context == minikubeContext || context == dockerDesktopContext || context == dockerForDesktopContext
204+
if context == minikubeContext || context == dockerDesktopContext || context == dockerForDesktopContext {
205+
return true
206+
} else if strings.HasPrefix(context, "vcluster_") && (strings.HasSuffix(context, minikubeContext) || strings.HasSuffix(context, dockerDesktopContext) || strings.HasSuffix(context, dockerForDesktopContext)) {
207+
return true
208+
}
209+
210+
return false
204211
}

pkg/devspace/sync/downstream.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func (d *downstream) collectChanges(skipIgnore bool) ([]*remote.Change, error) {
107107
changeChunk, err := changesClient.Recv()
108108
if changeChunk != nil {
109109
for _, change := range changeChunk.Changes {
110-
if !skipIgnore && d.ignoreMatcher.Matches(change.Path, change.IsDir) {
110+
if !skipIgnore && d.ignoreMatcher != nil && d.ignoreMatcher.Matches(change.Path, change.IsDir) {
111111
continue
112112
}
113113
if !d.shouldKeep(change) {

pkg/devspace/sync/sync.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ func (s *Sync) initialSync(onInitUploadDone chan struct{}, onInitDownloadDone ch
342342
downloadChanges := make(map[string]*FileInformation)
343343
s.fileIndex.fileMapMutex.Lock()
344344
for key, element := range s.fileIndex.fileMap {
345-
if s.downloadIgnoreMatcher.Matches(element.Name, element.IsDirectory) {
345+
if s.downloadIgnoreMatcher != nil && s.downloadIgnoreMatcher.Matches(element.Name, element.IsDirectory) {
346346
continue
347347
}
348348
if element.IsSymbolicLink {

0 commit comments

Comments
 (0)