feat(chart): release 1.2.6 with lb source ranges
This commit is contained in:
@@ -171,9 +171,10 @@ func (c *Controller) sync(ctx context.Context, key string) error {
|
||||
}
|
||||
|
||||
lb, err := c.lbClient.Allocate(ctx, provisioner.AllocateRequest{
|
||||
Namespace: namespace,
|
||||
Name: name,
|
||||
Ports: ports,
|
||||
Namespace: namespace,
|
||||
Name: name,
|
||||
Ports: ports,
|
||||
LoadBalancerSourceRanges: serviceLoadBalancerSourceRanges(svc),
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -279,6 +280,24 @@ func servicePortsToAllocateRules(svc *corev1.Service) ([]provisioner.AllocatePor
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func serviceLoadBalancerSourceRanges(svc *corev1.Service) []string {
|
||||
if svc == nil || len(svc.Spec.LoadBalancerSourceRanges) == 0 {
|
||||
return nil
|
||||
}
|
||||
out := make([]string, 0, len(svc.Spec.LoadBalancerSourceRanges))
|
||||
for _, item := range svc.Spec.LoadBalancerSourceRanges {
|
||||
trimmed := strings.TrimSpace(item)
|
||||
if trimmed == "" {
|
||||
continue
|
||||
}
|
||||
out = append(out, trimmed)
|
||||
}
|
||||
if len(out) == 0 {
|
||||
return nil
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func containsString(items []string, target string) bool {
|
||||
for _, item := range items {
|
||||
if item == target {
|
||||
|
||||
Reference in New Issue
Block a user