@@ -117,7 +117,7 @@ func (r *ClusterArgs) runArgs(cmd *cobra.Command, args *RunArgs, imageList []str
117
117
118
118
r .cluster .SetNewImages (imageList )
119
119
120
- defaultPort := strconv .Itoa (int (r .cluster .Spec .SSH .Port ))
120
+ defaultPort := strconv .Itoa (int (defaultSSHPort ( r .cluster .Spec .SSH .Port ) ))
121
121
masters := stringsutil .SplitRemoveEmpty (args .Cluster .Masters , "," )
122
122
nodes := stringsutil .SplitRemoveEmpty (args .Cluster .Nodes , "," )
123
123
r .hosts = []v2.Host {}
@@ -139,10 +139,11 @@ func (r *ClusterArgs) runArgs(cmd *cobra.Command, args *RunArgs, imageList []str
139
139
}
140
140
141
141
func (r * ClusterArgs ) setHostWithIpsPort (ips []string , roles []string ) {
142
- defaultPort := strconv .Itoa (int (r .cluster .Spec .SSH .Port ))
142
+ defaultPort := strconv .Itoa (int (defaultSSHPort ( r .cluster .Spec .SSH .Port ) ))
143
143
hostMap := map [string ]* v2.Host {}
144
144
for i := range ips {
145
145
ip , port := iputils .GetHostIPAndPortOrDefault (ips [i ], defaultPort )
146
+ logger .Debug ("defaultPort: %s" , defaultPort )
146
147
socket := fmt .Sprintf ("%s:%s" , ip , port )
147
148
if stringsutil .In (socket , r .cluster .GetAllIPS ()) {
148
149
continue
@@ -163,3 +164,10 @@ func (r *ClusterArgs) setHostWithIpsPort(ips []string, roles []string) {
163
164
r .hosts = append (r .hosts , * host )
164
165
}
165
166
}
167
+
168
+ func defaultSSHPort (port uint16 ) uint16 {
169
+ if port == 0 {
170
+ port = v2 .DefaultSSHPort
171
+ }
172
+ return port
173
+ }
0 commit comments