diff --git a/deploy/base/deployment.yaml b/deploy/base/deployment.yaml deleted file mode 100644 index 53a18c6..0000000 --- a/deploy/base/deployment.yaml +++ /dev/null @@ -1,83 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: wynnsource-server - annotations: - argocd.argoproj.io/sync-wave: "2" -spec: - replicas: 1 - selector: - matchLabels: - app: wynnsource-server - strategy: - type: RollingUpdate - template: - metadata: - labels: - app: wynnsource-server - spec: - securityContext: - runAsNonRoot: true - containers: - - name: server - image: ghcr.io/wynnsource/wynnsource-server:placeholder - ports: - - containerPort: 8000 - name: http - envFrom: - - configMapRef: - name: wynnsource-config - - secretRef: - name: wynnsource-secrets - env: - - name: POSTGRES_HOST - valueFrom: - secretKeyRef: - name: wynnsource-pg-app - key: host - - name: POSTGRES_PORT - valueFrom: - secretKeyRef: - name: wynnsource-pg-app - key: port - - name: POSTGRES_USER - valueFrom: - secretKeyRef: - name: wynnsource-pg-app - key: user - - name: POSTGRES_PASSWORD - valueFrom: - secretKeyRef: - name: wynnsource-pg-app - key: password - - name: POSTGRES_DB - valueFrom: - secretKeyRef: - name: wynnsource-pg-app - key: dbname - - name: REDIS_HOST - value: wynnsource-redis - - name: REDIS_PORT - value: "6379" - - name: WCS_SENTRY_DSN - valueFrom: - secretKeyRef: - name: wynnsource-secrets - key: sentry-dsn - optional: true - livenessProbe: - httpGet: { path: /healthz, port: 8000 } - initialDelaySeconds: 10 - periodSeconds: 15 - readinessProbe: - httpGet: { path: /readyz, port: 8000 } - initialDelaySeconds: 5 - periodSeconds: 10 - startupProbe: - httpGet: { path: /healthz, port: 8000 } - initialDelaySeconds: 3 - periodSeconds: 5 - failureThreshold: 10 - resources: - requests: { cpu: 100m, memory: 256Mi } - limits: { cpu: 1000m, memory: 1024Mi } diff --git a/deploy/base/kustomization.yaml b/deploy/base/kustomization.yaml deleted file mode 100644 index 6ec5fc4..0000000 --- a/deploy/base/kustomization.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: - - postgres.yaml - - redis.yaml - - migration-job.yaml - - deployment.yaml - - service.yaml diff --git a/deploy/base/migration-job.yaml b/deploy/base/migration-job.yaml deleted file mode 100644 index f6cafac..0000000 --- a/deploy/base/migration-job.yaml +++ /dev/null @@ -1,46 +0,0 @@ -apiVersion: batch/v1 -kind: Job -metadata: - name: wynnsource-migration - annotations: - argocd.argoproj.io/hook: Sync - argocd.argoproj.io/hook-delete-policy: BeforeHookCreation - argocd.argoproj.io/sync-wave: "1" -spec: - backoffLimit: 3 - template: - spec: - containers: - - name: migration - image: ghcr.io/wynnsource/wynnsource-server:placeholder - command: ["uv", "run", "--no-dev", "alembic", "upgrade", "head"] - envFrom: - - secretRef: - name: wynnsource-secrets - env: - - name: POSTGRES_HOST - valueFrom: - secretKeyRef: - name: wynnsource-pg-app - key: host - - name: POSTGRES_PORT - valueFrom: - secretKeyRef: - name: wynnsource-pg-app - key: port - - name: POSTGRES_USER - valueFrom: - secretKeyRef: - name: wynnsource-pg-app - key: user - - name: POSTGRES_PASSWORD - valueFrom: - secretKeyRef: - name: wynnsource-pg-app - key: password - - name: POSTGRES_DB - valueFrom: - secretKeyRef: - name: wynnsource-pg-app - key: dbname - restartPolicy: OnFailure diff --git a/deploy/base/postgres.yaml b/deploy/base/postgres.yaml deleted file mode 100644 index 2709640..0000000 --- a/deploy/base/postgres.yaml +++ /dev/null @@ -1,36 +0,0 @@ -apiVersion: postgresql.cnpg.io/v1 -kind: Cluster -metadata: - name: wynnsource-pg - annotations: - argocd.argoproj.io/sync-wave: "0" -spec: - instances: 1 - resources: - requests: - cpu: 50m - memory: 256Mi - storage: - size: 5Gi - storageClass: longhorn - postgresql: - parameters: - max_connections: "100" - bootstrap: - initdb: - database: wcs_db - owner: wynnsource - backup: - volumeSnapshot: - className: longhorn-snapshot ---- -apiVersion: postgresql.cnpg.io/v1 -kind: ScheduledBackup -metadata: - name: wynnsource-pg-daily -spec: - schedule: "0 15 3 * * *" - backupOwnerReference: self - cluster: - name: wynnsource-pg - method: volumeSnapshot diff --git a/deploy/base/redis.yaml b/deploy/base/redis.yaml deleted file mode 100644 index cee2880..0000000 --- a/deploy/base/redis.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: redis.redis.opstreelabs.in/v1beta2 -kind: Redis -metadata: - name: wynnsource-redis - annotations: - argocd.argoproj.io/sync-wave: "0" -spec: - kubernetesConfig: - image: redis:7-alpine - resources: - requests: { cpu: 50m, memory: 64Mi } - limits: { cpu: 200m, memory: 128Mi } - storage: - volumeClaimTemplate: - spec: - accessModes: ["ReadWriteOnce"] - resources: - requests: - storage: 1Gi diff --git a/deploy/base/service.yaml b/deploy/base/service.yaml deleted file mode 100644 index 918f800..0000000 --- a/deploy/base/service.yaml +++ /dev/null @@ -1,17 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: wynnsource-server - annotations: - argocd.argoproj.io/sync-wave: "2" - labels: - app: wynnsource-server -spec: - type: ClusterIP - selector: - app: wynnsource-server - ports: - - port: 8000 - targetPort: http - protocol: TCP - name: http diff --git a/deploy/chart/templates/deployment.yaml b/deploy/chart/templates/deployment.yaml index 860c794..0919cd1 100644 --- a/deploy/chart/templates/deployment.yaml +++ b/deploy/chart/templates/deployment.yaml @@ -5,6 +5,8 @@ metadata: annotations: argocd.argoproj.io/sync-wave: "2" spec: + # Old ReplicaSets kept for rollback; the k8s default of 10 is noise. + revisionHistoryLimit: {{ .Values.revisionHistoryLimit }} replicas: {{ .Values.replicaCount }} selector: # Immutable on the pre-chart deployment; never change this. diff --git a/deploy/chart/values.yaml b/deploy/chart/values.yaml index 16c713d..7c4af44 100644 --- a/deploy/chart/values.yaml +++ b/deploy/chart/values.yaml @@ -8,6 +8,9 @@ image: replicaCount: 1 +# Old ReplicaSets retained for rollback (Deployment default is 10). +revisionHistoryLimit: 3 + # Rendered into the wynnsource-config ConfigMap, consumed via envFrom. # A change here rolls the deployment (checksum annotation). config: diff --git a/deploy/overlays/dev/kustomization.yaml b/deploy/overlays/dev/kustomization.yaml deleted file mode 100644 index 194e18a..0000000 --- a/deploy/overlays/dev/kustomization.yaml +++ /dev/null @@ -1,37 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -namespace: wynnsource-dev -resources: - - ../../base -images: - - name: ghcr.io/wynnsource/wynnsource-server - newTag: dev-latest -labels: - - pairs: - app.kubernetes.io/instance: wynnsource-dev - includeSelectors: false -patches: - - target: - kind: Deployment - name: wynnsource-server - patch: | - - op: add - path: /spec/template/spec/containers/0/env/- - value: - name: WCS_VERSION_SUFFIX - value: "-beta" - - op: add - path: /spec/template/spec/containers/0/env/- - value: - name: WCS_SENTRY_ENVIRONMENT - value: development - - op: add - path: /spec/template/spec/containers/0/env/- - value: - name: WCS_SENTRY_TRACES_SAMPLE_RATE - value: "0.5" - - op: add - path: /spec/template/spec/containers/0/env/- - value: - name: WCS_SENTRY_PROFILES_SAMPLE_RATE - value: "0.5" diff --git a/deploy/overlays/prod/kustomization.yaml b/deploy/overlays/prod/kustomization.yaml deleted file mode 100644 index 0f46406..0000000 --- a/deploy/overlays/prod/kustomization.yaml +++ /dev/null @@ -1,35 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -namespace: wynnsource -resources: - - ../../base -images: - - name: ghcr.io/wynnsource/wynnsource-server - newTag: latest -labels: - - pairs: - app.kubernetes.io/instance: wynnsource-prod - includeSelectors: false -patches: - - target: - kind: Deployment - name: wynnsource-server - patch: | - - op: replace - path: /spec/replicas - value: 2 - - op: add - path: /spec/template/spec/containers/0/env/- - value: - name: WCS_SENTRY_ENVIRONMENT - value: production - - op: add - path: /spec/template/spec/containers/0/env/- - value: - name: WCS_SENTRY_TRACES_SAMPLE_RATE - value: "0.1" - - op: add - path: /spec/template/spec/containers/0/env/- - value: - name: WCS_SENTRY_PROFILES_SAMPLE_RATE - value: "0.1"