# Source: k8s-service/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: search-service
  labels:
    # These labels are required by helm. You can read more about required labels in the chart best practices guide:
    # https://docs.helm.sh/chart_best_practices/#standard-labels
    helm.sh/chart: k8s-service-v0.2.9
    app.kubernetes.io/name: search-service
    app.kubernetes.io/instance: search-service
    app.kubernetes.io/managed-by: Helm
    gitops.jenkins-x.io/pipeline: 'namespaces'
  annotations:
    meta.helm.sh/release-name: 'search-service'
    wave.pusher.com/update-on-config-change: 'true'
  namespace: jx-production
spec:
  replicas: 1
  strategy:
    type: RollingUpdate
  selector:
    matchLabels:
      app.kubernetes.io/name: search-service
      app.kubernetes.io/instance: search-service
      gruntwork.io/deployment-type: main
  template:
    metadata:
      labels:
        app.kubernetes.io/name: search-service
        app.kubernetes.io/instance: search-service
        gruntwork.io/deployment-type: main
    spec:
      containers:
        - name: search-service
          image: "harbor.simonjamesrowe.com/simonjamesrowe/search-service:0.0.186"
          imagePullPolicy: IfNotPresent
          ports:
            - name: http
              containerPort: 8080
              protocol: TCP
          livenessProbe:
            httpGet:
              path: /actuator/health
              port: http
            initialDelaySeconds: 60
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 1
          readinessProbe:
            failureThreshold: 1
            httpGet:
              path: /actuator/health
              port: http
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 1
          resources:
            limits:
              cpu: 200m
              memory: 128Mi
            requests:
              cpu: 100m
              memory: 64Mi
          # Include a preStop hook with a shutdown delay for eventual consistency reasons.
          # See https://blog.gruntwork.io/delaying-shutdown-to-wait-for-pod-deletion-propagation-445f779a8304
          lifecycle:
            preStop:
              exec:
                command:
                  - sleep
                  - "5"
          env:
            - name: CMS_URL
              value: "http://cms/"
            - name: NAMESPACE
              value: "prod"
            - name: SERVER_PORT
              value: "8080"
            - name: SPRING_DATA_ELASTICSEARCH_CLIENT_REACTIVE_ENDPOINTS
              value: "elasticsearch-master.elastic:9200"
            - name: SPRING_ELASTICSEARCH_REST_URIS
              value: "http://elasticsearch-master.elastic:9200"
            - name: SPRING_KAFKA_BOOTSTRAP-SERVERS
              value: "cp-helm-charts-cp-kafka.kafka:9092"
            - name: SPRING_PROFILES_ACTIVE
              value: "cloud"
