diff --git a/cluster-provision/gocli/cmd/utils/ports.go b/cluster-provision/gocli/cmd/utils/ports.go index 7753bba2c0..34d6e3ba70 100644 --- a/cluster-provision/gocli/cmd/utils/ports.go +++ b/cluster-provision/gocli/cmd/utils/ports.go @@ -65,7 +65,7 @@ const ( ) // GetPublicPort returns public port by private port -func GetPublicPort(port uint16, ports nat.PortMap) (uint16, error) { +func GetPublicPort(port uint, ports nat.PortMap) (uint16, error) { portStr := strconv.Itoa(int(port)) for k, p := range ports { if k == nat.Port(portStr+"/tcp") || k == nat.Port(portStr+"/udp") { @@ -84,7 +84,7 @@ func GetPublicPort(port uint16, ports nat.PortMap) (uint16, error) { } // PrintPublicPort prints public port -func PrintPublicPort(port uint16, ports nat.PortMap) error { +func PrintPublicPort(port uint, ports nat.PortMap) error { p, err := GetPublicPort(port, ports) if err != nil { return err diff --git a/cluster-provision/gocli/providers/opts.go b/cluster-provision/gocli/providers/opts.go index 089a4e1a89..f3a999de21 100644 --- a/cluster-provision/gocli/providers/opts.go +++ b/cluster-provision/gocli/providers/opts.go @@ -92,61 +92,61 @@ func WithSlim(slim interface{}) KubevirtProviderOption { func WithVNCPort(vncPort interface{}) KubevirtProviderOption { return func(c *KubevirtProvider) { - c.VNCPort = vncPort.(uint16) + c.VNCPort = vncPort.(uint) } } func WithHTTPPort(httpPort interface{}) KubevirtProviderOption { return func(c *KubevirtProvider) { - c.HTTPPort = httpPort.(uint16) + c.HTTPPort = httpPort.(uint) } } func WithHTTPSPort(httpsPort interface{}) KubevirtProviderOption { return func(c *KubevirtProvider) { - c.HTTPSPort = httpsPort.(uint16) + c.HTTPSPort = httpsPort.(uint) } } func WithRegistryPort(registryPort interface{}) KubevirtProviderOption { return func(c *KubevirtProvider) { - c.RegistryPort = registryPort.(uint16) + c.RegistryPort = registryPort.(uint) } } func WithOCPort(ocpPort interface{}) KubevirtProviderOption { return func(c *KubevirtProvider) { - c.OCPort = ocpPort.(uint16) + c.OCPort = ocpPort.(uint) } } func WithK8sPort(k8sPort interface{}) KubevirtProviderOption { return func(c *KubevirtProvider) { - c.K8sPort = k8sPort.(uint16) + c.K8sPort = k8sPort.(uint) } } func WithSSHPort(sshPort interface{}) KubevirtProviderOption { return func(c *KubevirtProvider) { - c.SSHPort = sshPort.(uint16) + c.SSHPort = sshPort.(uint) } } func WithPrometheusPort(prometheusPort interface{}) KubevirtProviderOption { return func(c *KubevirtProvider) { - c.PrometheusPort = prometheusPort.(uint16) + c.PrometheusPort = prometheusPort.(uint) } } func WithGrafanaPort(grafanaPort interface{}) KubevirtProviderOption { return func(c *KubevirtProvider) { - c.GrafanaPort = grafanaPort.(uint16) + c.GrafanaPort = grafanaPort.(uint) } } func WithDNSPort(dnsPort interface{}) KubevirtProviderOption { return func(c *KubevirtProvider) { - c.DNSPort = dnsPort.(uint16) + c.DNSPort = dnsPort.(uint) } } diff --git a/cluster-provision/gocli/providers/start.go b/cluster-provision/gocli/providers/start.go index 6133fee857..95cdc2f3da 100644 --- a/cluster-provision/gocli/providers/start.go +++ b/cluster-provision/gocli/providers/start.go @@ -66,7 +66,7 @@ func (kp *KubevirtProvider) Start(ctx context.Context, cancel context.CancelFunc if err != nil { return err } - kp.SSHPort = port + kp.SSHPort = uint(port) } if kp.APIServerPort == 0 { @@ -74,7 +74,7 @@ func (kp *KubevirtProvider) Start(ctx context.Context, cancel context.CancelFunc if err != nil { return err } - kp.APIServerPort = port + kp.APIServerPort = uint(port) } registry, err := kp.runRegistry(ctx) @@ -97,7 +97,7 @@ func (kp *KubevirtProvider) Start(ctx context.Context, cancel context.CancelFunc for x := 0; x < int(kp.Nodes); x++ { nodeName := kp.nodeNameFromIndex(x + 1) - sshClient, err := libssh.NewSSHClient(kp.SSHPort, x+1, false) + sshClient, err := libssh.NewSSHClient(uint16(kp.SSHPort), x+1, false) if err != nil { return err } @@ -164,7 +164,7 @@ func (kp *KubevirtProvider) Start(ctx context.Context, cancel context.CancelFunc if err = rootkey.Exec(); err != nil { return err } - sshClient, err = libssh.NewSSHClient(kp.SSHPort, x+1, true) + sshClient, err = libssh.NewSSHClient(uint16(kp.SSHPort), x+1, true) if err = kp.provisionNode(sshClient, x+1); err != nil { return err @@ -176,7 +176,7 @@ func (kp *KubevirtProvider) Start(ctx context.Context, cancel context.CancelFunc }(node.ID) } - sshClient, err := libssh.NewSSHClient(kp.SSHPort, 1, true) + sshClient, err := libssh.NewSSHClient(uint16(kp.SSHPort), 1, true) if err != nil { return err } @@ -191,7 +191,7 @@ func (kp *KubevirtProvider) Start(ctx context.Context, cancel context.CancelFunc return err } - config, err := k8s.NewConfig(".kubeconfig", kp.APIServerPort) + config, err := k8s.NewConfig(".kubeconfig", uint16(kp.APIServerPort)) if err != nil { return err } diff --git a/cluster-provision/gocli/providers/types.go b/cluster-provision/gocli/providers/types.go index 5626348d94..54a6b557b3 100644 --- a/cluster-provision/gocli/providers/types.go +++ b/cluster-provision/gocli/providers/types.go @@ -24,17 +24,17 @@ type KubevirtProvider struct { RandomPorts bool `flag:"random-ports" json:"random_ports"` Prefix string `flag:"prefix" json:"prefix"` Slim bool `flag:"slim" json:"slim"` - VNCPort uint16 `flag:"vnc-port" json:"vnc_port"` - HTTPPort uint16 `flag:"http-port" json:"http_port"` - HTTPSPort uint16 `flag:"https-port" json:"https_port"` - RegistryPort uint16 `flag:"registry-port" json:"registry_port"` - OCPort uint16 `flag:"ocp-port" json:"ocp_port"` - K8sPort uint16 `flag:"k8s-port" json:"k8s_port"` - SSHPort uint16 `flag:"ssh-port" json:"ssh_port"` - PrometheusPort uint16 `flag:"prometheus-port" json:"prometheus_port"` - GrafanaPort uint16 `flag:"grafana-port" json:"grafana_port"` - DNSPort uint16 `flag:"dns-port" json:"dns_port"` - APIServerPort uint16 `json:"api_server_port"` + VNCPort uint `flag:"vnc-port" json:"vnc_port"` + HTTPPort uint `flag:"http-port" json:"http_port"` + HTTPSPort uint `flag:"https-port" json:"https_port"` + RegistryPort uint `flag:"registry-port" json:"registry_port"` + OCPort uint `flag:"ocp-port" json:"ocp_port"` + K8sPort uint `flag:"k8s-port" json:"k8s_port"` + SSHPort uint `flag:"ssh-port" json:"ssh_port"` + PrometheusPort uint `flag:"prometheus-port" json:"prometheus_port"` + GrafanaPort uint `flag:"grafana-port" json:"grafana_port"` + DNSPort uint `flag:"dns-port" json:"dns_port"` + APIServerPort uint `json:"api_server_port"` NFSData string `flag:"nfs-data" json:"nfs_data"` EnableCeph bool `flag:"enable-ceph" json:"enable_ceph"` EnableIstio bool `flag:"enable-istio" json:"enable_istio"`