apiVersion: v1
kind: ConfigMap
metadata:
  name: backend-dotnet-config
  namespace: python-navigator-demo
data:
  DB_HOST: postgres
  DB_PORT: "5432"
  DB_NAME: python-navigator-demo
  DB_USER: python-navigator-demo
  DEX_ISSUER: https://dex.127.0.0.1.sslip.io/
---
apiVersion: v1
kind: Secret
metadata:
  name: backend-dotnet-secret
  namespace: python-navigator-demo
type: Opaque
stringData:
  DB_PASSWORD: python-navigator-demo
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: backend-dotnet
  namespace: python-navigator-demo
spec:
  selector:
    matchLabels:
      app: backend-dotnet
  template:
    metadata:
      labels:
        app: backend-dotnet
    spec:
      containers:
      - name: backend-dotnet
        image: python-navigator-demo-backend-dotnet:latest
        imagePullPolicy: Never  # Для локальной разработки
        ports:
        - containerPort: 8000
        env:
        - name: ASPNETCORE_URLS
          value: "http://0.0.0.0:8000"
        # - name: ASPNETCORE_HTTP_PORTS
        #   value: "8000"
        envFrom:
        - configMapRef:
            name: backend-dotnet-config
        - secretRef:
            name: backend-dotnet-secret
        # livenessProbe:
        #   httpGet:
        #     path: /api/health
        #     port: 8000
        #   initialDelaySeconds: 10
        #   periodSeconds: 10
        # readinessProbe:
        #   httpGet:
        #     path: /api/health
        #     port: 8000
        #   initialDelaySeconds: 5
        #   periodSeconds: 5

---
apiVersion: v1
kind: Service
metadata:
  name: backend-dotnet
  namespace: python-navigator-demo
spec:
  selector:
    app: backend-dotnet
  ports:
  - port: 8000
    targetPort: 8000
  type: ClusterIP

