apiVersion: apps/v1
kind: Deployment
metadata:
  name: k8s-sample-app-rspec
  labels:
    k8s-app: k8s-sample-app-rspec
spec:
  replicas: 1
  revisionHistoryLimit: 0
  selector:
    matchLabels:
      k8s-app: k8s-sample-app-rspec
  strategy:
    type: RollingUpdate # default value, but explicitly set for demo
    rollingUpdate:
      maxUnavailable: 0
  template:
    metadata:
      labels:
        k8s-app: k8s-sample-app-rspec
    spec:
      imagePullSecrets:
      - name: dockerhub-credentials
      # initContainers:
      #   - name: k8s-sample-app-rspec-migrate
      #     image: rperry2174/ruby_rails_docker:{{GIT_TAG}}
      #     args: ["bundle", "exec", "rake", "db:create", "db:migrate", "db:seed"]
          # envFrom: &envfrom1
          #   - configMapRef:
          #       name: k8s-sample-app-config
        # env: &env1
            # - name: SECRET_KEY_BASE
            #   valueFrom:
            #     secretKeyRef:
            #       name: k8s-sample-app-secrets
            #       key: secret_key_base
          # - name: ABALONE_DATABASE_HOSTNAME
          #   value: postgresql
            # - name: MYSQL_PW
            #   valueFrom:
            #     secretKeyRef:
            #       name: mysql-pass
            #       key: password
      containers:
        - name: k8s-sample-app-rspec
          image: rperry2174/ruby_rails_docker:{{GIT_TAG}}
          args: ["bundle", "exec", "rspec"]
          resources:
            requests:
              cpu: 200m
              memory: 200Mi
          env:
            - name: ABALONE_DATABASE_HOSTNAME
              value: postgresql
          # ports:
          #   - containerPort: 3000
          # livenessProbe:
          #   httpGet:
          #     path: /
          #     port: 3000
          #   initialDelaySeconds: 5
          #   timeoutSeconds: 1
          # readinessProbe:
          #   httpGet:
          #     path: /
          #     port: 3000
          #   initialDelaySeconds: 5
          #   timeoutSeconds: 1
          # envFrom: *envfrom1
      # containers:
      #   - name: k8s-sample-app-rspec
      #     image: rperry2174/ruby_rails_docker:{{GIT_TAG}}
      #     args: ["bundle", "exec", "rails", "server", "-p", "3000"]
          # resources:
          #   requests:
          #     cpu: 200m
          #     memory: 200Mi
          # ports:
          #   - containerPort: 3000
      #     livenessProbe:
      #       httpGet:
      #         path: /
      #         port: 3000
      #       initialDelaySeconds: 5
      #       timeoutSeconds: 1
      #     readinessProbe:
      #       httpGet:
      #         path: /
      #         port: 3000
      #       initialDelaySeconds: 5
      #       timeoutSeconds: 1
      #     envFrom: *envfrom1
