Skip to content

Commit 5ecf015

Browse files
pooknullinelpandzichors
authored
K8SPSMDB-791: fix loadBalancerSourceRanges (#1264)
https://jira.percona.com/browse/K8SPSMDB-791 Co-authored-by: Inel Pandzic <[email protected]> Co-authored-by: Viacheslav Sarzhan <[email protected]>
1 parent 8483d1b commit 5ecf015

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

e2e-tests/demand-backup-sharded/conf/some-name-rs0.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ spec:
6262
expose:
6363
enabled: true
6464
exposeType: ClusterIP
65+
loadBalancerSourceRanges:
66+
- 10.0.0.0/8
6567
sidecars:
6668
- image: busybox
6769
command: ["/bin/sh"]
@@ -76,6 +78,8 @@ spec:
7678
localPingThresholdMs: 15
7779
expose:
7880
exposeType: ClusterIP
81+
loadBalancerSourceRanges:
82+
- 10.0.0.0/8
7983
sidecars:
8084
- image: busybox
8185
command: ["/bin/sh"]
@@ -175,6 +179,8 @@ spec:
175179
expose:
176180
enabled: true
177181
exposeType: ClusterIP
182+
loadBalancerSourceRanges:
183+
- 10.0.0.0/8
178184
resources:
179185
limits:
180186
cpu: 500m

pkg/psmdb/mongos.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,8 +439,7 @@ func MongosServiceSpec(cr *api.PerconaServerMongoDB, podName string) corev1.Serv
439439
TargetPort: intstr.FromInt(int(cr.Spec.Sharding.Mongos.Port)),
440440
},
441441
},
442-
Selector: ls,
443-
LoadBalancerSourceRanges: cr.Spec.Sharding.Mongos.Expose.LoadBalancerSourceRanges,
442+
Selector: ls,
444443
}
445444

446445
switch cr.Spec.Sharding.Mongos.Expose.ExposeType {
@@ -450,6 +449,7 @@ func MongosServiceSpec(cr *api.PerconaServerMongoDB, podName string) corev1.Serv
450449
case corev1.ServiceTypeLoadBalancer:
451450
spec.Type = corev1.ServiceTypeLoadBalancer
452451
spec.ExternalTrafficPolicy = "Cluster"
452+
spec.LoadBalancerSourceRanges = cr.Spec.Sharding.Mongos.Expose.LoadBalancerSourceRanges
453453
default:
454454
spec.Type = corev1.ServiceTypeClusterIP
455455
}

pkg/psmdb/service.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,8 @@ func Service(cr *api.PerconaServerMongoDB, replset *api.ReplsetSpec) *corev1.Ser
4747
TargetPort: intstr.FromInt(int(api.MongodPort(cr))),
4848
},
4949
},
50-
ClusterIP: "None",
51-
Selector: ls,
52-
LoadBalancerSourceRanges: replset.Expose.LoadBalancerSourceRanges,
50+
ClusterIP: "None",
51+
Selector: ls,
5352
},
5453
}
5554

0 commit comments

Comments
 (0)