mirror of
https://github.com/ghndrx/k8s-game-2048.git
synced 2026-02-10 06:45:07 +00:00
Initial commit: 2048 game with Knative and Kourier deployment
- Complete 2048 game implementation with responsive design - Knative Serving manifests for dev/staging/prod environments - Scale-to-zero configuration with environment-specific settings - Custom domain mapping for wa.darknex.us subdomains - GitHub Actions workflows for CI/CD - Docker container with nginx and health checks - Setup scripts for Knative and Kourier installation - GHCR integration for container registry
This commit is contained in:
13
manifests/dev/domain-mapping.yml
Normal file
13
manifests/dev/domain-mapping.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
apiVersion: serving.knative.dev/v1alpha1
|
||||
kind: DomainMapping
|
||||
metadata:
|
||||
name: 2048-dev.wa.darknex.us
|
||||
namespace: game-2048-dev
|
||||
labels:
|
||||
app: game-2048
|
||||
environment: development
|
||||
spec:
|
||||
ref:
|
||||
name: game-2048-dev
|
||||
kind: Service
|
||||
apiVersion: serving.knative.dev/v1
|
||||
7
manifests/dev/namespace.yml
Normal file
7
manifests/dev/namespace.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: game-2048-dev
|
||||
labels:
|
||||
environment: development
|
||||
app: game-2048
|
||||
60
manifests/dev/service.yml
Normal file
60
manifests/dev/service.yml
Normal file
@@ -0,0 +1,60 @@
|
||||
apiVersion: serving.knative.dev/v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: game-2048-dev
|
||||
namespace: game-2048-dev
|
||||
labels:
|
||||
app: game-2048
|
||||
environment: development
|
||||
annotations:
|
||||
# Scale to zero configuration
|
||||
autoscaling.knative.dev/minScale: "0"
|
||||
autoscaling.knative.dev/maxScale: "10"
|
||||
# Scale down to zero after 30 seconds of no traffic
|
||||
autoscaling.knative.dev/scaleDownDelay: "30s"
|
||||
# Target concurrency per pod
|
||||
autoscaling.knative.dev/target: "100"
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: game-2048
|
||||
environment: development
|
||||
annotations:
|
||||
# Scale to zero configuration
|
||||
autoscaling.knative.dev/minScale: "0"
|
||||
autoscaling.knative.dev/maxScale: "10"
|
||||
autoscaling.knative.dev/scaleDownDelay: "30s"
|
||||
autoscaling.knative.dev/target: "100"
|
||||
spec:
|
||||
containers:
|
||||
- name: game-2048
|
||||
image: ghcr.io/ghndrx/k8s-game-2048:latest
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
protocol: TCP
|
||||
env:
|
||||
- name: ENVIRONMENT
|
||||
value: "development"
|
||||
resources:
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 128Mi
|
||||
limits:
|
||||
cpu: 500m
|
||||
memory: 256Mi
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: 8080
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 10
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: 8080
|
||||
initialDelaySeconds: 15
|
||||
periodSeconds: 20
|
||||
traffic:
|
||||
- percent: 100
|
||||
latestRevision: true
|
||||
13
manifests/prod/domain-mapping.yml
Normal file
13
manifests/prod/domain-mapping.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
apiVersion: serving.knative.dev/v1alpha1
|
||||
kind: DomainMapping
|
||||
metadata:
|
||||
name: 2048.wa.darknex.us
|
||||
namespace: game-2048-prod
|
||||
labels:
|
||||
app: game-2048
|
||||
environment: production
|
||||
spec:
|
||||
ref:
|
||||
name: game-2048-prod
|
||||
kind: Service
|
||||
apiVersion: serving.knative.dev/v1
|
||||
7
manifests/prod/namespace.yml
Normal file
7
manifests/prod/namespace.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: game-2048-prod
|
||||
labels:
|
||||
environment: production
|
||||
app: game-2048
|
||||
60
manifests/prod/service.yml
Normal file
60
manifests/prod/service.yml
Normal file
@@ -0,0 +1,60 @@
|
||||
apiVersion: serving.knative.dev/v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: game-2048-prod
|
||||
namespace: game-2048-prod
|
||||
labels:
|
||||
app: game-2048
|
||||
environment: production
|
||||
annotations:
|
||||
# Scale to zero configuration
|
||||
autoscaling.knative.dev/minScale: "0"
|
||||
autoscaling.knative.dev/maxScale: "50"
|
||||
# Scale down to zero after 5 minutes of no traffic (longer for production)
|
||||
autoscaling.knative.dev/scaleDownDelay: "300s"
|
||||
# Target concurrency per pod
|
||||
autoscaling.knative.dev/target: "100"
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: game-2048
|
||||
environment: production
|
||||
annotations:
|
||||
# Scale to zero configuration
|
||||
autoscaling.knative.dev/minScale: "0"
|
||||
autoscaling.knative.dev/maxScale: "50"
|
||||
autoscaling.knative.dev/scaleDownDelay: "300s"
|
||||
autoscaling.knative.dev/target: "100"
|
||||
spec:
|
||||
containers:
|
||||
- name: game-2048
|
||||
image: ghcr.io/ghndrx/k8s-game-2048:v1.0.0
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
protocol: TCP
|
||||
env:
|
||||
- name: ENVIRONMENT
|
||||
value: "production"
|
||||
resources:
|
||||
requests:
|
||||
cpu: 500m
|
||||
memory: 512Mi
|
||||
limits:
|
||||
cpu: 2000m
|
||||
memory: 1Gi
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: 8080
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 10
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: 8080
|
||||
initialDelaySeconds: 15
|
||||
periodSeconds: 20
|
||||
traffic:
|
||||
- percent: 100
|
||||
latestRevision: true
|
||||
13
manifests/staging/domain-mapping.yml
Normal file
13
manifests/staging/domain-mapping.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
apiVersion: serving.knative.dev/v1alpha1
|
||||
kind: DomainMapping
|
||||
metadata:
|
||||
name: 2048-staging.wa.darknex.us
|
||||
namespace: game-2048-staging
|
||||
labels:
|
||||
app: game-2048
|
||||
environment: staging
|
||||
spec:
|
||||
ref:
|
||||
name: game-2048-staging
|
||||
kind: Service
|
||||
apiVersion: serving.knative.dev/v1
|
||||
7
manifests/staging/namespace.yml
Normal file
7
manifests/staging/namespace.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: game-2048-staging
|
||||
labels:
|
||||
environment: staging
|
||||
app: game-2048
|
||||
60
manifests/staging/service.yml
Normal file
60
manifests/staging/service.yml
Normal file
@@ -0,0 +1,60 @@
|
||||
apiVersion: serving.knative.dev/v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: game-2048-staging
|
||||
namespace: game-2048-staging
|
||||
labels:
|
||||
app: game-2048
|
||||
environment: staging
|
||||
annotations:
|
||||
# Scale to zero configuration
|
||||
autoscaling.knative.dev/minScale: "0"
|
||||
autoscaling.knative.dev/maxScale: "20"
|
||||
# Scale down to zero after 60 seconds of no traffic (longer for staging)
|
||||
autoscaling.knative.dev/scaleDownDelay: "60s"
|
||||
# Target concurrency per pod
|
||||
autoscaling.knative.dev/target: "100"
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: game-2048
|
||||
environment: staging
|
||||
annotations:
|
||||
# Scale to zero configuration
|
||||
autoscaling.knative.dev/minScale: "0"
|
||||
autoscaling.knative.dev/maxScale: "20"
|
||||
autoscaling.knative.dev/scaleDownDelay: "60s"
|
||||
autoscaling.knative.dev/target: "100"
|
||||
spec:
|
||||
containers:
|
||||
- name: game-2048
|
||||
image: ghcr.io/ghndrx/k8s-game-2048:staging
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
protocol: TCP
|
||||
env:
|
||||
- name: ENVIRONMENT
|
||||
value: "staging"
|
||||
resources:
|
||||
requests:
|
||||
cpu: 200m
|
||||
memory: 256Mi
|
||||
limits:
|
||||
cpu: 1000m
|
||||
memory: 512Mi
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: 8080
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 10
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: 8080
|
||||
initialDelaySeconds: 15
|
||||
periodSeconds: 20
|
||||
traffic:
|
||||
- percent: 100
|
||||
latestRevision: true
|
||||
Reference in New Issue
Block a user