File tree 1 file changed +21
-0
lines changed
1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import (
21
21
"fmt"
22
22
"io/ioutil"
23
23
"net"
24
+ "net/url"
24
25
"os"
25
26
"os/exec"
26
27
"os/user"
@@ -397,6 +398,26 @@ func validateConfig() {
397
398
exit .Usage ("Sorry, the kubeadm.%s parameter is currently not supported by --extra-config" , param )
398
399
}
399
400
}
401
+
402
+ validateRegistryMirror ()
403
+ }
404
+
405
+ // This function validates if the --registry-mirror
406
+ //args match the format of http://localhost
407
+ func validateRegistryMirror () {
408
+
409
+ if len (registryMirror ) > 0 {
410
+ for _ , loc := range registryMirror {
411
+ URL , err := url .Parse (loc )
412
+ if err != nil {
413
+ glog .Errorln ("Error Parsing URL: " , err )
414
+ }
415
+ if (URL .Scheme != "http" && URL .Scheme != "https" ) || URL .Path != "" {
416
+ exit .Usage ("Sorry, url provided with --registry-mirror flag is invalid %q" , loc )
417
+ }
418
+
419
+ }
420
+ }
400
421
}
401
422
402
423
// doCacheBinaries caches Kubernetes binaries in the foreground
You can’t perform that action at this time.
0 commit comments