cdh-dev 2Gi 3Gi min:0.1 max:0.5
cdh-prod 4Gi 5Gi min:1 max:2
apiVersion: v1
kind: Namespace
metadata:
  name: cdh-dev
apiVersion: v1
kind: ResourceQuota
metadata:
  name: rq-1
  namespace: cdh-dev
spec:
  hard:
    requests.memory: 2Gi
    limits.memory: 3Gi
apiVersion: v1
kind: LimitRange
metadata:
  name: lr-1
  namespace: nm-3
spec:
  limits:
  - type: Container
    min:
      memory: 0.1Gi
    max:
      memory: 0.5Gi
    maxLimitRequestRatio:
      memory: 3
    defaultRequest:
      memory: 0.1Gi
    default:
      memory: 0.2Gi
apiVersion: v1
kind: Service
metadata:
  name: db-svc
spec:
  selector:
    type: db
  ports:
  - port: 3306
    targetPort: 3306
apiVersion: v1
kind: ConfigMap
metadata:
  name: db-cm
data:
  MYSQL_ROOT_PASSWORD: "qwer1234"
apiVersion: v1
kind: Pod
metadata:
  name: db-pod
  labels:
    type: db
spec:
  containers:
  - name: container
    image: mysql:8.0.32-debian
    resources:
      limits:
        memory: "0.5Gi"
      requests:
        memory: "0.4Gi"
    envFrom:
    - configMapRef:
        name: db-cm
apiVersion: v1
kind: Service
metadata:
  name: backend-svc
spec:
  selector:
    type: backend
  ports:
  - port: 8000
    targetPort: 8000
apiVersion: v1
kind: ConfigMap
metadata:
  name: backend-cm
data:
  DBNAME: "web"
  DBUSER: "root"
  DBPASS: "qwer1234"
  DBHOST: "db-svc"
  DBPORT: "3306"
apiVersion: v1
kind: Pod
metadata:
  name: backend-pod
  labels:
    type: backend
spec:
  containers:
  - name: container
    image: ddarahakit2023/back:1.0
    command: ["/bin/sh", "-ec", "python manage.py migrate && gunicorn config.wsgi --bind 0.0.0.0:8000"]
    resources:
      limits:
        memory: "0.5Gi"
      requests:
        memory: "0.4Gi"
    envFrom:
    - configMapRef:
        name: backend-cm
apiVersion: v1
kind: Service
metadata:
  name: frontend-svc
spec:
  selector:
    type: frontend
  ports:
  - port: 80
    targetPort: 80
  type: LoadBalancer
apiVersion: v1
kind: ConfigMap
metadata:
  name: frontend-cm
data:
  BACKEND_SVC_NAME: "backend-svc"
apiVersion: v1
kind: Pod
metadata:
  name: frontend-pod
  labels:
    type: frontend
spec:
  containers:
  - name: container
    image: cis07385/front:1.1
    command: ["/bin/sh", "-ec", "envsubst '$BACKEND_SVC_NAME' < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"]
    resources:
      limits:
        memory: "0.5Gi"
      requests:
        memory: "0.4Gi"
    envFrom:
    - configMapRef:
        name: frontend-cm
apiVersion: v1
kind: Namespace
metadata:
  name: cdh-prod
apiVersion: v1
kind: ResourceQuota
metadata:
  name: rq-1
  namespace: cdh-prod
spec:
  hard:
    requests.memory: 4Gi
    limits.memory: 5Gi