Fix trailing comma in session server address extraction

Summary

When the GitLab Runner Helm chart is deployed on AWS EKS with an ELB LoadBalancer, the Kubernetes Service JSON populates the hostname field (not ip) in the LoadBalancer ingress status. The existing grep/cut/xargs pipeline in the set-session-server-address script captures a trailing comma from the raw JSON output, resulting in DNS lookup failures like:

tcp: lookup k8s-gitlabru-gitlabyay-cexample-1dhgdfhjkgbd5b.elb.us-gov-east-1.amazonaws.com,: no such host

Changes

  • Replace the grep/cut/xargs pipelines for both SERVICEHOSTNAME and SERVICEIP with sed capture groups that extract only the value inside JSON double quotes
  • Consolidate the two redundant curl calls into a single call stored in svc_json

Test plan

  • Deploy on AWS EKS with an ELB LoadBalancer and verify the session server address no longer includes a trailing comma
  • Verify session server still works when ip field is populated (non-AWS environments)
Edited by Ross Fisher

Merge request reports

Loading