@@ -17,6 +17,7 @@ limitations under the License.
17
17
package cloudinit
18
18
19
19
import (
20
+ "fmt"
20
21
"strings"
21
22
22
23
"github.com/pkg/errors"
@@ -53,21 +54,27 @@ func (a *runCmd) Commands() ([]provisioning.Cmd, error) {
53
54
return cmds , nil
54
55
}
55
56
57
+ // ignorePreflightErrors are preflight errors that fail in CAPD and thus we have to ignore them.
58
+ const ignorePreflightErrors = "SystemVerification,Swap,FileContent--proc-sys-net-bridge-bridge-nf-call-iptables"
59
+
56
60
func hackKubeadmIgnoreErrors (c provisioning.Cmd ) provisioning.Cmd {
57
61
// case kubeadm commands are defined as a string
58
62
if c .Cmd == "/bin/sh" && len (c .Args ) >= 2 {
59
63
if c .Args [0 ] == "-c" {
60
- c .Args [1 ] = strings .Replace (c .Args [1 ], "kubeadm init" , "kubeadm init --ignore-preflight-errors=all" , 1 )
61
- c .Args [1 ] = strings .Replace (c .Args [1 ], "kubeadm join" , "kubeadm join --ignore-preflight-errors=all" , 1 )
64
+ c .Args [1 ] = strings .Replace (c .Args [1 ], "kubeadm init" , fmt . Sprintf ( "kubeadm init --ignore-preflight-errors=%s" , ignorePreflightErrors ) , 1 )
65
+ c .Args [1 ] = strings .Replace (c .Args [1 ], "kubeadm join" , fmt . Sprintf ( "kubeadm join --ignore-preflight-errors=%s" , ignorePreflightErrors ) , 1 )
62
66
}
63
67
}
64
68
65
69
// case kubeadm commands are defined as a list
66
70
if c .Cmd == "kubeadm" && len (c .Args ) >= 1 {
67
71
if c .Args [0 ] == "init" || c .Args [0 ] == "join" {
68
- c .Args = append (c .Args , "" ) // make space
69
- copy (c .Args [2 :], c .Args [1 :]) // shift elements
70
- c .Args [1 ] = "--ignore-preflight-errors=all" // insert the additional arg
72
+ // make space
73
+ c .Args = append (c .Args , "" )
74
+ // shift elements
75
+ copy (c .Args [2 :], c .Args [1 :])
76
+ // insert the additional arg
77
+ c .Args [1 ] = fmt .Sprintf ("--ignore-preflight-errors=%s" , ignorePreflightErrors )
71
78
}
72
79
}
73
80
0 commit comments