
apiVersion: apps/v1
kind: Deployment
metadata:
  name: clinic
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: clinic
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: clinic
    spec:
      containers:
      - image: clinic:feat-5a0d22b8d413308a28e3964536f4733942e194e5
        imagePullPolicy: IfNotPresent
        name: clinic
        resources:
          limits:
            cpu: 500m
            memory: 512Mi
          requests:
            cpu: 100m
            memory: 128Mi
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /etc/clinic
          name: clinic-config
          readOnly: true
        - mountPath: /etc/key
          name: clinic-key
          readOnly: true
        - mountPath: /dashboards/endpoints.yaml
          name: grafana-endpoints
          readOnly: true
          subPath: endpoints.yaml
        - mountPath: /dashboards/dashboard-internal
          name: dashboard-internal
          readOnly: true
        - mountPath: /dashboards/dashboard-external
          name: dashboard-external
          readOnly: true
        - mountPath: /prompt
          name: clinic-prompt
          readOnly: true
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      serviceAccount: clinic
      serviceAccountName: clinic
      terminationGracePeriodSeconds: 30
      volumes:
      - configMap:
          defaultMode: 420
          name: clinic-config
        name: clinic-config
      - configMap:
          defaultMode: 420
          name: clinic-grafana-endpoints
        name: grafana-endpoints
      - name: clinic-key
        secret:
          defaultMode: 420
          secretName: clinic-key
      - configMap:
          defaultMode: 420
          name: dashboard-internal
        name: dashboard-internal
      - configMap:
          defaultMode: 420
          name: dashboard-external
        name: dashboard-external
      - configMap:
          defaultMode: 420
          name: clinic-prompt
        name: clinic-prompt
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: clinic-grafana7
  name: clinic-grafana7
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: clinic-grafana7
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: clinic-grafana7
    spec:
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - podAffinityTerm:
              labelSelector:
                matchLabels:
                  app: clinic
              topologyKey: kubernetes.io/hostname
            weight: 100
      containers:
      - env:
        - name: NAMESPACE
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: metadata.namespace
        - name: GF_INSTALL_PLUGINS
          value: yesoreyeram-infinity-datasource,marcusolsson-dynamictext-panel
        - name: GF_SERVER_ENABLE_GZIP
          value: "true"
        - name: GF_SERVER_ROOT_URL
          value: https://clinic.pingcap.com/grafana
        image: grafana:clinic-external
        imagePullPolicy: Always
        livenessProbe:
          failureThreshold: 3
          initialDelaySeconds: 30
          periodSeconds: 10
          successThreshold: 1
          tcpSocket:
            port: 3000
          timeoutSeconds: 1
        name: grafana
        ports:
        - containerPort: 3000
          name: http-grafana
          protocol: TCP
        readinessProbe:
          failureThreshold: 3
          httpGet:
            path: /robots.txt
            port: 3000
            scheme: HTTP
          initialDelaySeconds: 10
          periodSeconds: 30
          successThreshold: 1
          timeoutSeconds: 2
        resources:
          limits:
            cpu: 1500m
            memory: 4Gi
          requests:
            cpu: 1500m
            memory: 4Gi
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /var/lib/grafana
          name: grafana-pv
        - mountPath: /etc/grafana/provisioning/datasources
          name: grafana-provisioning-datasource
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext:
        fsGroup: 472
        supplementalGroups:
        - 0
      serviceAccount: clinic-grafana7
      serviceAccountName: clinic-grafana7
      terminationGracePeriodSeconds: 30
      volumes:
      - emptyDir: {}
        name: grafana-pv
      - configMap:
          defaultMode: 420
          name: clinic-grafana7-provisioning-datasource
        name: grafana-provisioning-datasource
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: clinic-grafana9
  name: clinic-grafana9
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: clinic-grafana9
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: clinic-grafana9
    spec:
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - podAffinityTerm:
              labelSelector:
                matchLabels:
                  app: clinic
              topologyKey: kubernetes.io/hostname
            weight: 100
      containers:
      - env:
        - name: NAMESPACE
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: metadata.namespace
        - name: GF_INSTALL_PLUGINS
          value: yesoreyeram-infinity-datasource,marcusolsson-dynamictext-panel
        - name: GF_SERVER_ENABLE_GZIP
          value: "true"
        - name: GF_SERVER_ROOT_URL
          value: https://clinic.pingcap.com/grafana
        - name: GF_DATABASE_TYPE
          value: mysql
        - name: GF_DATABASE_HOST
          value: mysql-clinic.cdllqpdubujz.us-west-2.rds.amazonaws.com:3306
        - name: GF_DATABASE_NAME
          value: clinic-grafana9
        - name: GF_DATABASE_USER
          value: root
        - name: GF_DATABASE_PASSWORD
          valueFrom:
            secretKeyRef:
              name: clinic-grafana9-secret
              key: GF_DATABASE_PASSWORD
        envFrom:
          - secretRef:
              name: clinic-grafana9-secret
        image: grafana:clinic-internal
        imagePullPolicy: Always
        livenessProbe:
          failureThreshold: 3
          initialDelaySeconds: 30
          periodSeconds: 10
          successThreshold: 1
          tcpSocket:
            port: 3000
          timeoutSeconds: 1
        name: grafana
        ports:
        - containerPort: 3000
          name: http-grafana
          protocol: TCP
        readinessProbe:
          failureThreshold: 3
          httpGet:
            path: /robots.txt
            port: 3000
            scheme: HTTP
          initialDelaySeconds: 10
          periodSeconds: 30
          successThreshold: 1
          timeoutSeconds: 2
        resources:
          limits:
            cpu: 1500m
            memory: 4Gi
          requests:
            cpu: 1500m
            memory: 4Gi
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /var/lib/grafana
          name: grafana-pv
        - mountPath: /etc/grafana/provisioning/datasources
          name: grafana-provisioning-datasource
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext:
        fsGroup: 472
        supplementalGroups:
        - 0
      serviceAccount: clinic-grafana9
      serviceAccountName: clinic-grafana9
      terminationGracePeriodSeconds: 30
      volumes:
      - emptyDir: {}
        name: grafana-pv
      - configMap:
          name: clinic-grafana9-provisioning-datasource
        name: grafana-provisioning-datasource
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: clinic-internal-api
  name: clinic-internal-api
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: clinic-internal-api
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: clinic-internal-api
    spec:
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - podAffinityTerm:
              labelSelector:
                matchLabels:
                  app: clinic
              topologyKey: kubernetes.io/hostname
            weight: 100
      containers:
      - args:
        - -c
        - /etc/clinic/config.yaml
        command:
        - /internal_server
        image: internal_api:master-54ca9bca119d88c4478366357eb031e5ecfddd01
        imagePullPolicy: IfNotPresent
        name: clinic-internal-api
        ports:
        - containerPort: 8085
          protocol: TCP
        resources:
          limits:
            cpu: 100m
            memory: 1Gi
          requests:
            cpu: 100m
            memory: 128Mi
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /etc/clinic
          name: config
          readOnly: true
        - mountPath: /etc/key
          name: clinic-key
          readOnly: true
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      serviceAccount: clinic
      serviceAccountName: clinic
      terminationGracePeriodSeconds: 30
      volumes:
      - configMap:
          defaultMode: 420
          name: clinic-config
        name: config
      - name: clinic-key
        secret:
          defaultMode: 420
          secretName: clinic-key
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: clinic-taskmanager
  name: clinic-taskmanager-deployment
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: clinic-taskmanager
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: clinic-taskmanager
    spec:
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - podAffinityTerm:
              labelSelector:
                matchLabels:
                  app: clinic
              topologyKey: kubernetes.io/hostname
            weight: 100
      containers:
      - env:
        - name: IMPORTER_CONFIGMAP_NAME
          value: clinic-config
        image: task_manager:master-67a1e204b2a545b547f3cb99fbfdaf8269f3180b
        imagePullPolicy: IfNotPresent
        name: clinic-taskmanager
        ports:
        - containerPort: 8080
          protocol: TCP
        resources:
          limits:
            cpu: 500m
            memory: 1Gi
          requests:
            cpu: 100m
            memory: 128Mi
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /config
          name: config
          readOnly: true
        - mountPath: /dashboards/dashboard-internal
          name: dashboard-internal
          readOnly: true
        - mountPath: /dashboards/dashboard-external
          name: dashboard-external
          readOnly: true
        - mountPath: /dashboards/endpoints.yaml
          name: grafana-endpoints
          readOnly: true
          subPath: endpoints.yaml
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      serviceAccount: clinic
      serviceAccountName: clinic
      terminationGracePeriodSeconds: 30
      volumes:
      - configMap:
          defaultMode: 420
          name: clinic-config
        name: config
      - configMap:
          defaultMode: 420
          name: dashboard-internal
        name: dashboard-internal
      - configMap:
          defaultMode: 420
          name: dashboard-external
        name: dashboard-external
      - configMap:
          defaultMode: 420
          name: clinic-grafana-endpoints
        name: grafana-endpoints
