mirror of
https://github.com/kubenetworks/kubevpn.git
synced 2025-12-24 11:51:13 +08:00
feat: use download api to get current namespace
This commit is contained in:
@@ -38,9 +38,6 @@ func CmdServe(factory cmdutil.Factory) *cobra.Command {
|
||||
}
|
||||
namespace, found, _ := factory.ToRawKubeConfigLoader().Namespace()
|
||||
if !found {
|
||||
namespace = os.Getenv(config.EnvNamespace)
|
||||
}
|
||||
if namespace == "" {
|
||||
return fmt.Errorf("can not get namespace")
|
||||
}
|
||||
cmi := clientset.CoreV1().ConfigMaps(namespace)
|
||||
@@ -85,9 +82,6 @@ func CmdServe(factory cmdutil.Factory) *cobra.Command {
|
||||
}
|
||||
namespace, found, _ := factory.ToRawKubeConfigLoader().Namespace()
|
||||
if !found {
|
||||
namespace = os.Getenv(config.EnvNamespace)
|
||||
}
|
||||
if namespace == "" {
|
||||
return fmt.Errorf("can not get namespace")
|
||||
}
|
||||
cmi := clientset.CoreV1().ConfigMaps(namespace)
|
||||
|
||||
@@ -33,7 +33,6 @@ const (
|
||||
// env name
|
||||
EnvTunNameOrLUID = "TunNameOrLUID"
|
||||
EnvInboundPodTunIP = "InboundPodTunIP"
|
||||
EnvNamespace = "Namespace"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -54,8 +54,12 @@ kubevpn serve -L "tun:/${TrafficManagerRealIP}:8422?net=${InboundPodTunIP}&route
|
||||
Value: c.InboundPodTunIP,
|
||||
},
|
||||
{
|
||||
Name: config.EnvNamespace,
|
||||
Value: ns,
|
||||
Name: "POD_NAMESPACE",
|
||||
ValueFrom: &v1.EnvVarSource{
|
||||
FieldRef: &v1.ObjectFieldSelector{
|
||||
FieldPath: "metadata.namespace",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
SecurityContext: &v1.SecurityContext{
|
||||
|
||||
Reference in New Issue
Block a user