github.com/kubernetes-incubator/kube-aws@v0.16.4/pkg/api/api_endpoint.go (about)

     1  package api
     2  
     3  import (
     4  	"errors"
     5  	"fmt"
     6  )
     7  
     8  // APIEndpoint is a Kubernetes API endpoint to which various clients connect.
     9  // Each endpoint can be served by an existing ELB or a kube-aws managed ELB.
    10  type APIEndpoint struct {
    11  	// Name is the unique name of this API endpoint used by kube-aws for identifying this API endpoint
    12  	Name string `yaml:"name,omitempty"`
    13  	// DNSName is the FQDN of this endpoint
    14  	// A record set may or may not be created with this DNS name.
    15  	// TLS certificates generated by kube-aws would contain this name in the list of common names.
    16  	DNSName string `yaml:"dnsName,omitempty"`
    17  	// LoadBalancer is a set of an ELB and relevant settings and resources to serve a Kubernetes API hosted by controller nodes
    18  	LoadBalancer APIEndpointLB `yaml:"loadBalancer,omitempty"`
    19  	//DNSRoundRobin APIDNSRoundRobin `yaml:"dnsRoundRobin,omitempty"`
    20  	UnknownKeys `yaml:",inline"`
    21  }
    22  
    23  // Validate returns an error when there's any user error in the `apiEndpoint` settings
    24  func (e APIEndpoint) Validate() error {
    25  	if err := e.LoadBalancer.Validate(); err != nil {
    26  		return fmt.Errorf("invalid loadBalancer: %v", err)
    27  	}
    28  	if e.DNSName == "" {
    29  		return errors.New("dnsName must be set")
    30  	}
    31  	return nil
    32  }