@@ -53,13 +53,11 @@ public static KubernetesClientConfiguration BuildConfigFromConfigFile(FileInfo k
53
53
var k8SConfiguration = new KubernetesClientConfiguration ( ) ;
54
54
55
55
currentContext = currentContext ?? k8SConfig . CurrentContext ;
56
-
57
56
// only init context if context if set
58
57
if ( currentContext != null )
59
58
{
60
- k8SConfiguration . InitializeContext ( k8SConfig , currentContext ) ;
61
- }
62
-
59
+ k8SConfiguration . InitializeContext ( k8SConfig , currentContext ) ;
60
+ }
63
61
if ( ! string . IsNullOrWhiteSpace ( masterUrl ) )
64
62
{
65
63
k8SConfiguration . Host = masterUrl ;
@@ -68,8 +66,8 @@ public static KubernetesClientConfiguration BuildConfigFromConfigFile(FileInfo k
68
66
if ( string . IsNullOrWhiteSpace ( k8SConfiguration . Host ) )
69
67
{
70
68
throw new KubeConfigException ( "Cannot infer server host url either from context or masterUrl" ) ;
71
- }
72
-
69
+ }
70
+
73
71
return k8SConfiguration ;
74
72
}
75
73
@@ -96,6 +94,9 @@ private void InitializeContext(K8SConfiguration k8SConfig, string currentContext
96
94
97
95
// user
98
96
SetUserDetails ( k8SConfig , activeContext ) ;
97
+
98
+ // namespace
99
+ Namespace = activeContext . Namespace ;
99
100
}
100
101
101
102
private void SetClusterDetails ( K8SConfiguration k8SConfig , Context activeContext )
@@ -122,8 +123,7 @@ private void SetClusterDetails(K8SConfiguration k8SConfig, Context activeContext
122
123
var uri = new Uri ( Host ) ;
123
124
if ( uri . Scheme == "https" )
124
125
{
125
-
126
- // check certificate for https
126
+ // check certificate for https
127
127
if ( ! clusterDetails . ClusterEndpoint . SkipTlsVerify &&
128
128
string . IsNullOrWhiteSpace ( clusterDetails . ClusterEndpoint . CertificateAuthorityData ) &&
129
129
string . IsNullOrWhiteSpace ( clusterDetails . ClusterEndpoint . CertificateAuthority ) )
0 commit comments