Skip to content

Commit b7ffc1a

Browse files
authored
Merge pull request #2216 from tukobadnyanoba/support-for-kubeconfig-flag-in-devspace
added support for kubeconfig flag in devspace
2 parents 41667df + 636cc9b commit b7ffc1a

16 files changed

Lines changed: 30 additions & 23 deletions

File tree

cmd/analyze.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func (cmd *AnalyzeCmd) RunAnalyze(f factory.Factory, cobraCmd *cobra.Command, ar
8484
}
8585
}
8686

87-
// If the current kube context or namespace is different than old,
87+
// If the current kube context or namespace is different from old,
8888
// show warnings and reset kube client if necessary
8989
client, err = kubectl.CheckKubeContext(client, localCache, cmd.NoWarn, cmd.SwitchContext, log)
9090
if err != nil {

cmd/attach.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func (cmd *AttachCmd) Run(f factory.Factory, cobraCmd *cobra.Command, args []str
8787
return err
8888
}
8989

90-
// If the current kube context or namespace is different than old,
90+
// If the current kube context or namespace is different from old,
9191
// show warnings and reset kube client if necessary
9292
client, err = kubectl.CheckKubeContext(client, localCache, cmd.NoWarn, cmd.SwitchContext, log)
9393
if err != nil {

cmd/enter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ func (cmd *EnterCmd) Run(f factory.Factory, args []string) error {
114114
return err
115115
}
116116

117-
// If the current kube context or namespace is different than old,
117+
// If the current kube context or namespace is different from old,
118118
// show warnings and reset kube client if necessary
119119
client, err = kubectl.CheckKubeContext(client, localCache, cmd.NoWarn, cmd.SwitchContext, logger)
120120
if err != nil {

cmd/flags/flags.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,20 @@ import (
77

88
// GlobalFlags is the flags that contains the global flags
99
type GlobalFlags struct {
10-
Silent bool
11-
NoWarn bool
12-
Debug bool
13-
10+
Silent bool
11+
NoWarn bool
12+
Debug bool
13+
DisableProfileActivation bool
14+
SwitchContext bool
15+
InactivityTimeout int
16+
KubeConfig string
1417
OverrideName string
1518
Namespace string
1619
KubeContext string
17-
Profiles []string
18-
DisableProfileActivation bool
19-
SwitchContext bool
2020
ConfigPath string
21+
Profiles []string
2122
Vars []string
2223

23-
InactivityTimeout int
24-
2524
Flags *flag.FlagSet
2625
}
2726

@@ -55,6 +54,7 @@ func SetGlobalFlags(flags *flag.FlagSet) *GlobalFlags {
5554
flags.StringVarP(&globalFlags.Namespace, "namespace", "n", "", "The kubernetes namespace to use")
5655
flags.StringVar(&globalFlags.KubeContext, "kube-context", "", "The kubernetes context to use")
5756
flags.StringSliceVar(&globalFlags.Vars, "var", []string{}, "Variables to override during execution (e.g. --var=MYVAR=MYVALUE)")
57+
flags.StringVar(&globalFlags.KubeConfig, "kubeconfig", "", "The kubeconfig path to use")
5858

5959
flags.IntVar(&globalFlags.InactivityTimeout, "inactivity-timeout", 0, "Minutes the current user is inactive (no mouse or keyboard interaction) until DevSpace will exit automatically. 0 to disable. Only supported on windows and mac operating systems")
6060
flags.AddFlag(&flag.Flag{

cmd/list/deployments.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func (cmd *deploymentsCmd) RunDeploymentsStatus(f factory.Factory, cobraCmd *cob
7878
return err
7979
}
8080

81-
// If the current kube context or namespace is different than old,
81+
// If the current kube context or namespace is different from old,
8282
// show warnings and reset kube client if necessary
8383
client, err = kubectl.CheckKubeContext(client, localCache, cmd.NoWarn, cmd.SwitchContext, logger)
8484
if err != nil {

cmd/list/namespaces.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func (cmd *namespacesCmd) RunListNamespaces(f factory.Factory, cobraCmd *cobra.C
6969
}
7070
}
7171

72-
// If the current kube context or namespace is different than old,
72+
// If the current kube context or namespace is different from old,
7373
// show warnings and reset kube client if necessary
7474
client, err = kubectl.CheckKubeContext(client, localCache, cmd.NoWarn, cmd.SwitchContext, logger)
7575
if err != nil {

cmd/logs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func (cmd *LogsCmd) RunLogs(f factory.Factory) error {
104104
return err
105105
}
106106

107-
// If the current kube context or namespace is different than old,
107+
// If the current kube context or namespace is different from old,
108108
// show warnings and reset kube client if necessary
109109
client, err = kubectl.CheckKubeContext(client, localCache, cmd.NoWarn, cmd.SwitchContext, log)
110110
if err != nil {

cmd/open.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ func (cmd *OpenCmd) RunOpen(f factory.Factory) error {
126126
}
127127
}
128128

129-
// If the current kube context or namespace is different than old,
129+
// If the current kube context or namespace is different from old,
130130
// show warnings and reset kube client if necessary
131131
client, err = kubectl.CheckKubeContext(client, localCache, cmd.NoWarn, cmd.SwitchContext, cmd.log)
132132
if err != nil {

cmd/reset/pods.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func (cmd *podsCmd) RunResetPods(f factory.Factory, cobraCmd *cobra.Command, arg
8080
return err
8181
}
8282

83-
// If the current kube context or namespace is different than old,
83+
// If the current kube context or namespace is different from old,
8484
// show warnings and reset kube client if necessary
8585
client, err = kubectl.CheckKubeContext(client, localCache, cmd.NoWarn, cmd.SwitchContext, cmd.log)
8686
if err != nil {

cmd/restart.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ func (cmd *RestartCmd) Run(f factory.Factory) error {
106106
return err
107107
}
108108

109-
// If the current kube context or namespace is different than old,
109+
// If the current kube context or namespace is different from old,
110110
// show warnings and reset kube client if necessary
111111
client, err = kubectl.CheckKubeContext(client, localCache, cmd.NoWarn, cmd.SwitchContext, cmd.log)
112112
if err != nil {

0 commit comments

Comments
 (0)