Skip to content

Commit

Permalink
Add string enshorten if podname exceeds its limitation (62)
Browse files Browse the repository at this point in the history
  • Loading branch information
s1061123 committed Mar 28, 2019
1 parent 06f8af2 commit 4574ac8
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions cmd/kokotap/kokotap.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,16 @@ type kokotapPodArgs struct {

func (podargs *kokotapPodArgs) GeneratePodName() (string, string) {
nodeName := strings.Replace(podargs.Receiver.Node, ".", "-", -1)
return fmt.Sprintf("kokotap-%s-sender", podargs.PodName),
fmt.Sprintf("kokotap-%s-receiver-%s", podargs.PodName, nodeName)
sender := fmt.Sprintf("kokotap-%s-sender", podargs.PodName)
receiver := fmt.Sprintf("kokotap-%s-receiver-%s", podargs.PodName, nodeName)

if len(sender) > 62 {
sender = sender[0:61]
}
if len(receiver) > 62 {
receiver = receiver[0:61]
}
return sender, receiver
}

func (podargs *kokotapPodArgs) GenerateDockerYaml() string {
Expand Down

0 comments on commit 4574ac8

Please sign in to comment.