Add isolated UAT and production environments

This commit is contained in:
hz
2026-07-20 20:32:22 -05:00
parent 4e0ca70157
commit 17747d96a0
30 changed files with 780 additions and 282 deletions
+82
View File
@@ -0,0 +1,82 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: step3-api
spec:
replicas: 2
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 0
maxSurge: 1
selector:
matchLabels:
app: step3-api
template:
metadata:
labels:
app: step3-api
annotations:
prometheus.io/scrape: "true"
prometheus.io/path: /metrics
prometheus.io/port: "5008"
spec:
containers:
- name: api
image: step3-questions:latest
imagePullPolicy: IfNotPresent
ports:
- containerPort: 5008
envFrom:
- configMapRef:
name: step3-runtime-config
env:
- name: MongoDB__ConnectionString
valueFrom:
secretKeyRef:
name: step3-runtime-secrets
key: mongodb-connection-string
- name: Jwt__Key
valueFrom:
secretKeyRef:
name: step3-runtime-secrets
key: jwt-key
- name: InternalPurge__Secret
valueFrom:
secretKeyRef:
name: step3-runtime-secrets
key: purge-secret
- name: Stripe__SecretKey
valueFrom:
secretKeyRef:
name: step3-runtime-secrets
key: stripe-secret-key
- name: Stripe__WebhookSecret
valueFrom:
secretKeyRef:
name: step3-runtime-secrets
key: stripe-webhook-secret
resources:
requests:
cpu: 250m
memory: 256Mi
limits:
cpu: "1"
memory: 512Mi
readinessProbe:
httpGet:
path: /readyz
port: 5008
initialDelaySeconds: 5
periodSeconds: 10
timeoutSeconds: 3
failureThreshold: 3
livenessProbe:
httpGet:
path: /healthz
port: 5008
initialDelaySeconds: 15
periodSeconds: 20
timeoutSeconds: 3
failureThreshold: 3
+36
View File
@@ -0,0 +1,36 @@
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: step3-api
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: step3-api
minReplicas: 2
maxReplicas: 10
behavior:
scaleUp:
stabilizationWindowSeconds: 0
policies:
- type: Percent
value: 100
periodSeconds: 60
- type: Pods
value: 2
periodSeconds: 60
selectPolicy: Max
scaleDown:
stabilizationWindowSeconds: 300
policies:
- type: Percent
value: 25
periodSeconds: 60
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 60
+10
View File
@@ -0,0 +1,10 @@
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: step3-api
spec:
minAvailable: 1
selector:
matchLabels:
app: step3-api
+14
View File
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: step3-api
spec:
selector:
app: step3-api
type: NodePort
ports:
- name: http
port: 80
targetPort: 5008
nodePort: 30088
+9
View File
@@ -0,0 +1,9 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- api-deployment.yaml
- api-service.yaml
- api-hpa.yaml
- api-pdb.yaml
- web-deployment.yaml
- web-service.yaml
+47
View File
@@ -0,0 +1,47 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: step3-web
spec:
replicas: 2
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 0
maxSurge: 1
selector:
matchLabels:
app: step3-web
template:
metadata:
labels:
app: step3-web
spec:
containers:
- name: web
image: step3-web:latest
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
resources:
requests:
cpu: 50m
memory: 64Mi
limits:
cpu: 250m
memory: 128Mi
readinessProbe:
httpGet:
path: /healthz
port: 8080
initialDelaySeconds: 3
periodSeconds: 10
timeoutSeconds: 2
livenessProbe:
httpGet:
path: /healthz
port: 8080
initialDelaySeconds: 10
periodSeconds: 20
timeoutSeconds: 2
+14
View File
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: step3-web
spec:
selector:
app: step3-web
type: NodePort
ports:
- name: http
port: 80
targetPort: 8080
nodePort: 30089
+11
View File
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: step3-api
spec:
ports:
- name: http
port: 80
targetPort: 5008
nodePort: 30090
+31
View File
@@ -0,0 +1,31 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: step3-prd
resources:
- ../../base
- namespace.yaml
patches:
- path: api-service-port.yaml
- path: web-service-port.yaml
commonLabels:
app.kubernetes.io/part-of: ranaze-step3
app.kubernetes.io/environment: production
configMapGenerator:
- name: step3-runtime-config
literals:
- Deployment__Environment=production
- MongoDB__DatabaseName=ranaze_step3_prd
- Jwt__Issuer=ranaze-step3-prd
- Jwt__Audience=ranaze-step3-prd
- PasswordReset__Enabled=false
- Steam__Realm=https://s3q.ranaze.com
- Steam__ReturnUrl=https://s3q.ranaze.com/api/Auth/steam/callback
- Legal__TermsVersion=2026-07-20
- Legal__PrivacyVersion=2026-07-20
- Legal__EffectiveUtc=2026-07-20T00:00:00Z
- Legal__TermsUrl=https://step3.ranaze.com/terms.html
- Legal__PrivacyUrl=https://step3.ranaze.com/privacy.html
- Stripe__SuccessUrl=https://step3.ranaze.com/donation-complete.html?session_id={CHECKOUT_SESSION_ID}
- Stripe__CancelUrl=https://step3.ranaze.com/donation-canceled.html
generatorOptions:
disableNameSuffixHash: true
+5
View File
@@ -0,0 +1,5 @@
apiVersion: v1
kind: Namespace
metadata:
name: step3-prd
+11
View File
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: step3-web
spec:
ports:
- name: http
port: 80
targetPort: 8080
nodePort: 30091
+29
View File
@@ -0,0 +1,29 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: step3-uat
resources:
- ../../base
- namespace.yaml
commonLabels:
app.kubernetes.io/part-of: ranaze-step3
app.kubernetes.io/environment: uat
configMapGenerator:
- name: step3-runtime-config
literals:
- Deployment__Environment=uat
- MongoDB__DatabaseName=ranaze_step3_uat
- Jwt__Issuer=ranaze-step3-uat
- Jwt__Audience=ranaze-step3-uat
- PasswordReset__Enabled=false
- Steam__Realm=https://us3q.ranaze.com
- Steam__ReturnUrl=https://us3q.ranaze.com/api/Auth/steam/callback
- Legal__TermsVersion=2026-07-20
- Legal__PrivacyVersion=2026-07-20
- Legal__EffectiveUtc=2026-07-20T00:00:00Z
- Legal__TermsUrl=https://ustep3.ranaze.com/terms.html
- Legal__PrivacyUrl=https://ustep3.ranaze.com/privacy.html
- Stripe__SuccessUrl=https://ustep3.ranaze.com/donation-complete.html?session_id={CHECKOUT_SESSION_ID}
- Stripe__CancelUrl=https://ustep3.ranaze.com/donation-canceled.html
generatorOptions:
disableNameSuffixHash: true
+5
View File
@@ -0,0 +1,5 @@
apiVersion: v1
kind: Namespace
metadata:
name: step3-uat