mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-04-22 18:22:49 +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}"),
|
ApiEndPoint = new Uri($"https://{config.Host}:{config.Port}"),
|
||||||
KeyOfServiceInK8s = name,
|
KeyOfServiceInK8s = name,
|
||||||
KubeNamespace = config.Namesapce,
|
KubeNamespace = config.Namespace,
|
||||||
AuthStrategy = KubeAuthStrategy.BearerToken,
|
AuthStrategy = KubeAuthStrategy.BearerToken,
|
||||||
AccessToken = config.Token,
|
AccessToken = config.Token,
|
||||||
AllowInsecure = true // Don't validate server certificate
|
AllowInsecure = true // Don't validate server certificate
|
||||||
|
@ -1,17 +1,27 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
<RuntimeFrameworkVersion>2.0.0</RuntimeFrameworkVersion>
|
||||||
<Version>0.0.0-dev</Version>
|
<NETStandardImplicitPackageVersion>2.0.0</NETStandardImplicitPackageVersion>
|
||||||
<Authors>geffzhang</Authors>
|
<NoPackageAnalysis>true</NoPackageAnalysis>
|
||||||
<Company />
|
|
||||||
<Product>Ocelot</Product>
|
<Product>Ocelot</Product>
|
||||||
<Description>Provides Ocelot extensions to use kubernetes</Description>
|
<Description>Provides Ocelot extensions to use kubernetes</Description>
|
||||||
<PackageProjectUrl>https://github.com/ThreeMammals/Ocelot</PackageProjectUrl>
|
<PackageProjectUrl>https://github.com/ThreeMammals/Ocelot</PackageProjectUrl>
|
||||||
<PackageIconUrl>http://threemammals.com/images/ocelot_logo.png</PackageIconUrl>
|
<PackageIconUrl>http://threemammals.com/images/ocelot_logo.png</PackageIconUrl>
|
||||||
<PackageReleaseNotes></PackageReleaseNotes>
|
<PackageReleaseNotes></PackageReleaseNotes>
|
||||||
|
<AssemblyName>Ocelot.Provider.Kubernetes</AssemblyName>
|
||||||
|
<PackageId>Ocelot.Provider.Kubernetes</PackageId>
|
||||||
<PackageTags>API Gateway;.NET core</PackageTags>
|
<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>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -46,9 +46,9 @@ namespace Ocelot.Configuration.Builder
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ServiceProviderConfigurationBuilder WithNamesapce(string @namesapce)
|
public ServiceProviderConfigurationBuilder WithNamespace(string @namespace)
|
||||||
{
|
{
|
||||||
_namespace = @namesapce;
|
_namespace = @namespace;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ namespace Ocelot.Configuration.Creator
|
|||||||
? globalConfiguration?.ServiceDiscoveryProvider?.Type
|
? globalConfiguration?.ServiceDiscoveryProvider?.Type
|
||||||
: "consul";
|
: "consul";
|
||||||
var pollingInterval = globalConfiguration?.ServiceDiscoveryProvider?.PollingInterval ?? 0;
|
var pollingInterval = globalConfiguration?.ServiceDiscoveryProvider?.PollingInterval ?? 0;
|
||||||
var k8snamesapce = globalConfiguration?.ServiceDiscoveryProvider?.Namespace ?? string.Empty;
|
var k8snamespace = globalConfiguration?.ServiceDiscoveryProvider?.Namespace ?? string.Empty;
|
||||||
|
|
||||||
return new ServiceProviderConfigurationBuilder()
|
return new ServiceProviderConfigurationBuilder()
|
||||||
.WithHost(host)
|
.WithHost(host)
|
||||||
@ -22,7 +22,7 @@ namespace Ocelot.Configuration.Creator
|
|||||||
.WithToken(globalConfiguration?.ServiceDiscoveryProvider?.Token)
|
.WithToken(globalConfiguration?.ServiceDiscoveryProvider?.Token)
|
||||||
.WithConfigurationKey(globalConfiguration?.ServiceDiscoveryProvider?.ConfigurationKey)
|
.WithConfigurationKey(globalConfiguration?.ServiceDiscoveryProvider?.ConfigurationKey)
|
||||||
.WithPollingInterval(pollingInterval)
|
.WithPollingInterval(pollingInterval)
|
||||||
.WithNamesapce(k8snamesapce)
|
.WithNamespace(k8snamespace)
|
||||||
.Build();
|
.Build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
Token = token;
|
Token = token;
|
||||||
Type = type;
|
Type = type;
|
||||||
PollingInterval = pollingInterval;
|
PollingInterval = pollingInterval;
|
||||||
Namesapce = @namespace;
|
Namespace = @namespace;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Host { get; }
|
public string Host { get; }
|
||||||
@ -25,6 +25,6 @@
|
|||||||
|
|
||||||
public int PollingInterval { get; }
|
public int PollingInterval { get; }
|
||||||
|
|
||||||
public string Namesapce { get; }
|
public string Namespace { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ namespace Ocelot.UnitTests.Configuration
|
|||||||
.WithType("ServiceFabric")
|
.WithType("ServiceFabric")
|
||||||
.WithToken("testtoken")
|
.WithToken("testtoken")
|
||||||
.WithConfigurationKey("woo")
|
.WithConfigurationKey("woo")
|
||||||
.WithNamesapce("default")
|
.WithNamespace("default")
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
this.Given(x => x.GivenTheFollowingGlobalConfig(globalConfig))
|
this.Given(x => x.GivenTheFollowingGlobalConfig(globalConfig))
|
||||||
@ -66,7 +66,7 @@ namespace Ocelot.UnitTests.Configuration
|
|||||||
_result.Port.ShouldBe(expected.Port);
|
_result.Port.ShouldBe(expected.Port);
|
||||||
_result.Token.ShouldBe(expected.Token);
|
_result.Token.ShouldBe(expected.Token);
|
||||||
_result.Type.ShouldBe(expected.Type);
|
_result.Type.ShouldBe(expected.Type);
|
||||||
_result.Namesapce.ShouldBe(expected.Namesapce);
|
_result.Namespace.ShouldBe(expected.Namespace);
|
||||||
_result.ConfigurationKey.ShouldBe(expected.ConfigurationKey);
|
_result.ConfigurationKey.ShouldBe(expected.ConfigurationKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user