我想知道这些事情之间有什么区别.它们具有几乎相同的命令并给出相同的结果.
在 OpenShift 中,有没有比这个更优雅的方法来获取应用程序中最近创建的 pod 的名称my_app
?
name=$(oc get pods -l app=my_app -o=jsonpath='{range.items[*]}{.status.startTime}{"\t"}{.metadata.name}{"\n"}{end}' | sort -r | head -1 | awk '{print $2}')
Run Code Online (Sandbox Code Playgroud)
这个想法是排序.status.startTime
并输出一个.metadata.name
。到目前为止,我还没有使用成功oc get
用这两个选项--sort-by
,并-o jsonpath
在同一时间,所以我在这个版本回落到UNIX管道。
我正在使用 OpenShift v3.9。我还为 Kubernetes 标记了这个问题,因为它大概适用于kubectl
(而不是oc
)以类似的方式(没有-l app=my_app
)。
在使用代理后面的 docker-compose 构建时出现金块恢复错误。我已经在 docker for windows 中设置了代理。Nuget 恢复适用于命令行dotnet restore
和 Visual Studio 调试,但不适用于docker-compose
.
:\Program Files\dotnet\sdk\2.1.104\NuGet.targets(104,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [C:\src\WebApp.sln]
:\Program Files\dotnet\sdk\2.1.104\NuGet.targets(104,5): error : An error occurred while sending the request. [C:\src\WebApp.sln]
:\Program Files\dotnet\sdk\2.1.104\NuGet.targets(104,5): error : A connection with the server could not be established [C:\src\WebApp.sln]
ERROR: Service 'idenityapi' failed to build: The command 'powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; dotnet restore -nowarn:msb3202,nu1503' r
turned a non-zero code: …
Run Code Online (Sandbox Code Playgroud) nuget docker nuget-package-restore dockerfile docker-compose
我使用 ASP.NET Core Razor Pages 构建了一个小型 Web 应用程序,但我想IOptions<T>
使用. 谢谢!app.json
_Layout
我正在创建一个示例应用程序,以了解身份服务器 4 身份验证如何与 Asp.net core 2 一起工作。我注意到为不同级别生成了一些 cookie,如所附屏幕截图所示。我的问题是为什么会生成这些 cookie?
下面的语句,我取自 Identity Server 文档。身份服务器配置时
IdentityServer 使用自定义方案(通过常量 IdentityServerConstants.DefaultCookieAuthenticationScheme)在内部调用 AddAuthentication 和 AddCookie,
这里为什么它调用AddCookies
身份服务器本身的方法?
此外,当我将 Asp.net 核心 Web 客户端配置为使用身份服务器身份验证时,它也会调用AddCookie()
方法。当我尝试对其发表评论时,它会给我一个错误。我有点不清楚这里发生了什么。
身份服务器配置
services.AddIdentityServer()
.AddDeveloperSigningCredential()
.AddToDoUserStore()
.AddInMemoryIdentityResources(Config.GetIdentityResources())
.AddInMemoryApiResources(Config.GetApiResources())
.AddInMemoryClients(Config.GetClients());
services.AddAuthentication("MyCookie")
.AddCookie("MyCookie", options =>
{
options.ExpireTimeSpan = new System.TimeSpan(0, 0, 15);
});
Run Code Online (Sandbox Code Playgroud)
网页客户端配置
services.AddAuthentication(options =>
{
options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
})
.AddCookie()
.AddOpenIdConnect(options =>
{
options.Authority = "https://localhost:44377/";
options.RequireHttpsMetadata = true;
options.ClientId = "ToDoTaskManagmentClient";
options.Scope.Clear();
options.Scope.Add("openid");
options.Scope.Add("profile");
options.Scope.Add("address");
options.Scope.Add("roles");
options.Scope.Add("usertodoapi");
options.Scope.Add("countries");
options.Scope.Add("subscriptionlevel"); …
Run Code Online (Sandbox Code Playgroud) c# asp.net asp.net-identity identityserver4 asp.net-core-2.0
c# ×2
.net-core ×1
asp.net ×1
asp.net-core ×1
docker ×1
docker-swarm ×1
dockerfile ×1
jsonpath ×1
kubernetes ×1
nuget ×1
openshift ×1
razor-pages ×1