File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -17,12 +17,14 @@ limitations under the License.
1717package network
1818
1919import (
20+ "errors"
2021 "fmt"
2122 "github.com/txn2/txeh"
2223 "github.com/vishvananda/netlink"
2324 "golang.org/x/sys/unix"
2425 "io/ioutil"
2526 "net"
27+ "os"
2628 "os/exec"
2729 "strings"
2830)
@@ -82,6 +84,9 @@ func SetHostname(hostname string) {
8284
8385// SetKubeletNodeIP sets the node IP in the kubelet configuration.
8486func SetKubeletNodeIP (kubeletEnvFile string , ip net.IP ) {
87+ if _ , err := os .Stat (kubeletEnvFile ); errors .Is (err , os .ErrNotExist ) {
88+ return
89+ }
8590 // TODO: Do not override existing content?
8691 s := fmt .Sprintf ("KUBELET_EXTRA_ARGS=\" --node-ip=%s\" \n " , ip .String ())
8792 check (ioutil .WriteFile (kubeletEnvFile , []byte (s ), 0644 ))
You can’t perform that action at this time.
0 commit comments