---
apiVersion: "apps/v1"
kind: "Deployment"
metadata:
  name: "karavan"
spec:
  replicas: 1
  selector:
    matchLabels:
      app: "karavan"
  template:
    metadata:
      labels:
        app: "karavan"
    spec:
      containers:
      - env:
        - name: "KARAVAN_CONTAINER_STATUS_INTERVAL"
          value: "disabled"
        - name: "KARAVAN_CONTAINER_STATISTICS_INTERVAL"
          value: "disabled"
        - name: "KARAVAN_CAMEL_STATUS_INTERVAL"
          value: "3s"
        - name: "KARAVAN_DEVMODE_IMAGE"
          value: "ghcr.io/apache/camel-karavan-devmode:4.14.2"
        - name: "KARAVAN_GIT_REPOSITORY"
          valueFrom:
            secretKeyRef:
              key: "karavan.git.repository"
              name: "karavan"
        - name: "KARAVAN_GIT_USERNAME"
          valueFrom:
            secretKeyRef:
              key: "karavan.git.username"
              name: "karavan"
        - name: "KARAVAN_GIT_PASSWORD"
          valueFrom:
            secretKeyRef:
              key: "karavan.git.password"
              name: "karavan"
        - name: "KARAVAN_GIT_BRANCH"
          valueFrom:
            secretKeyRef:
              key: "karavan.git.branch"
              name: "karavan"
        - name: "KARAVAN_KEYCLOAK_URL"
          valueFrom:
            secretKeyRef:
              key: "karavan.keycloak.url"
              name: "karavan"
        - name: "KARAVAN_KEYCLOAK_REALM"
          valueFrom:
            secretKeyRef:
              key: "karavan.keycloak.realm"
              name: "karavan"
        - name: "KARAVAN_KEYCLOAK_FRONTEND_CLIENTID"
          valueFrom:
            secretKeyRef:
              key: "karavan.keycloak.frontend.clientId"
              name: "karavan"
        - name: "KARAVAN_KEYCLOAK_BACKEND_CLIENTID"
          valueFrom:
            secretKeyRef:
              key: "karavan.keycloak.backend.clientId"
              name: "karavan"
        - name: "KARAVAN_KEYCLOAK_BACKEND_SECRET"
          valueFrom:
            secretKeyRef:
              key: "karavan.keycloak.backend.secret"
              name: "karavan"
        - name: "KUBERNETES_NAMESPACE"
          valueFrom:
            fieldRef:
              apiVersion: ""
              fieldPath: "metadata.namespace"
        image: "ghcr.io/apache/camel-karavan:4.14.2"
        imagePullPolicy: "Always"
        name: "karavan"
        ports:
        - containerPort: 8080
          name: "karavan"
        resources:
          requests:
            memory: "1024Mi"
        livenessProbe:
          httpGet:
            path: /q/health/live
            port: 8080
        readinessProbe:
          httpGet:
            path: /q/health/ready
            port: 8080
        volumeMounts:
        - name: karavan-cache
          mountPath: /cache-data
      volumes:
      - name: karavan-cache
        persistentVolumeClaim:
          claimName: karavan-cache-pvc    
      serviceAccount: "karavan"
