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.
17
17
package network
18
18
19
19
import (
20
+ "errors"
20
21
"fmt"
21
22
"github.com/txn2/txeh"
22
23
"github.com/vishvananda/netlink"
23
24
"golang.org/x/sys/unix"
24
25
"io/ioutil"
25
26
"net"
27
+ "os"
26
28
"os/exec"
27
29
"strings"
28
30
)
@@ -82,6 +84,9 @@ func SetHostname(hostname string) {
82
84
83
85
// SetKubeletNodeIP sets the node IP in the kubelet configuration.
84
86
func SetKubeletNodeIP (kubeletEnvFile string , ip net.IP ) {
87
+ if _ , err := os .Stat (kubeletEnvFile ); errors .Is (err , os .ErrNotExist ) {
88
+ return
89
+ }
85
90
// TODO: Do not override existing content?
86
91
s := fmt .Sprintf ("KUBELET_EXTRA_ARGS=\" --node-ip=%s\" \n " , ip .String ())
87
92
check (ioutil .WriteFile (kubeletEnvFile , []byte (s ), 0644 ))
You can’t perform that action at this time.
0 commit comments