Client IP not being passed to GitLab
Seen by @WarheadsSE here:
Probably not a high priority for now, but I thought it was related to our mattermost problems, so I had investigated it. (It wasn't related)
-
Basically the problem starts with kubernetes and gke not providing the IP to the nodes. See: https://kubernetes.io/docs/user-guide/load-balancer/#annotation-to-modify-the-loadbalancer-behavior-for-preservation-of-source-ip
If you are using an alpha cluster on 1.4 you can use the following in the load balancer to get the source ip to nginx (you can see in the access logs)annotations: service.alpha.kubernetes.io/external-traffic: "OnlyLocal"
2. The nginx controller we are using doesn't allow us to make real-ip changes to the nginx config:
https://github.com/kubernetes/contrib/blob/master/ingress/controllers/nginx/nginx.tmpl#L25
^ For GitLab rails we can get around this by setting in the deployment:
```
gitlab_rails['trusted_proxies'] = ["10.0.0.0/8"]
```
Using trusted proxies and the alpha annotations I was able to get the correct IP in the gitlab interface, but workhorse logs were still logging the nginx pod's IP.
alpha clusters can only be run for 30days, so we can't reasonably do anything about this one until k8 1.5 is on gke