mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-04-23 00:32:50 +08:00
nuget package (#809)
* feat: Kubernetes ServiceDiscoveryProvider * 编写k8s测试例子 * feat:fix kube config * feat: remove port * feat : complete the k8s test * feat : add kubeserviceDiscovery test * feat : add kube provider unittest * feat :add kubetnetes docs how to use ocelot with kubetnetes docs * keep the configuration as simple as possible, no qos, no cache * fix: use http * add PollingKubeServiceDiscovery * feat : refactor logger * feat : add pollkube docs * feat:Remove unnecessary code * feat : code-block json * feat: publish package Ocelot.Provider.Kubernetes * feat : nuget package * fix: Namesapce Spelling wrong * fix:Namesapce Spelling Wrong
This commit is contained in:
parent
4a1e8d571b
commit
799abf55c4
@ -21,7 +21,7 @@ namespace Ocelot.Provider.Kubernetes
|
||||
{
|
||||
ApiEndPoint = new Uri($"https://{config.Host}:{config.Port}"),
|
||||
KeyOfServiceInK8s = name,
|
||||
KubeNamespace = config.Namesapce,
|
||||
KubeNamespace = config.Namespace,
|
||||
AuthStrategy = KubeAuthStrategy.BearerToken,
|
||||
AccessToken = config.Token,
|
||||
AllowInsecure = true // Don't validate server certificate
|
||||
|
@ -1,17 +1,27 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<Version>0.0.0-dev</Version>
|
||||
<Authors>geffzhang</Authors>
|
||||
<Company />
|
||||
<RuntimeFrameworkVersion>2.0.0</RuntimeFrameworkVersion>
|
||||
<NETStandardImplicitPackageVersion>2.0.0</NETStandardImplicitPackageVersion>
|
||||
<NoPackageAnalysis>true</NoPackageAnalysis>
|
||||
<Product>Ocelot</Product>
|
||||
<Description>Provides Ocelot extensions to use kubernetes</Description>
|
||||
<PackageProjectUrl>https://github.com/ThreeMammals/Ocelot</PackageProjectUrl>
|
||||
<PackageIconUrl>http://threemammals.com/images/ocelot_logo.png</PackageIconUrl>
|
||||
<PackageReleaseNotes></PackageReleaseNotes>
|
||||
<AssemblyName>Ocelot.Provider.Kubernetes</AssemblyName>
|
||||
<PackageId>Ocelot.Provider.Kubernetes</PackageId>
|
||||
<PackageTags>API Gateway;.NET core</PackageTags>
|
||||
<RuntimeIdentifiers>win10-x64;osx.10.11-x64;osx.10.12-x64;win7-x64</RuntimeIdentifiers>
|
||||
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
|
||||
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
|
||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
|
||||
<Version>0.0.0-dev</Version>
|
||||
<Authors>geffzhang</Authors>
|
||||
<Company />
|
||||
<CodeAnalysisRuleSet>..\..\codeanalysis.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -46,9 +46,9 @@ namespace Ocelot.Configuration.Builder
|
||||
return this;
|
||||
}
|
||||
|
||||
public ServiceProviderConfigurationBuilder WithNamesapce(string @namesapce)
|
||||
public ServiceProviderConfigurationBuilder WithNamespace(string @namespace)
|
||||
{
|
||||
_namespace = @namesapce;
|
||||
_namespace = @namespace;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ namespace Ocelot.Configuration.Creator
|
||||
? globalConfiguration?.ServiceDiscoveryProvider?.Type
|
||||
: "consul";
|
||||
var pollingInterval = globalConfiguration?.ServiceDiscoveryProvider?.PollingInterval ?? 0;
|
||||
var k8snamesapce = globalConfiguration?.ServiceDiscoveryProvider?.Namespace ?? string.Empty;
|
||||
var k8snamespace = globalConfiguration?.ServiceDiscoveryProvider?.Namespace ?? string.Empty;
|
||||
|
||||
return new ServiceProviderConfigurationBuilder()
|
||||
.WithHost(host)
|
||||
@ -22,7 +22,7 @@ namespace Ocelot.Configuration.Creator
|
||||
.WithToken(globalConfiguration?.ServiceDiscoveryProvider?.Token)
|
||||
.WithConfigurationKey(globalConfiguration?.ServiceDiscoveryProvider?.ConfigurationKey)
|
||||
.WithPollingInterval(pollingInterval)
|
||||
.WithNamesapce(k8snamesapce)
|
||||
.WithNamespace(k8snamespace)
|
||||
.Build();
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
Token = token;
|
||||
Type = type;
|
||||
PollingInterval = pollingInterval;
|
||||
Namesapce = @namespace;
|
||||
Namespace = @namespace;
|
||||
}
|
||||
|
||||
public string Host { get; }
|
||||
@ -25,6 +25,6 @@
|
||||
|
||||
public int PollingInterval { get; }
|
||||
|
||||
public string Namesapce { get; }
|
||||
public string Namespace { get; }
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
.WithType("ServiceFabric")
|
||||
.WithToken("testtoken")
|
||||
.WithConfigurationKey("woo")
|
||||
.WithNamesapce("default")
|
||||
.WithNamespace("default")
|
||||
.Build();
|
||||
|
||||
this.Given(x => x.GivenTheFollowingGlobalConfig(globalConfig))
|
||||
@ -66,7 +66,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
_result.Port.ShouldBe(expected.Port);
|
||||
_result.Token.ShouldBe(expected.Token);
|
||||
_result.Type.ShouldBe(expected.Type);
|
||||
_result.Namesapce.ShouldBe(expected.Namesapce);
|
||||
_result.Namespace.ShouldBe(expected.Namespace);
|
||||
_result.ConfigurationKey.ShouldBe(expected.ConfigurationKey);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user