align files to .editorconfig (#203)
* align files to .editorconfig * fix space cause build failed
This commit is contained in:
committed by
Brendan Burns
parent
09a8c8773a
commit
9372e3291f
@@ -1,35 +1,35 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using k8s.Exceptions;
|
||||
|
||||
namespace k8s
|
||||
{
|
||||
public partial class KubernetesClientConfiguration
|
||||
{
|
||||
private const string ServiceaccountPath = "/var/run/secrets/kubernetes.io/serviceaccount/";
|
||||
private const string ServiceAccountTokenKeyFileName = "token";
|
||||
private const string ServiceAccountRootCAKeyFileName = "ca.crt";
|
||||
|
||||
public static KubernetesClientConfiguration InClusterConfig()
|
||||
{
|
||||
var host = Environment.GetEnvironmentVariable("KUBERNETES_SERVICE_HOST");
|
||||
var port = Environment.GetEnvironmentVariable("KUBERNETES_SERVICE_PORT");
|
||||
|
||||
if (string.IsNullOrWhiteSpace(host) || string.IsNullOrWhiteSpace(port))
|
||||
{
|
||||
throw new KubeConfigException(
|
||||
"unable to load in-cluster configuration, KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined");
|
||||
}
|
||||
|
||||
var token = File.ReadAllText(Path.Combine(ServiceaccountPath, ServiceAccountTokenKeyFileName));
|
||||
var rootCAFile = Path.Combine(ServiceaccountPath, ServiceAccountRootCAKeyFileName);
|
||||
|
||||
return new KubernetesClientConfiguration
|
||||
{
|
||||
Host = new UriBuilder("https", host, Convert.ToInt32(port)).ToString(),
|
||||
AccessToken = token,
|
||||
SslCaCert = CertUtils.LoadPemFileCert(rootCAFile)
|
||||
};
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.IO;
|
||||
using k8s.Exceptions;
|
||||
|
||||
namespace k8s
|
||||
{
|
||||
public partial class KubernetesClientConfiguration
|
||||
{
|
||||
private const string ServiceaccountPath = "/var/run/secrets/kubernetes.io/serviceaccount/";
|
||||
private const string ServiceAccountTokenKeyFileName = "token";
|
||||
private const string ServiceAccountRootCAKeyFileName = "ca.crt";
|
||||
|
||||
public static KubernetesClientConfiguration InClusterConfig()
|
||||
{
|
||||
var host = Environment.GetEnvironmentVariable("KUBERNETES_SERVICE_HOST");
|
||||
var port = Environment.GetEnvironmentVariable("KUBERNETES_SERVICE_PORT");
|
||||
|
||||
if (string.IsNullOrWhiteSpace(host) || string.IsNullOrWhiteSpace(port))
|
||||
{
|
||||
throw new KubeConfigException(
|
||||
"unable to load in-cluster configuration, KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined");
|
||||
}
|
||||
|
||||
var token = File.ReadAllText(Path.Combine(ServiceaccountPath, ServiceAccountTokenKeyFileName));
|
||||
var rootCAFile = Path.Combine(ServiceaccountPath, ServiceAccountRootCAKeyFileName);
|
||||
|
||||
return new KubernetesClientConfiguration
|
||||
{
|
||||
Host = new UriBuilder("https", host, Convert.ToInt32(port)).ToString(),
|
||||
AccessToken = token,
|
||||
SslCaCert = CertUtils.LoadPemFileCert(rootCAFile)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user