added annotations
This commit is contained in:
parent
bd94056453
commit
9e85a199a7
4 changed files with 35 additions and 2 deletions
|
|
@ -14,6 +14,7 @@ package pvecloud
|
|||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
|
||||
apiclient "git.giftfish.de/ston1th/haproxy-lb/pkg/api/client"
|
||||
"git.giftfish.de/ston1th/haproxy-lb/pkg/api/v1/client"
|
||||
|
|
@ -60,8 +61,32 @@ func (lb *loadbalancer) GetLoadBalancerName(ctx context.Context, clusterName str
|
|||
}
|
||||
|
||||
func (lb *loadbalancer) EnsureLoadBalancer(ctx context.Context, clusterName string, service *v1.Service, nodes []*v1.Node) (status *v1.LoadBalancerStatus, err error) {
|
||||
// TODO service annotations
|
||||
/*TODO service annotations
|
||||
port <node.Status.HealthCheckNodePort (int32)>
|
||||
https://pkg.go.dev/k8s.io/api/core/v1#NodeStatus
|
||||
node.Status.ExternalTrafficPolicy ?
|
||||
v1.ServiceExternalTrafficPolicyTypeLocal
|
||||
v1.ServiceExternalTrafficPolicyTypeCluster
|
||||
*/
|
||||
var slb schema.LoadBalancer
|
||||
if fo, ok := service.Annotations["frontend.haproxy-lb/options"]; ok {
|
||||
slb.Options.Frontend = strings.Split(fo, ",")
|
||||
}
|
||||
if bo, ok := service.Annotations["backend.haproxy-lb/options"]; ok {
|
||||
slb.Options.Backend = strings.Split(bo, ",")
|
||||
}
|
||||
if cp, ok := service.Annotations["backend.haproxy-lb/proxy-protocol"]; ok {
|
||||
if cp == "v1" || cp == "v2" {
|
||||
slb.Options.ProxyProtocol = cp
|
||||
}
|
||||
}
|
||||
if cpp, ok := service.Annotations["backend.haproxy-lb/check-proxy-protocol"]; ok {
|
||||
slb.Options.CheckProxyProtocol = cpp == "true"
|
||||
}
|
||||
if df, ok := service.Annotations["backend.haproxy-lb/default-server"]; ok {
|
||||
slb.Options.DefaultServer = df
|
||||
}
|
||||
|
||||
for _, port := range service.Spec.Ports {
|
||||
sp := schema.Port{Port: int(port.Port)}
|
||||
for _, node := range nodes {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue