Skip to content

Commit

Permalink
makes svc names RFC 1035 compliant
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Hausenblas <[email protected]>
  • Loading branch information
mhausenblas committed Feb 27, 2020
1 parent bfcd006 commit 71464b7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions launch.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ func inject(dproct DProcType, dpid, program, programtype, interpreter, pod strin
if userdefsvcname != "" {
svcname = userdefsvcname
}
// make sure the service name is confirming to the
// https://tools.ietf.org/html/rfc1035 spec, that is, only
// lower-case alphanumerics and `-` are allowed:
svcname = strings.ToLower(svcname)
svcname = strings.ReplaceAll(svcname, "_", "-")
svcname = strings.ReplaceAll(svcname, " ", "-")
port := currentenv().evt.get("SERVICE_PORT")
res, err := kubectl(true, "expose", "deployment", dpid,
"--name="+svcname, "--port="+port, "--target-port="+port)
Expand Down

0 comments on commit 71464b7

Please sign in to comment.