apiVersion: v1
kind: ReplicationController
metadata:
  name: service-loadbalancer
  namespace: load-balancer
  labels:
    app: service-loadbalancer
    version: v1
spec:
  replicas: 2
  selector:
    app: service-loadbalancer
    version: v1
  template:
    metadata:
      labels:
        app: service-loadbalancer
        version: v1
    spec:
      # nodeSelector:
      #   role: loadbalancer
      serviceAccount: lb-sa
      serviceAccountName: lb-sa
      containers:
      - image: gcr.io/${BPG_GCP_PROJECT_ID}/haproxy:0.4-preprod-20190503-1829
        imagePullPolicy: Always
        resources:
          limits:
             cpu: 700m
             memory: 1Gi
          requests:
             cpu: 700m
             memory: 1Gi
        livenessProbe:
          httpGet:
            path: /healthz
            port: 8081
            scheme: HTTP
          initialDelaySeconds: 30
          timeoutSeconds: 5
        name: haproxy
        ports:
        # All http services
        - containerPort: 80
          # hostPort: 80
          protocol: TCP
        # nginx https
        - containerPort: 443
          # hostPort: 8083
          protocol: TCP
        # mysql
        - containerPort: 3306
          hostPort: 3306
          protocol: TCP
        # haproxy stats
        - containerPort: 1936
          # hostPort: 1936
          protocol: TCP
        resources: {}
        args:
        - --tcp-services=mysql:3306,nginxsvc:443
        - --syslog=true
        - --ssl-cert=/etc/certs/sslterm/star_playground_preprod_ballerina_io.pem
        - --ssl-ca-cert=/etc/certs/sslterm/DigiCertCA.crt
        - --reload-interval=5s
