diff --git a/Makefile b/Makefile index 8b80b7f..cb9a06b 100644 --- a/Makefile +++ b/Makefile @@ -34,8 +34,10 @@ up: install-prereqs ## Start the complete development environment @./cluster/bootstrap.sh @echo -e "$(BLUE)ℹ️ Deploying Helm releases...$(NC)" @helmfile sync - @echo -e "$(BLUE)ℹ️ Deploying dummy HTTP server...$(NC)" - @kubectl apply -f manifests/dummy-http-server.yaml + @echo -e "$(BLUE)ℹ️ Creating Velocity forwarding secret...$(NC)" + @./scripts/create-velocity-secret.sh + @echo -e "$(BLUE)ℹ️ Deploying manifests...$(NC)" + @kubectl apply -f manifests @echo -e "$(BLUE)ℹ️ Waiting for Agones CRDs...$(NC)" @./scripts/wait-for-crds.sh @echo -e "$(GREEN)✅ Grounds Development Infrastructure environment is ready!$(NC)" diff --git a/cluster/bootstrap.sh b/cluster/bootstrap.sh index 744c939..10a16b7 100755 --- a/cluster/bootstrap.sh +++ b/cluster/bootstrap.sh @@ -56,12 +56,11 @@ log_success "kubectl context set to k3d-dev" # Create namespaces log_info "Creating namespaces..." -for ns in infra databases games api; do +for ns in infra databases games api agones; do log_info "Creating namespace: ${ns}" kubectl create namespace "${ns}" --dry-run=client -o yaml | kubectl apply -f - done -log_success "Namespaces created: infra, databases, games, api" - +log_success "Namespaces created: infra, databases, games, api, agones" # Load .env file if it exists env_file="${here}/../.env" if [[ -f "${env_file}" ]]; then @@ -107,7 +106,7 @@ if [[ -n "${GHCR_USERNAME:-}" && -n "${GHCR_TOKEN:-}" ]]; then } # Create secret and patch service accounts in all namespaces - for ns in infra databases games api; do + for ns in infra databases games api agones; do log_info "Creating ghcr-pull-secret in namespace: ${ns}" kubectl create secret docker-registry ghcr-pull-secret \ --docker-server=ghcr.io \ diff --git a/helmfile.yaml b/helmfile.yaml index cfb4c0f..30c1ce1 100644 --- a/helmfile.yaml +++ b/helmfile.yaml @@ -20,7 +20,7 @@ releases: # Agones game server hosting platform - name: agones - namespace: games + namespace: agones chart: agones/agones # Use latest stable version (no version pinning for Agones) values: diff --git a/manifests/serviceaccount-velocity.yaml b/manifests/serviceaccount-velocity.yaml new file mode 100644 index 0000000..e33f9ed --- /dev/null +++ b/manifests/serviceaccount-velocity.yaml @@ -0,0 +1,48 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: velocity + namespace: games +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: list-gameservers + namespace: games +rules: + - apiGroups: + - agones.dev + resources: + - gameservers + verbs: + - get + - list + - watch +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: velocity-list-gameservers + namespace: games +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: list-gameservers +subjects: + - kind: ServiceAccount + name: velocity + namespace: games +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: velocity-agones-sdk + namespace: games +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: agones-sdk +subjects: + - kind: ServiceAccount + name: velocity + namespace: games diff --git a/scripts/create-velocity-secret.sh b/scripts/create-velocity-secret.sh new file mode 100755 index 0000000..506cc29 --- /dev/null +++ b/scripts/create-velocity-secret.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +set -euo pipefail + +here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source "${here}/common.sh" + +namespace="games" +secret_name="velocity-forwarding-secret" + +log_info "Creating ${secret_name} in namespace: ${namespace}" + +secret_value="$(head -c 32 /dev/urandom | base64 | tr -d '\n')" + +kubectl create secret generic "${secret_name}" \ + -n "${namespace}" \ + --from-literal="secret=${secret_value}" \ + --dry-run=client \ + -o yaml | kubectl apply -f - + +log_success "Secret ${secret_name} updated" diff --git a/values/agones.values.yaml b/values/agones.values.yaml index 51f0646..0724b38 100644 --- a/values/agones.values.yaml +++ b/values/agones.values.yaml @@ -12,76 +12,21 @@ agones: # Allocator service configuration allocator: - service: - http: - port: 10443 - targetPort: 8443 - grpc: - port: 10444 - targetPort: 8444 + # Disable allocator for local development + install: false # Controller configuration controller: - # Resource limits for local development - resources: - requests: - cpu: 100m # 0.1 CPU cores - memory: 256Mi # 256 MB RAM - limits: - cpu: 500m # 0.5 CPU cores - memory: 512Mi # 512 MB RAM - - # Health checks - optimized for local development - livenessProbe: - enabled: true - initialDelaySeconds: 15 - periodSeconds: 5 - timeoutSeconds: 5 - failureThreshold: 3 - successThreshold: 1 - - readinessProbe: - enabled: true - initialDelaySeconds: 3 - periodSeconds: 5 - timeoutSeconds: 5 - failureThreshold: 3 - successThreshold: 1 - -# Disable metrics and monitoring for local development -metrics: - serviceMonitor: - enabled: false - # Disable Prometheus metrics - enabled: false - -# Disable allocation service for local development -allocation: - enabled: false - -# Disable autoscaler for local development -autoscaler: - enabled: false - -# Disable fleet allocation for local development -fleetAllocation: - enabled: false - -# Disable webhook for local development -webhook: - enabled: false + replicas: 1 # Single replica for local development -# Disable allocation service for local development -allocationService: - enabled: false + # Extensions configuration + extensions: + replicas: 1 # Single replica for local development -# Network policy (disabled for local development) -networkPolicy: - enabled: false + # Service Accounts configuration + serviceAccounts: + sdk: + name: agones-sdk -# Service configuration -service: - type: ClusterIP - ports: - http: 80 - https: 443 +gameservers: + namespaces: [ games ]