devspaces scripts

This commit is contained in:
eiximenis 2019-03-15 19:52:34 +01:00
parent 40205f066a
commit 1f762a6bcf
36 changed files with 357 additions and 51 deletions

View File

@ -33,14 +33,13 @@
{{- end -}}
{{- define "pathBase" -}}
{{- $name := first .}}
{{- $ctx := last .}}
{{- if $ctx.Values.inf.k8s.suffix -}}
{{- $suffix := include "suffix-name" $ctx -}}
{{- printf "/%s-%s" $name $suffix -}}
{{- if .Values.inf.k8s.suffix -}}
{{- $suffix := include "suffix-name" . -}}
{{- printf "%s-%s" .Values.pathBase $suffix -}}
{{- else -}}
{{- printf "/%s" $name -}}
{{- .Values.pathBase -}}
{{- end -}}
{{- end -}}

View File

@ -64,7 +64,7 @@ spec:
mountPath: {{ .Values.ocelot.configPath }}
env:
- name: PATH_BASE
value: {{ include "pathBase" (list .Values.app.ingress.entries.mobilemarketingapigw .) }}
value: {{ include "pathBase" . }}
- name: k8sname
value: {{ .Values.clusterName }}
{{- if .Values.env.values -}}

View File

@ -1,5 +1,5 @@
{{- if .Values.ingress.enabled -}}
{{- $ingressPath := include "pathBase" (list .Values.app.ingress.entries.mobilemarketingapigw .) -}}
{{- $ingressPath := include "pathBase" . -}}
{{- $serviceName := .Values.app.svc.mobilemarketingapigw -}}
apiVersion: extensions/v1beta1
kind: Ingress

View File

@ -35,13 +35,11 @@
{{- define "pathBase" -}}
{{- $name := first .}}
{{- $ctx := last .}}
{{- if $ctx.Values.inf.k8s.suffix -}}
{{- $suffix := include "suffix-name" $ctx -}}
{{- printf "/%s-%s" $name $suffix -}}
{{- if .Values.inf.k8s.suffix -}}
{{- $suffix := include "suffix-name" . -}}
{{- printf "%s-%s" .Values.pathBase $suffix -}}
{{- else -}}
{{- printf "/%s" $name -}}
{{- .Values.pathBase -}}
{{- end -}}
{{- end -}}

View File

@ -61,10 +61,10 @@ spec:
imagePullPolicy: {{ .Values.image.pullPolicy }}
volumeMounts:
- name: config
mountPath: {{ .Values ocelot.configPath }}
mountPath: {{ .Values.ocelot.configPath }}
env:
- name: PATH_BASE
value: {{ include "pathBase" (list .Values.app.ingress.entries.mobileshoppingapigw .) }}
value: {{ include "pathBase" . }}
- name: k8sname
value: {{ .Values.clusterName }}
{{- if .Values.env.values -}}

View File

@ -1,5 +1,7 @@
{{- if .Values.ingress.enabled -}}
{{- $ingressPath := include "pathBase" (list .Values.app.ingress.entries.mobileshoppingapigw .) -}}
{{- $ingressPath := include "pathBase" . -}}
{{- $serviceName := .Values.app.svc.mobileshoppingapigw -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
@ -23,11 +25,13 @@ spec:
{{- end }}
{{- end }}
rules:
- host: {{ .Values.inf.k8s.dns }}
{{- range .Values.ingress.hosts }}
- host: {{ . }}
http:
paths:
- path: {{ $ingressPath }}
backend:
serviceName: {{ .Values.app.svc.mobileshoppingapigw }}
serviceName: {{ $serviceName }}
servicePort: http
{{- end }}
{{- end }}

View File

@ -35,13 +35,11 @@
{{- define "pathBase" -}}
{{- $name := first .}}
{{- $ctx := last .}}
{{- if $ctx.Values.inf.k8s.suffix -}}
{{- $suffix := include "suffix-name" $ctx -}}
{{- printf "/%s-%s" $name $suffix -}}
{{- if .Values.inf.k8s.suffix -}}
{{- $suffix := include "suffix-name" . -}}
{{- printf "%s-%s" .Values.pathBase $suffix -}}
{{- else -}}
{{- printf "/%s" $name -}}
{{- .Values.pathBase -}}
{{- end -}}
{{- end -}}

View File

@ -61,10 +61,10 @@ spec:
imagePullPolicy: {{ .Values.image.pullPolicy }}
volumeMounts:
- name: config
mountPath: {{ .Values ocelot.configPath }}
mountPath: {{ .Values.ocelot.configPath }}
env:
- name: PATH_BASE
value: {{ include "pathBase" (list .Values.app.ingress.entries.webmarketingapigw .) }}
value: {{ include "pathBase" . }}
- name: k8sname
value: {{ .Values.clusterName }}
{{- if .Values.env.values -}}

View File

@ -1,5 +1,7 @@
{{- if .Values.ingress.enabled -}}
{{- $ingressPath := include "pathBase" (list .Values.app.ingress.entries.webmarketingapigw .) -}}
{{- $ingressPath := include "pathBase" . -}}
{{- $serviceName := .Values.app.svc.webmarketingapigw -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
@ -23,11 +25,13 @@ spec:
{{- end }}
{{- end }}
rules:
- host: {{ .Values.inf.k8s.dns }}
{{- range .Values.ingress.hosts }}
- host: {{ . }}
http:
paths:
- path: {{ $ingressPath }}
backend:
serviceName: {{ .Values.app.svc.webmarketingapigw }}
serviceName: {{ $serviceName }}
servicePort: http
{{- end }}
{{- end }}

View File

@ -33,14 +33,13 @@
{{- end -}}
{{- define "pathBase" -}}
{{- $name := first .}}
{{- $ctx := last .}}
{{- if $ctx.Values.inf.k8s.suffix -}}
{{- $suffix := include "suffix-name" $ctx -}}
{{- printf "/%s-%s" $name $suffix -}}
{{- if .Values.inf.k8s.suffix -}}
{{- $suffix := include "suffix-name" . -}}
{{- printf "%s-%s" .Values.pathBase $suffix -}}
{{- else -}}
{{- printf "/%s" $name -}}
{{- .Values.pathBase -}}
{{- end -}}
{{- end -}}

View File

@ -60,10 +60,10 @@ spec:
imagePullPolicy: {{ .Values.image.pullPolicy }}
volumeMounts:
- name: config
mountPath: /app/configuration
mountPath: {{ .Values.ocelot.configPath }}
env:
- name: PATH_BASE
value: {{ include "pathBase" (list .Values.app.ingress.entries.webshoppingapigw .) }}
value: {{ include "pathBase" . }}
- name: k8sname
value: {{ .Values.clusterName }}
{{- if .Values.env.values -}}

View File

@ -1,5 +1,6 @@
{{- if .Values.ingress.enabled -}}
{{- $ingressPath := include "pathBase" (list .Values.app.ingress.entries.webshoppingapigw .) -}}
{{- $ingressPath := include "pathBase" . -}}
{{- $serviceName := .Values.app.svc.webshoppingapigw -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
@ -23,11 +24,13 @@ spec:
{{- end }}
{{- end }}
rules:
- host: {{ .Values.inf.k8s.dns }}
{{- range .Values.ingress.hosts }}
- host: {{ . }}
http:
paths:
- path: {{ $ingressPath }}
backend:
serviceName: {{ .Values.app.svc.webshoppingapigw }}
serviceName: {{ $serviceName }}
servicePort: http
{{- end }}
{{- end }}

View File

@ -62,3 +62,5 @@ probes:
initialDelaySeconds: 90
periodSeconds: 60
port: 80
ocelot:
configPath: /app/configuration

View File

@ -0,0 +1,37 @@
{{- if .Values.ingress.enabled -}}
{{- $ingressPath := include "pathBase" . -}}
{{- $serviceName := .Values.app.svc.basket -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ template "basket-api.fullname" . }}
labels:
app: {{ template "basket-api.name" . }}
chart: {{ template "basket-api.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- with .Values.ingress.annotations }}
annotations:
{{ toYaml . | indent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
- {{ .Values.inf.k8s.dns }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ . }}
http:
paths:
- path: {{ $ingressPath }}
backend:
serviceName: {{ $serviceName }}
servicePort: http
{{- end }}
{{- end }}

View File

@ -53,3 +53,6 @@ probes:
initialDelaySeconds: 90
periodSeconds: 60
port: 80
ingress:
enabled: false

View File

@ -0,0 +1,37 @@
{{- if .Values.ingress.enabled -}}
{{- $ingressPath := include "pathBase" . -}}
{{- $serviceName := .Values.app.svc.catalog -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ template "catalog-api.fullname" . }}
labels:
app: {{ template "catalog-api.name" . }}
chart: {{ template "catalog-api.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- with .Values.ingress.annotations }}
annotations:
{{ toYaml . | indent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
- {{ .Values.inf.k8s.dns }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ . }}
http:
paths:
- path: {{ $ingressPath }}
backend:
serviceName: {{ $serviceName }}
servicePort: http
{{- end }}
{{- end }}

View File

@ -36,5 +36,4 @@ data:
xamarin_callback_e: http://{{ $xamarincallback }}
webhooksapi_e: http://{{ $webhooks_url }}
webhooksweb_e: http://{{ $webhooksweb_url }}
enableDevspaces: "{{ .Values.enableDevspaces }}"

View File

@ -58,6 +58,8 @@ env:
key: webhooksapi_e
- name: WebhooksWebClient
key: webhooksweb_e
- name: EnableDevspaces
key: enableDevspaces
values:
- name: ASPNETCORE_ENVIRONMENT
value: Development
@ -65,6 +67,7 @@ env:
value: 'K8S'
- name: IsClusterEnv
value: 'True'
probes:
liveness:
path: /liveness
@ -77,3 +80,5 @@ probes:
initialDelaySeconds: 90
periodSeconds: 60
port: 80
enableDevspaces: "false"

View File

@ -0,0 +1,36 @@
{{- if .Values.ingress.enabled -}}
{{- $ingressPath := include "pathBase" . -}}
{{- $serviceName := .Values.app.svc.locations }}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ template "locations-api.fullname" . }}
labels:
app: {{ template "locations-api.name" . }}
chart: {{ template "locations-api.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- with .Values.ingress.annotations }}
annotations:
{{ toYaml . | indent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
- {{ .Values.inf.k8s.dns }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ . }}
http:
paths:
- path: {{ $ingressPath }}
backend:
serviceName: {{ $serviceName }}
servicePort: http
{{- end }}
{{- end }}

View File

@ -0,0 +1,36 @@
{{- if .Values.ingress.enabled -}}
{{- $ingressPath := include "pathBase" . -}}
{{- $serviceName := .Values.app.svc.marketing }}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ template "marketing-api.fullname" . }}
labels:
app: {{ template "marketing-api.name" . }}
chart: {{ template "marketing-api.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- with .Values.ingress.annotations }}
annotations:
{{ toYaml . | indent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
- {{ .Values.inf.k8s.dns }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ . }}
http:
paths:
- path: {{ $ingressPath }}
backend:
serviceName: {{ $serviceName }}
servicePort: http
{{- end }}
{{- end }}

View File

@ -0,0 +1,36 @@
{{- if .Values.ingress.enabled -}}
{{- $ingressPath := include "pathBase" . -}}
{{- $serviceName := .Values.app.svc.mobileshoppingagg }}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ template "mobileshoppingagg.fullname" . }}
labels:
app: {{ template "mobileshoppingagg.name" . }}
chart: {{ template "mobileshoppingagg.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- with .Values.ingress.annotations }}
annotations:
{{ toYaml . | indent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
- {{ .Values.inf.k8s.dns }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ . }}
http:
paths:
- path: {{ $ingressPath }}
backend:
serviceName: {{ $serviceName }}
servicePort: http
{{- end }}
{{- end }}

View File

@ -0,0 +1,36 @@
{{- if .Values.ingress.enabled -}}
{{- $ingressPath := include "pathBase" . -}}
{{- $serviceName := .Values.app.svc.webshoppingagg }}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ template "webshoppingagg.fullname" . }}
labels:
app: {{ template "webshoppingagg.name" . }}
chart: {{ template "webshoppingagg.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- with .Values.ingress.annotations }}
annotations:
{{ toYaml . | indent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
- {{ .Values.inf.k8s.dns }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ . }}
http:
paths:
- path: {{ $ingressPath }}
backend:
serviceName: {{ $serviceName }}
servicePort: http
{{- end }}
{{- end }}

View File

@ -2,9 +2,9 @@ kind: helm-release
apiVersion: 1.1
build:
context: ..\..\..\..\
dockerfile: ..\..\..\..\ApiGateways\ApiGw-Base\Dockerfile
dockerfile: ..\..\..\ApiGateways\ApiGw-Base\Dockerfile
install:
chart: ../../../../k8s/helm/apigwwm
chart: ../../../../k8s/helm/apigwmm
set:
replicaCount: 1
image:
@ -15,7 +15,7 @@ install:
kubernetes.io/ingress.class: traefik-azds
hosts:
# This expands to [space.s.]webmvc.<guid>.<region>.aksapp.io
- $(spacePrefix)apigwwm$(hostSuffix)
- $(spacePrefix)apigwmm$(hostSuffix)
values:
- values.dev.yaml?
- secrets.dev.yaml?

View File

@ -0,0 +1,3 @@
ingress:
enabled: true
tls: []

View File

@ -2,7 +2,7 @@ kind: helm-release
apiVersion: 1.1
build:
context: ..\..\..\..\
dockerfile: ..\..\..\..\ApiGateways\ApiGw-Base\Dockerfile
dockerfile: ..\..\..\ApiGateways\ApiGw-Base\Dockerfile
install:
chart: ../../../../k8s/helm/apigwms
set:

View File

@ -2,9 +2,9 @@ kind: helm-release
apiVersion: 1.1
build:
context: ..\..\..\..\
dockerfile: ..\..\..\..\ApiGateways\ApiGw-Base\Dockerfile
dockerfile: ..\..\..\ApiGateways\ApiGw-Base\Dockerfile
install:
chart: ../../../../k8s/helm/apigwmm
chart: ../../../../k8s/helm/apigwwm
set:
replicaCount: 1
image:
@ -15,7 +15,7 @@ install:
kubernetes.io/ingress.class: traefik-azds
hosts:
# This expands to [space.s.]webmvc.<guid>.<region>.aksapp.io
- $(spacePrefix)apigwmm$(hostSuffix)
- $(spacePrefix)apigwwm$(hostSuffix)
values:
- values.dev.yaml?
- secrets.dev.yaml?

View File

@ -0,0 +1,2 @@
ocelot:
configPath: /app/configuration

View File

@ -0,0 +1,3 @@
ingress:
enabled: true
tls: []

View File

@ -0,0 +1,3 @@
ingress:
enabled: true
tls: []

View File

@ -0,0 +1,31 @@
using IdentityServer4.Models;
using IdentityServer4.Validation;
using Microsoft.Extensions.Logging;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Services.Identity.API.Devspaces
{
public class DevspacesRedirectUriValidator : IRedirectUriValidator
{
private readonly ILogger _logger;
public DevspacesRedirectUriValidator(ILogger<DevspacesRedirectUriValidator> logger)
{
_logger = logger;
}
public Task<bool> IsPostLogoutRedirectUriValidAsync(string requestedUri, Client client)
{
_logger.LogInformation($"Client {client.ClientName} used post logout uri {requestedUri}.");
return Task.FromResult(true);
}
public Task<bool> IsRedirectUriValidAsync(string requestedUri, Client client)
{
_logger.LogInformation($"Client {client.ClientName} used redirect uri {requestedUri}.");
return Task.FromResult(true);
}
}
}

View File

@ -0,0 +1,20 @@
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Services.Identity.API.Devspaces
{
static class IdentityDevspacesBuilderExtensions
{
public static IIdentityServerBuilder AddDevspacesIfNeeded(this IIdentityServerBuilder builder, bool useDevspaces)
{
if (useDevspaces)
{
builder.AddRedirectUriValidator<DevspacesRedirectUriValidator>();
}
return builder;
}
}
}

View File

@ -13,6 +13,7 @@ using Microsoft.eShopOnContainers.Services.Identity.API.Certificates;
using Microsoft.eShopOnContainers.Services.Identity.API.Data;
using Microsoft.eShopOnContainers.Services.Identity.API.Models;
using Microsoft.eShopOnContainers.Services.Identity.API.Services;
using Microsoft.eShopOnContainers.Services.Identity.API.Devspaces;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -85,6 +86,7 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API
x.IssuerUri = "null";
x.Authentication.CookieLifetime = TimeSpan.FromHours(2);
})
.AddDevspacesIfNeeded(Configuration.GetValue("UseDevspaces", false))
.AddSigningCredential(Certificate.Get())
.AddAspNetIdentity<ApplicationUser>()
.AddConfigurationStore(options =>

View File

@ -0,0 +1 @@
enableDevspaces: "true"

View File

@ -0,0 +1,3 @@
ingress:
enabled: true
tls: []

View File

@ -0,0 +1,3 @@
ingress:
enabled: true
tls: []

View File

@ -16,6 +16,9 @@ install:
hosts:
# This expands to [space.s.]webmvc.<guid>.<region>.aksapp.io
- $(spacePrefix)webmvc$(hostSuffix)
inf:
k8s:
dns: $(spacePrefix)webmvc$(hostSuffix)
values:
- values.dev.yaml?
- secrets.dev.yaml?