File tree Expand file tree Collapse file tree 5 files changed +9
-22
lines changed
Expand file tree Collapse file tree 5 files changed +9
-22
lines changed Original file line number Diff line number Diff line change 55 "time"
66
77 devspacecontext "github.com/loft-sh/devspace/pkg/devspace/context"
8- "github.com/loft-sh/devspace/pkg/devspace/kubectl"
98 "github.com/loft-sh/devspace/pkg/util/ptr"
109 appsv1 "k8s.io/api/apps/v1"
1110 corev1 "k8s.io/api/core/v1"
@@ -72,7 +71,7 @@ func (r *LocalRegistry) ensureDeployment(ctx devspacecontext.Context) (*appsv1.D
7271 Force : true ,
7372 },
7473 )
75- if err != nil && kubectl . IsIncompatibleServerError (err ) {
74+ if kerrors . IsUnsupportedMediaType (err ) {
7675 ctx .Log ().Debugf ("Server-side apply not available on the server for localRegistry deployment: (%v)" , err )
7776 // Unsupport server-side apply, we use existing or created deployment
7877 return existing , nil
Original file line number Diff line number Diff line change 55 "time"
66
77 devspacecontext "github.com/loft-sh/devspace/pkg/devspace/context"
8- "github.com/loft-sh/devspace/pkg/devspace/kubectl"
98 corev1 "k8s.io/api/core/v1"
109 kerrors "k8s.io/apimachinery/pkg/api/errors"
1110 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -59,7 +58,7 @@ func (r *LocalRegistry) ensureService(ctx devspacecontext.Context) (*corev1.Serv
5958 Force : true ,
6059 },
6160 )
62- if err != nil && kubectl . IsIncompatibleServerError (err ) {
61+ if kerrors . IsUnsupportedMediaType (err ) {
6362 ctx .Log ().Debugf ("Server-side apply not available on the server for localRegistry service: (%v)" , err )
6463 // Unsupport server-side apply, we use existing or created service
6564 return existing , nil
Original file line number Diff line number Diff line change 55 "time"
66
77 devspacecontext "github.com/loft-sh/devspace/pkg/devspace/context"
8- "github.com/loft-sh/devspace/pkg/devspace/kubectl"
98 appsv1 "k8s.io/api/apps/v1"
109 corev1 "k8s.io/api/core/v1"
1110 kerrors "k8s.io/apimachinery/pkg/api/errors"
@@ -68,7 +67,7 @@ func (r *LocalRegistry) ensureStatefulset(ctx devspacecontext.Context) (*appsv1.
6867 Force : true ,
6968 },
7069 )
71- if err != nil && kubectl . IsIncompatibleServerError (err ) {
70+ if kerrors . IsUnsupportedMediaType (err ) {
7271 ctx .Log ().Debugf ("Server-side apply not available on the server for localRegistry statefulset: (%v)" , err )
7372 // Unsupport server-side apply, we use existing or created statefulset
7473 return existing , nil
Original file line number Diff line number Diff line change @@ -3,6 +3,11 @@ package kubectl
33import (
44 "context"
55 "fmt"
6+ "io"
7+ "net/http"
8+ "os"
9+ "time"
10+
611 "github.com/loft-sh/devspace/pkg/devspace/config/localcache"
712 "github.com/loft-sh/devspace/pkg/devspace/kill"
813 "github.com/loft-sh/devspace/pkg/devspace/kubectl/util"
@@ -12,17 +17,12 @@ import (
1217 "github.com/loft-sh/devspace/pkg/util/log"
1318 "github.com/loft-sh/devspace/pkg/util/survey"
1419 "github.com/loft-sh/devspace/pkg/util/terminal"
15- "io"
16- "k8s.io/apimachinery/pkg/util/wait"
17- "net/http"
18- "os"
19- "time"
20-
2120 "github.com/mgutz/ansi"
2221 "github.com/pkg/errors"
2322 "github.com/sirupsen/logrus"
2423 k8sv1 "k8s.io/api/core/v1"
2524 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
25+ "k8s.io/apimachinery/pkg/util/wait"
2626 "k8s.io/client-go/kubernetes"
2727 "k8s.io/client-go/rest"
2828 "k8s.io/client-go/tools/clientcmd"
Original file line number Diff line number Diff line change @@ -276,13 +276,3 @@ func GetKindContext(context string) string {
276276
277277 return strings .TrimPrefix (context , "kind-" )
278278}
279-
280- func IsIncompatibleServerError (err error ) bool {
281- // 415: Unsupported media type means we're talking to a server which doesn't support server-side apply.
282- // Also included the apiserver enabled feature: ServerSideApply=false option
283- if _ , ok := err .(* kerrors.StatusError ); ! ok {
284- // Non-StatusError means the error isn't because the server is incompatible.
285- return false
286- }
287- return err .(* kerrors.StatusError ).Status ().Code == http .StatusUnsupportedMediaType
288- }
You can’t perform that action at this time.
0 commit comments