Skip to content

Commit

Permalink
add new https backend annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
vultj committed Sep 23, 2022
1 parent f6fae43 commit a06b91a
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion vultr/loadbalancers.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ const (
// which TLS secret you want to be used for your load balancers SSL
annoVultrLBSSL = "service.beta.kubernetes.io/vultr-loadbalancer-ssl"

// annoVultrLBHTTPSBackendProtocol is the annotation used to specify the backend protocol
annoVultrLBHTTPSBackendProtocol = "service.beta.kubernetes.io/vultr-loadbalancer-https-backend-protocol"

annoVultrHealthCheckPath = "service.beta.kubernetes.io/vultr-loadbalancer-healthcheck-path"
annoVultrHealthCheckProtocol = "service.beta.kubernetes.io/vultr-loadbalancer-healthcheck-protocol"
annoVultrHealthCheckPort = "service.beta.kubernetes.io/vultr-loadbalancer-healthcheck-port"
Expand Down Expand Up @@ -576,8 +579,10 @@ func buildForwardingRules(service *v1.Service) ([]govultr.ForwardingRule, error)
if httpsPorts[port.Port] {
if getSSLPassthrough(service) {
protocol = protocolTCP
} else {
} else if isBackendHTTPS(service) {
protocol = protocolHTTPs
} else {
protocol = protocolHTTP
}
}

Expand Down Expand Up @@ -796,3 +801,12 @@ func getVPC(service *v1.Service) (string, error) {

return pnID, nil
}

func isBackendHTTPS(service *v1.Service) bool {
proto := service.Annotations[annoVultrLBHTTPSBackendProtocol]
if proto == "https" {
return true
}

return false
}

0 comments on commit a06b91a

Please sign in to comment.