Skip to content

Commit

Permalink
Support inheriting config using service (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
stepro authored Jun 3, 2020
1 parent 40dab58 commit bcb288c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/pod/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,14 @@ func baseline(k *kubectl.CLI, inherit string) (object, string, error) {
}

if kind == "service" {
// TODO: enumerate endpoints, get first selected pod
pods, err := k.Lines("get", "endpoints", name, "-o", `go-template={{range .subsets}}{{range .addresses}}{{if .targetRef}}{{if eq .targetRef.kind "Pod"}}{{.targetRef.name}}{{end}}{{end}}{{end}}{{end}}`)
if err != nil {
return nil, "", err
} else if len(pods) == 0 {
return nil, "", fmt.Errorf(`Unable to determine pod from service "%s"`, name)
}
kind = "pod"
name = pods[0]
}

var source object
Expand Down

0 comments on commit bcb288c

Please sign in to comment.