apiVersion: v1
kind: Service
metadata:
  name: phil
  # annotations:
  #   'service.beta.kubernetes.io/external-traffic': 'OnlyLocal'
spec:
  # NOTE: load balancing is only really necessary if we want to try
  # to enforce clientip and pass through the ip with the onlylocal annotation
  # for now we're not because it doesn't really work
  
  # this causes occasional 400 errors in socket.io when first connecting
  # (even though it shouldn't...)
  # https://github.com/socketio/socket.io/issues/1942
  # maybe gce thinks a node is down and redirects to wrong/diff one?
  # or node 'at capacity'
  # https://cloud.google.com/compute/docs/load-balancing/http/#websocket_proxy_support

  type: LoadBalancer
  externalTrafficPolicy: Local
  # https://github.com/digitalocean/digitalocean-cloud-controller-manager/issues/130
  # loadBalancerIP: '35.233.162.169'
  ports:
    - name: phil
      port: 80
  selector:
    app: phil


  # FIXME: this doesn't actually balance things that well since it
  # uses cloudflare's ip
  # sessionAffinity: ClientIP
