Documentation ¶
Index ¶
- Variables
- func LBToService(svc *v1.Service, lb *hcloud.LoadBalancer) error
- type Name
- func (s Name) AnnotateService(svc *v1.Service, v interface{}) error
- func (s Name) BoolFromService(svc *v1.Service) (bool, error)
- func (s Name) CertificatesFromService(svc *v1.Service) ([]*hcloud.Certificate, error)
- func (s Name) DurationFromService(svc *v1.Service) (time.Duration, error)
- func (s Name) IPFromService(svc *v1.Service) (net.IP, error)
- func (s Name) IntFromService(svc *v1.Service) (int, error)
- func (s Name) IntsFromService(svc *v1.Service) ([]int, error)
- func (s Name) LBAlgorithmTypeFromService(svc *v1.Service) (hcloud.LoadBalancerAlgorithmType, error)
- func (s Name) LBSvcProtocolFromService(svc *v1.Service) (hcloud.LoadBalancerServiceProtocol, error)
- func (s Name) NetworkZoneFromService(svc *v1.Service) (hcloud.NetworkZone, error)
- func (s Name) StringFromService(svc *v1.Service) (string, bool)
- func (s Name) StringsFromService(svc *v1.Service) ([]string, error)
Constants ¶
This section is empty.
Variables ¶
var ErrNotSet = errors.New("not set")
ErrNotSet signals that an annotation was not set.
Functions ¶
func LBToService ¶
func LBToService(svc *v1.Service, lb *hcloud.LoadBalancer) error
LBToService sets the relevant annotations on svc to their respective values from lb.
Types ¶
type Name ¶
type Name string
Name defines the name of a K8S annotation.
const ( // LBID is the ID assigned to the Hetzner Cloud Load Balancer by the // backend. Read-only. LBID Name = "load-balancer.hetzner.cloud/id" // LBPublicIPv4 is the public IPv4 address assigned to the Load Balancer by // the backend. Read-only. LBPublicIPv4 Name = "load-balancer.hetzner.cloud/ipv4" // LBPublicIPv6 is the public IPv6 address assigned to the Load Balancer by // the backend. Read-only. LBPublicIPv6 Name = "load-balancer.hetzner.cloud/ipv6" // LBName is the name of the Load Balancer. The name will be visible in // the Hetzner Cloud API console. LBName Name = "load-balancer.hetzner.cloud/name" // LBDisablePublicNetwork disables the public network of the Hetzner Cloud // Load Balancer. It will still have a public network assigned, but all // traffic is routed over the private network. LBDisablePublicNetwork Name = "load-balancer.hetzner.cloud/disable-public-network" // LBDisablePrivateIngress disables the use of the private network for // ingress. LBDisablePrivateIngress Name = "load-balancer.hetzner.cloud/disable-private-ingress" // LBUsePrivateIP configures the Load Balancer to use the private IP for // Load Balancer server targets. LBUsePrivateIP Name = "load-balancer.hetzner.cloud/use-private-ip" // LBHostname specifies the hostname of the Load Balancer. This will be // used as ingress address instead of the Load Balancer IP addresses if // specified. LBHostname Name = "load-balancer.hetzner.cloud/hostname" // LBSvcProtocol specifies the protocol of the service. Default: tcp, Possible // values: tcp, http, https LBSvcProtocol Name = "load-balancer.hetzner.cloud/protocol" // LBAlgorithmType specifies the algorithm type of the Load Balancer. // // Possible values: round_robin, least_connections // // Default: round_robin. LBAlgorithmType Name = "load-balancer.hetzner.cloud/algorithm-type" // LBType specifies the type of the Load Balancer. // // Default: lb11 LBType Name = "load-balancer.hetzner.cloud/type" // LBLocation specifies the location where the Load Balancer will be // created in. // // Changing the location to a different value after the load balancer was // created has no effect. In order to move a load balancer to a different // location it is necessary to delete and re-create it. Note, that this // will lead to the load balancer getting new public IPs assigned. // // Mutually exclusive with LBNetworkZone. LBLocation Name = "load-balancer.hetzner.cloud/location" // LBNetworkZone specifies the network zone where the Load Balancer will be // created in. // // Changing the network zone to a different value after the load balancer // was created has no effect. In order to move a load balancer to a // different network zone it is necessary to delete and re-create it. Note, // that this will lead to the load balancer getting new public IPs // assigned. // // Mutually exclusive with LBLocation. LBNetworkZone Name = "load-balancer.hetzner.cloud/network-zone" // LBSvcProxyProtocol specifies if the Load Balancer services should // use the proxy protocol. // // Default: false LBSvcProxyProtocol Name = "load-balancer.hetzner.cloud/uses-proxyprotocol" // LBSvcHTTPCookieName specifies the cookie name when using HTTP or HTTPS // as protocol. LBSvcHTTPCookieName Name = "load-balancer.hetzner.cloud/http-cookie-name" // LBSvcHTTPCookieLifetime specifies the lifetime of the HTTP cookie. LBSvcHTTPCookieLifetime Name = "load-balancer.hetzner.cloud/http-cookie-lifetime" // LBSvcHTTPCertificates specifies a comma separated IDs of Certificates // assigned to the service. HTTPS only. LBSvcHTTPCertificates Name = "load-balancer.hetzner.cloud/http-certificates" // LBSvcRedirectHTTP create a redirect from HTTP to HTTPS. HTTPS only. LBSvcRedirectHTTP Name = "load-balancer.hetzner.cloud/http-redirect-http" // LBSvcHTTPStickySessions enables the sticky sessions feature of Hetzner // Cloud HTTP Load Balancers. // // Default: false LBSvcHTTPStickySessions Name = "load-balancer.hetzner.cloud/http-sticky-sessions" // LBSvcHealthCheckProtocol sets the protocol the health check should be // performed over. // // Possible values: tcp, http, https // // Default: tcp LBSvcHealthCheckProtocol Name = "load-balancer.hetzner.cloud/health-check-protocol" // LBSvcHealthCheckPort specifies the port the health check is be performed // on. LBSvcHealthCheckPort Name = "load-balancer.hetzner.cloud/health-check-port" // LBSvcHealthCheckInterval specifies the interval in which time we perform // a health check in seconds LBSvcHealthCheckInterval Name = "load-balancer.hetzner.cloud/health-check-interval" // LBSvcHealthCheckTimeout specifies the timeout of a single health check LBSvcHealthCheckTimeout Name = "load-balancer.hetzner.cloud/health-check-timeout" // LBSvcHealthCheckRetries specifies the number of time a health check is // retried until a target is marked as unhealthy. LBSvcHealthCheckRetries Name = "load-balancer.hetzner.cloud/health-check-retries" // LBSvcHealthCheckHTTPDomain specifies the domain we try to access when // performing the health check. LBSvcHealthCheckHTTPDomain Name = "load-balancer.hetzner.cloud/health-check-http-domain" // LBSvcHealthCheckHTTPPath specifies the path we try to access when // performing the health check. LBSvcHealthCheckHTTPPath Name = "load-balancer.hetzner.cloud/health-check-http-path" // LBSvcHealthCheckHTTPValidateCertificate specifies whether the health // check should validate the SSL certificate that comes from the target // nodes. LBSvcHealthCheckHTTPValidateCertificate Name = "load-balancer.hetzner.cloud/health-check-http-validate-certificate" // LBSvcHealthCheckHTTPStatusCodes is a comma separated list of HTTP status // codes which we expect. LBSvcHealthCheckHTTPStatusCodes Name = "load-balancer.hetzner.cloud/http-status-codes" )
func (Name) AnnotateService ¶
AnnotateService adds the value v as an annotation with s.Name to svc.
AnnotateService returns an error if converting v to a string fails.
func (Name) BoolFromService ¶
BoolFromService retrieves the boolean value belonging to the annotation from svc.
BoolFromService returns an error if the value could not be converted to a boolean, or the annotation was not set. In the case of a missing value, the error wraps ErrNotSet.
func (Name) CertificatesFromService ¶
CertificatesFromService retrieves the []*hcloud.Certificate value belonging to the annotation from svc.
CertificatesFromService returns an error if the value could not be converted to a []*hcloud.Certificate, or the annotation was not set. In the case of a missing value, the error wraps ErrNotSet.
func (Name) DurationFromService ¶
DurationFromService retrieves the time.Duration value belonging to the annotation from svc.
DurationFromService returns an error if the value could not be converted to a time.Duration, or the annotation was not set. In the case of a missing value, the error wraps ErrNotSet.
func (Name) IPFromService ¶
IPFromService retrieves the net.IP value belonging to the annotation from svc.
IPFromService returns an error if the value could not be converted to a net.IP, or the annotation was not set. In the case of a missing value, the error wraps ErrNotSet.
func (Name) IntFromService ¶
IntFromService retrieves the int value belonging to the annotation from svc.
IntFromService returns an error if the value could not be converted to an int, or the annotation was not set. In the case of a missing value, the error wraps ErrNotSet.
func (Name) IntsFromService ¶
IntsFromService retrieves the []int value belonging to the annotation from svc.
IntsFromService returns an error if the value could not be converted to a []int, or the annotation was not set. In the case of a missing value, the error wraps ErrNotSet.
func (Name) LBAlgorithmTypeFromService ¶
LBAlgorithmTypeFromService retrieves the hcloud.LoadBalancerAlgorithmType value belonging to the annotation from svc.
LBAlgorithmTypeFromService returns an error if the value could not be converted to a hcloud.LoadBalancerAlgorithmType, or the annotation was not set. In the case of a missing value, the error wraps ErrNotSet.
func (Name) LBSvcProtocolFromService ¶
LBSvcProtocolFromService retrieves the hcloud.LoadBalancerServiceProtocol value belonging to the annotation from svc.
LBSvcProtocolFromService returns an error if the value could not be converted to a hcloud.LoadBalancerServiceProtocol, or the annotation was not set. In the case of a missing value, the error wraps ErrNotSet.
func (Name) NetworkZoneFromService ¶
NetworkZoneFromService retrieves the hcloud.NetworkZone value belonging to the annotation from svc.
NetworkZoneFromService returns ErrNotSet if the annotation was not set.
func (Name) StringFromService ¶
StringFromService retrieves the value belonging to the annotation from svc.
If svc has no value for the annotation the second return value is false.