mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-09-05 12:05:17 +00:00
Fix IPv6 host aliases for kubernetes (#2992)
Closes #2991 [Tests](https://github.com/woodpecker-ci/woodpecker/pull/2993#issuecomment-1868048169) --------- Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
@@ -20,7 +20,6 @@ import (
|
||||
"io"
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
@@ -166,8 +165,7 @@ func (e *kube) SetupWorkflow(ctx context.Context, conf *types.Config, taskUUID s
|
||||
}
|
||||
}
|
||||
|
||||
extraHosts := []string{}
|
||||
|
||||
extraHosts := []types.HostAlias{}
|
||||
for _, stage := range conf.Stages {
|
||||
if stage.Alias == "services" {
|
||||
for _, step := range stage.Steps {
|
||||
@@ -175,12 +173,12 @@ func (e *kube) SetupWorkflow(ctx context.Context, conf *types.Config, taskUUID s
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
extraHosts = append(extraHosts, step.Networks[0].Aliases[0]+":"+svc.Spec.ClusterIP)
|
||||
hostAlias := types.HostAlias{Name: step.Networks[0].Aliases[0], IP: svc.Spec.ClusterIP}
|
||||
extraHosts = append(extraHosts, hostAlias)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
log.Trace().Msgf("Adding extra hosts: %s", strings.Join(extraHosts, ", "))
|
||||
log.Trace().Msgf("Adding extra hosts: %v", extraHosts)
|
||||
for _, stage := range conf.Stages {
|
||||
for _, step := range stage.Steps {
|
||||
step.ExtraHosts = extraHosts
|
||||
|
Reference in New Issue
Block a user