Skip to content

Commit

Permalink
Add iptables install in host prep phase
Browse files Browse the repository at this point in the history
Signed-off-by: Jussi Nummelin <jnummelin@mirantis.com>
  • Loading branch information
jnummelin committed Feb 24, 2021
1 parent c8650ab commit 7e6a116
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
15 changes: 15 additions & 0 deletions config/cluster/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,21 @@ func (h *Host) NeedCurl() bool {
return false
}

// NeedIPTables returns true when the iptables package is needed on the host
func (h *Host) NeedIPTables() bool {
// Windows does not need any packages iptables
if h.Configurer.Kind() == "windows" {
return false
}

// Controllers do not need iptables
if h.IsController() {
return false
}

return !h.Configurer.CommandExist(h, "iptables")
}

// WaitKubeAPIReady blocks until the local kube api responds to /version
func (h *Host) WaitKubeAPIReady() error {
return h.WaitHTTPStatus("https://localhost:6443/version", 200)
Expand Down
6 changes: 6 additions & 0 deletions phase/prepare_hosts.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ func (p *PrepareHosts) prepareHost(h *cluster.Host) error {
}
}

if h.NeedIPTables() {
if err := h.Configurer.InstallPackage(h, "iptables"); err != nil {
return err
}
}

if h.IsController() && !h.Configurer.CommandExist(h, "kubectl") {
log.Infof("%s: installing kubectl", h)
if err := h.Configurer.InstallKubectl(h); err != nil {
Expand Down

0 comments on commit 7e6a116

Please sign in to comment.