mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 07:47:56 +00:00
address review comments of @davidopp
This commit is contained in:
parent
652c14d8d7
commit
7387a2d0cd
@ -114,7 +114,7 @@ func (c *MesosCloud) ListClusters() ([]string, error) {
|
||||
return []string{name}, err
|
||||
}
|
||||
|
||||
// Master gets back the address (either DNS name or IP address) of the master node for the cluster.
|
||||
// Master gets back the address (either DNS name or IP address) of the leading Mesos master node for the cluster.
|
||||
func (c *MesosCloud) Master(clusterName string) (string, error) {
|
||||
clusters, err := c.ListClusters()
|
||||
if err != nil {
|
||||
@ -138,7 +138,7 @@ func (c *MesosCloud) Master(clusterName string) (string, error) {
|
||||
}
|
||||
|
||||
// ipAddress returns an IP address of the specified instance.
|
||||
func (c *MesosCloud) ipAddress(name string) (net.IP, error) {
|
||||
func ipAddress(name string) (net.IP, error) {
|
||||
if name == "" {
|
||||
return nil, noHostNameSpecified
|
||||
}
|
||||
@ -158,7 +158,7 @@ func (c *MesosCloud) ipAddress(name string) (net.IP, error) {
|
||||
|
||||
// ExternalID returns the cloud provider ID of the specified instance.
|
||||
func (c *MesosCloud) ExternalID(instance string) (string, error) {
|
||||
ip, err := c.ipAddress(instance)
|
||||
ip, err := ipAddress(instance)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
@ -218,7 +218,7 @@ func (c *MesosCloud) GetNodeResources(name string) (*api.NodeResources, error) {
|
||||
|
||||
// NodeAddresses returns the addresses of the specified instance.
|
||||
func (c *MesosCloud) NodeAddresses(name string) ([]api.NodeAddress, error) {
|
||||
ip, err := c.ipAddress(name)
|
||||
ip, err := ipAddress(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -28,9 +28,8 @@ import (
|
||||
)
|
||||
|
||||
func TestIPAddress(t *testing.T) {
|
||||
c := &MesosCloud{}
|
||||
expected4 := net.IPv4(127, 0, 0, 1)
|
||||
ip, err := c.ipAddress("127.0.0.1")
|
||||
ip, err := ipAddress("127.0.0.1")
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
@ -42,7 +41,7 @@ func TestIPAddress(t *testing.T) {
|
||||
if expected6 == nil {
|
||||
t.Fatalf("failed to parse ipv6 ::1")
|
||||
}
|
||||
ip, err = c.ipAddress("::1")
|
||||
ip, err = ipAddress("::1")
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
@ -50,7 +49,7 @@ func TestIPAddress(t *testing.T) {
|
||||
t.Fatalf("expected %#v instead of %#v", expected6, ip)
|
||||
}
|
||||
|
||||
ip, err = c.ipAddress("localhost")
|
||||
ip, err = ipAddress("localhost")
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
@ -58,7 +57,7 @@ func TestIPAddress(t *testing.T) {
|
||||
t.Fatalf("expected %#v or %#v instead of %#v", expected4, expected6, ip)
|
||||
}
|
||||
|
||||
_, err = c.ipAddress("")
|
||||
_, err = ipAddress("")
|
||||
if err != noHostNameSpecified {
|
||||
t.Fatalf("expected error noHostNameSpecified but got none")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user