Skip to content

Commit b2686ac

Browse files
committed
Use cluster IP for master and slave services
1 parent 1fdf21c commit b2686ac

File tree

2 files changed

+12
-24
lines changed

2 files changed

+12
-24
lines changed

operator/redisfailover/service/generator.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,7 @@ func generateRedisMasterService(rf *redisfailoverv1.RedisFailover, labels map[st
130130
Annotations: rf.Spec.Redis.ServiceAnnotations,
131131
},
132132
Spec: corev1.ServiceSpec{
133-
Type: corev1.ServiceTypeClusterIP,
134-
ClusterIP: corev1.ClusterIPNone,
133+
Type: corev1.ServiceTypeClusterIP,
135134
Ports: []corev1.ServicePort{
136135
{
137136
Name: "redis",
@@ -164,8 +163,7 @@ func generateRedisSlaveService(rf *redisfailoverv1.RedisFailover, labels map[str
164163
Annotations: rf.Spec.Redis.ServiceAnnotations,
165164
},
166165
Spec: corev1.ServiceSpec{
167-
Type: corev1.ServiceTypeClusterIP,
168-
ClusterIP: corev1.ClusterIPNone,
166+
Type: corev1.ServiceTypeClusterIP,
169167
Ports: []corev1.ServicePort{
170168
{
171169
Name: "redis",

operator/redisfailover/service/generator_test.go

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,8 +1322,7 @@ func TestRedisMasterService(t *testing.T) {
13221322
},
13231323
},
13241324
Spec: corev1.ServiceSpec{
1325-
Type: corev1.ServiceTypeClusterIP,
1326-
ClusterIP: "None",
1325+
Type: corev1.ServiceTypeClusterIP,
13271326
Selector: map[string]string{
13281327
"app.kubernetes.io/component": "redis",
13291328
"app.kubernetes.io/name": name,
@@ -1362,8 +1361,7 @@ func TestRedisMasterService(t *testing.T) {
13621361
},
13631362
},
13641363
Spec: corev1.ServiceSpec{
1365-
Type: corev1.ServiceTypeClusterIP,
1366-
ClusterIP: "None",
1364+
Type: corev1.ServiceTypeClusterIP,
13671365
Selector: map[string]string{
13681366
"app.kubernetes.io/component": "redis",
13691367
"app.kubernetes.io/name": "custom-name",
@@ -1402,8 +1400,7 @@ func TestRedisMasterService(t *testing.T) {
14021400
},
14031401
},
14041402
Spec: corev1.ServiceSpec{
1405-
Type: corev1.ServiceTypeClusterIP,
1406-
ClusterIP: "None",
1403+
Type: corev1.ServiceTypeClusterIP,
14071404
Selector: map[string]string{
14081405
"app.kubernetes.io/component": "redis",
14091406
"app.kubernetes.io/name": name,
@@ -1443,8 +1440,7 @@ func TestRedisMasterService(t *testing.T) {
14431440
},
14441441
},
14451442
Spec: corev1.ServiceSpec{
1446-
Type: corev1.ServiceTypeClusterIP,
1447-
ClusterIP: "None",
1443+
Type: corev1.ServiceTypeClusterIP,
14481444
Selector: map[string]string{
14491445
"app.kubernetes.io/component": "redis",
14501446
"app.kubernetes.io/name": name,
@@ -1485,8 +1481,7 @@ func TestRedisMasterService(t *testing.T) {
14851481
},
14861482
},
14871483
Spec: corev1.ServiceSpec{
1488-
Type: corev1.ServiceTypeClusterIP,
1489-
ClusterIP: "None",
1484+
Type: corev1.ServiceTypeClusterIP,
14901485
Selector: map[string]string{
14911486
"app.kubernetes.io/component": "redis",
14921487
"app.kubernetes.io/name": name,
@@ -1567,8 +1562,7 @@ func TestRedisSlaveService(t *testing.T) {
15671562
},
15681563
},
15691564
Spec: corev1.ServiceSpec{
1570-
Type: corev1.ServiceTypeClusterIP,
1571-
ClusterIP: "None",
1565+
Type: corev1.ServiceTypeClusterIP,
15721566
Selector: map[string]string{
15731567
"app.kubernetes.io/component": "redis",
15741568
"app.kubernetes.io/name": name,
@@ -1607,8 +1601,7 @@ func TestRedisSlaveService(t *testing.T) {
16071601
},
16081602
},
16091603
Spec: corev1.ServiceSpec{
1610-
Type: corev1.ServiceTypeClusterIP,
1611-
ClusterIP: "None",
1604+
Type: corev1.ServiceTypeClusterIP,
16121605
Selector: map[string]string{
16131606
"app.kubernetes.io/component": "redis",
16141607
"app.kubernetes.io/name": "custom-name",
@@ -1647,8 +1640,7 @@ func TestRedisSlaveService(t *testing.T) {
16471640
},
16481641
},
16491642
Spec: corev1.ServiceSpec{
1650-
Type: corev1.ServiceTypeClusterIP,
1651-
ClusterIP: "None",
1643+
Type: corev1.ServiceTypeClusterIP,
16521644
Selector: map[string]string{
16531645
"app.kubernetes.io/component": "redis",
16541646
"app.kubernetes.io/name": name,
@@ -1688,8 +1680,7 @@ func TestRedisSlaveService(t *testing.T) {
16881680
},
16891681
},
16901682
Spec: corev1.ServiceSpec{
1691-
Type: corev1.ServiceTypeClusterIP,
1692-
ClusterIP: "None",
1683+
Type: corev1.ServiceTypeClusterIP,
16931684
Selector: map[string]string{
16941685
"app.kubernetes.io/component": "redis",
16951686
"app.kubernetes.io/name": name,
@@ -1730,8 +1721,7 @@ func TestRedisSlaveService(t *testing.T) {
17301721
},
17311722
},
17321723
Spec: corev1.ServiceSpec{
1733-
Type: corev1.ServiceTypeClusterIP,
1734-
ClusterIP: "None",
1724+
Type: corev1.ServiceTypeClusterIP,
17351725
Selector: map[string]string{
17361726
"app.kubernetes.io/component": "redis",
17371727
"app.kubernetes.io/name": name,

0 commit comments

Comments
 (0)