Changes
This commit is contained in:
@@ -414,3 +414,7 @@ FodyWeavers.xsd
|
||||
# Built Visual Studio Code Extensions
|
||||
*.vsix
|
||||
|
||||
# Local secrets
|
||||
FutureSecrets.json
|
||||
appsettings.Development.json
|
||||
|
||||
|
||||
@@ -20,6 +20,15 @@ if (builder.Environment.IsDevelopment())
|
||||
builder.Configuration.AddJsonFile("FutureSecrets.json", optional: true, reloadOnChange: true);
|
||||
}
|
||||
|
||||
// Support Kubernetes mounted secrets (key-per-file) and env var secrets.
|
||||
// Add env vars again after custom providers so Secret-backed env values win precedence.
|
||||
var secretsDirectory = builder.Configuration["K8S_SECRETS_PATH"] ?? "/var/run/secrets/maintenancepages";
|
||||
if (Directory.Exists(secretsDirectory))
|
||||
{
|
||||
builder.Configuration.AddKeyPerFile(secretsDirectory, optional: true, reloadOnChange: true);
|
||||
}
|
||||
builder.Configuration.AddEnvironmentVariables();
|
||||
|
||||
var primaryDbConnection = builder.Configuration.GetConnectionString("PrimaryDb");
|
||||
var groupLookupDbConnection = builder.Configuration.GetConnectionString("GroupLookupDb");
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
Apply order:
|
||||
1) kubectl apply -f k8s/namespace.yaml
|
||||
2) kubectl apply -f k8s/secret.example.yaml
|
||||
3) kubectl apply -f k8s/deployment.yaml
|
||||
4) kubectl apply -f k8s/service.yaml
|
||||
5) kubectl apply -f k8s/ingress.yaml
|
||||
|
||||
Then verify:
|
||||
- kubectl -n maintenance-dev get pods,svc,ingress
|
||||
- Confirm DNS for maintenance.stage.omb.gov points to Traefik LB
|
||||
- Ensure ADFS/OIDC app registration includes callback URLs for maintenance.stage.omb.gov
|
||||
@@ -0,0 +1,51 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: maintenancepages
|
||||
namespace: maintenance-dev
|
||||
labels:
|
||||
app: maintenancepages
|
||||
spec:
|
||||
replicas: 2
|
||||
selector:
|
||||
matchLabels:
|
||||
app: maintenancepages
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: maintenancepages
|
||||
spec:
|
||||
containers:
|
||||
- name: maintenancepages
|
||||
image: <registry>/maintenancepages:<tag>
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 8080
|
||||
env:
|
||||
- name: ASPNETCORE_URLS
|
||||
value: http://+:8080
|
||||
- name: ASPNETCORE_ENVIRONMENT
|
||||
value: Staging
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: Maintenance-Secrets
|
||||
resources:
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 256Mi
|
||||
limits:
|
||||
cpu: 500m
|
||||
memory: 512Mi
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: http
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 15
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: http
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 10
|
||||
@@ -0,0 +1,21 @@
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: maintenancepages
|
||||
namespace: maintenance-dev
|
||||
annotations:
|
||||
traefik.ingress.kubernetes.io/router.entrypoints: websecure
|
||||
traefik.ingress.kubernetes.io/router.tls: "true"
|
||||
spec:
|
||||
ingressClassName: traefik
|
||||
rules:
|
||||
- host: maintenance.stage.omb.gov
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: maintenancepages
|
||||
port:
|
||||
number: 80
|
||||
@@ -0,0 +1,4 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: maintenance-dev
|
||||
@@ -0,0 +1,27 @@
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: Maintenance-Secrets
|
||||
namespace: maintenance-dev
|
||||
type: Opaque
|
||||
stringData:
|
||||
AUTH_MODE: "WSFED"
|
||||
AUTH_ADMIN_GROUPS: "maintenance-Admins;maintenance-SuperAdmins"
|
||||
ADFS_METADATA_ADDRESS: "https://adfs.example.com/federationmetadata/2007-06/federationmetadata.xml"
|
||||
ADFS_WTRELM: "URN:WSFEDAPP"
|
||||
ADFS_VALID_ISSUERS: "https://adfs.example.com/adfs/services/trust;http://adfs.example.com/adfs/services/trust"
|
||||
ADFS_WREPLY: "https://maintenance.stage.omb.gov/signin-wsfed"
|
||||
ADFS_WHR: ""
|
||||
ADFS_WAUTH: ""
|
||||
ADFS_CALLBACK_PATH: "/signin-wsfed"
|
||||
OIDC_AUTHORITY: "https://adfs.example.com/adfs"
|
||||
OIDC_CLIENT_ID: "CHANGE_ME"
|
||||
OIDC_CLIENT_SECRET: "CHANGE_ME"
|
||||
OIDC_CALLBACK_PATH: "/signin-oidc"
|
||||
OIDC_SIGNOUT_CALLBACK_PATH: "/signout-callback-oidc"
|
||||
OIDC_SCOPES: "openid;profile;email;role"
|
||||
OIDC_ROLE_CLAIM_TYPE: "http://schemas.microsoft.com/ws/2008/06/identity/claims/role"
|
||||
OIDC_NAME_CLAIM_TYPE: "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name"
|
||||
OIDC_VALID_ISSUERS: ""
|
||||
ConnectionStrings__PrimaryDb: "Server=CHANGE_ME;Database=maintenance;User Id=CHANGE_ME;Password=CHANGE_ME;TrustServerCertificate=True"
|
||||
ConnectionStrings__GroupLookupDb: "Server=CHANGE_ME;Database=GroupLookup;User Id=CHANGE_ME;Password=CHANGE_ME;TrustServerCertificate=True"
|
||||
@@ -0,0 +1,15 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: maintenancepages
|
||||
namespace: maintenance-dev
|
||||
labels:
|
||||
app: maintenancepages
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
app: maintenancepages
|
||||
ports:
|
||||
- name: http
|
||||
port: 80
|
||||
targetPort: http
|
||||
Reference in New Issue
Block a user