Skip to content

Commit

Permalink
fail on hostaliases in hostnetwork mode
Browse files Browse the repository at this point in the history
  • Loading branch information
iwilltry42 committed Jan 27, 2022
1 parent d0638de commit d558787
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 0 additions & 2 deletions cmd/cluster/clusterCreate.go
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,6 @@ func applyCLIOverrides(cfg conf.SimpleConfig) (conf.SimpleConfig, error) {

// --host-alias
hostAliasFlags := ppViper.GetStringSlice("hostaliases")
l.Log().Debugf("HostAliasFlags: %+v", hostAliasFlags)
if len(hostAliasFlags) > 0 {
for _, ha := range hostAliasFlags {

Expand Down Expand Up @@ -631,7 +630,6 @@ func applyCLIOverrides(cfg conf.SimpleConfig) (conf.SimpleConfig, error) {
})
}
}
l.Log().Debugf("HostAliases: %+v", cfg.HostAliases)

return cfg, nil
}
5 changes: 5 additions & 0 deletions pkg/config/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ func ValidateClusterConfig(ctx context.Context, runtime runtimes.Runtime, config
}
}

// hostAliases not allowed in hostnetwork mode
if len(config.ClusterCreateOpts.HostAliases) > 0 && config.Cluster.Network.Name == "host" {
return fmt.Errorf("hostAliases not allowed in hostnetwork mode")
}

// validate nodes one by one
for _, node := range config.Cluster.Nodes {

Expand Down

0 comments on commit d558787

Please sign in to comment.