apiVersion: v1
kind: Namespace
metadata:
  name: dbgate
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: dbgate-data
  namespace: dbgate
data:
  # Aggiungere qui i file di configurazione iniziali di dbgate (es. connections.yaml)
  # I file verranno montati in /root/.dbgate nel container.
  # Esempio:
  # connections.yaml: |
  #   - id: con1
  #     engine: mysql@dbgate-plugin-mysql
  #     ...
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: dbgate
  namespace: dbgate

spec:
  replicas: 1

  selector:
    matchLabels:
      app: dbgate

  template:
    metadata:
      labels:
        app: dbgate

    spec:
      containers:
        - name: dbgate
          image: dbgate/dbgate:latest

          ports:
            - containerPort: 3000

          env:
            - name: CONNECTIONS
              value: ""

          volumeMounts:
            - name: dbgate-data
              mountPath: /root/.dbgate

          resources:
            requests:
              cpu: "100m"
              memory: "128Mi"

            limits:
              cpu: "500m"
              memory: "512Mi"

      volumes:
        - name: dbgate-data
          configMap:
            name: dbgate-data
---
apiVersion: v1
kind: Service
metadata:
  name: dbgate
  namespace: dbgate

spec:
  selector:
    app: dbgate

  ports:
    - port: 80
      targetPort: 3000

  type: ClusterIP			  