Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: rediscluster support hostnetwork and custom port #723

Merged
merged 21 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/e2e-chainsaw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
testpath:
- ./tests/e2e-chainsaw/v1beta2/teardown/
- ./tests/e2e-chainsaw/v1beta2/setup/
- ./tests/e2e-chainsaw/v1beta2/hostnetwork/

steps:
- name: Checkout code
Expand All @@ -39,6 +40,9 @@ jobs:
chmod +x kubectl
sudo mv kubectl /usr/local/bin/

# - name: Install Redis
# uses: shogo82148/actions-setup-redis@v1

- name: Create k8s Kind Cluster
uses: helm/[email protected]
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
- ./tests/e2e/v1beta2/teardown
- ./tests/e2e/v1beta2/ignore-annots
- ./tests/e2e/v1beta2/scaling
- ./tests/e2e/v1beta2/hostnetwork

steps:
- name: Checkout code
Expand Down
10 changes: 10 additions & 0 deletions api/v1beta2/rediscluster_default.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package v1beta2

import "k8s.io/utils/pointer"

// SetDefault sets default values for the RedisCluster object.
func (r *RedisCluster) SetDefault() {
if r.Spec.Port == nil {
r.Spec.Port = pointer.Int(6379)
}
}
3 changes: 3 additions & 0 deletions api/v1beta2/rediscluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ import (
type RedisClusterSpec struct {
Size *int32 `json:"clusterSize"`
KubernetesConfig KubernetesConfig `json:"kubernetesConfig"`
HostNetwork bool `json:"hostNetwork,omitempty"`
// +kubebuilder:default:=6379
Port *int `json:"port,omitempty"`
// +kubebuilder:default:=v7
ClusterVersion *string `json:"clusterVersion,omitempty"`
// +kubebuilder:default:={livenessProbe:{initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3}, readinessProbe:{initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3}}
Expand Down
5 changes: 5 additions & 0 deletions api/v1beta2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -5297,6 +5297,8 @@ spec:
- name
type: object
type: array
hostNetwork:
type: boolean
initContainer:
description: InitContainer for each Redis pods
properties:
Expand Down Expand Up @@ -5792,6 +5794,9 @@ spec:
type: string
type: object
type: object
port:
default: 6379
type: integer
priorityClassName:
type: string
redisExporter:
Expand Down
1 change: 1 addition & 0 deletions controllers/rediscluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
}
return ctrl.Result{}, err
}
instance.SetDefault()

Check warning on line 58 in controllers/rediscluster_controller.go

View check run for this annotation

Codecov / codecov/patch

controllers/rediscluster_controller.go#L58

Added line #L58 was not covered by tests

if _, found := instance.ObjectMeta.GetAnnotations()["rediscluster.opstreelabs.in/skip-reconcile"]; found {
reqLogger.Info("Found annotations rediscluster.opstreelabs.in/skip-reconcile, so skipping reconcile")
Expand Down
33 changes: 17 additions & 16 deletions k8sutils/cluster-scaling.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import (
"context"
"fmt"
"strconv"
"strings"

Expand Down Expand Up @@ -32,9 +33,9 @@
cmd = []string{"redis-cli", "--cluster", "reshard"}

if *cr.Spec.ClusterVersion == "v7" {
cmd = append(cmd, getRedisHostname(transferPOD, cr, "leader")+":6379")
cmd = append(cmd, getRedisHostname(transferPOD, cr, "leader")+fmt.Sprintf(":%d", *cr.Spec.Port))

Check warning on line 36 in k8sutils/cluster-scaling.go

View check run for this annotation

Codecov / codecov/patch

k8sutils/cluster-scaling.go#L36

Added line #L36 was not covered by tests
} else {
cmd = append(cmd, getRedisServerIP(client, logger, transferPOD)+":6379")
cmd = append(cmd, getRedisServerIP(client, logger, transferPOD)+fmt.Sprintf(":%d", *cr.Spec.Port))

Check warning on line 38 in k8sutils/cluster-scaling.go

View check run for this annotation

Codecov / codecov/patch

k8sutils/cluster-scaling.go#L38

Added line #L38 was not covered by tests
}

if cr.Spec.KubernetesConfig.ExistingPasswordSecret != nil {
Expand Down Expand Up @@ -157,9 +158,9 @@
cmd = []string{"redis-cli", "--cluster", "rebalance"}

if *cr.Spec.ClusterVersion == "v7" {
cmd = append(cmd, getRedisHostname(pod, cr, "leader")+":6379")
cmd = append(cmd, getRedisHostname(pod, cr, "leader")+fmt.Sprintf(":%d", *cr.Spec.Port))

Check warning on line 161 in k8sutils/cluster-scaling.go

View check run for this annotation

Codecov / codecov/patch

k8sutils/cluster-scaling.go#L161

Added line #L161 was not covered by tests
} else {
cmd = append(cmd, getRedisServerIP(client, logger, pod)+":6379")
cmd = append(cmd, getRedisServerIP(client, logger, pod)+fmt.Sprintf(":%d", *cr.Spec.Port))

Check warning on line 163 in k8sutils/cluster-scaling.go

View check run for this annotation

Codecov / codecov/patch

k8sutils/cluster-scaling.go#L163

Added line #L163 was not covered by tests
}

cmd = append(cmd, "--cluster-use-empty-masters")
Expand Down Expand Up @@ -209,9 +210,9 @@
cmd = []string{"redis-cli", "--cluster", "rebalance"}

if *cr.Spec.ClusterVersion == "v7" {
cmd = append(cmd, getRedisHostname(pod, cr, "leader")+":6379")
cmd = append(cmd, getRedisHostname(pod, cr, "leader")+fmt.Sprintf(":%d", *cr.Spec.Port))

Check warning on line 213 in k8sutils/cluster-scaling.go

View check run for this annotation

Codecov / codecov/patch

k8sutils/cluster-scaling.go#L213

Added line #L213 was not covered by tests
} else {
cmd = append(cmd, getRedisServerIP(client, logger, pod)+":6379")
cmd = append(cmd, getRedisServerIP(client, logger, pod)+fmt.Sprintf(":%d", *cr.Spec.Port))

Check warning on line 215 in k8sutils/cluster-scaling.go

View check run for this annotation

Codecov / codecov/patch

k8sutils/cluster-scaling.go#L215

Added line #L215 was not covered by tests
}

if cr.Spec.KubernetesConfig.ExistingPasswordSecret != nil {
Expand Down Expand Up @@ -246,11 +247,11 @@
cmd = []string{"redis-cli", "--cluster", "add-node"}

if *cr.Spec.ClusterVersion == "v7" {
cmd = append(cmd, getRedisHostname(newPod, cr, "leader")+":6379")
cmd = append(cmd, getRedisHostname(existingPod, cr, "leader")+":6379")
cmd = append(cmd, getRedisHostname(newPod, cr, "leader")+fmt.Sprintf(":%d", *cr.Spec.Port))
cmd = append(cmd, getRedisHostname(existingPod, cr, "leader")+fmt.Sprintf(":%d", *cr.Spec.Port))

Check warning on line 251 in k8sutils/cluster-scaling.go

View check run for this annotation

Codecov / codecov/patch

k8sutils/cluster-scaling.go#L250-L251

Added lines #L250 - L251 were not covered by tests
} else {
cmd = append(cmd, getRedisServerIP(client, logger, newPod)+":6379")
cmd = append(cmd, getRedisServerIP(client, logger, existingPod)+":6379")
cmd = append(cmd, getRedisServerIP(client, logger, newPod)+fmt.Sprintf(":%d", *cr.Spec.Port))
cmd = append(cmd, getRedisServerIP(client, logger, existingPod)+fmt.Sprintf(":%d", *cr.Spec.Port))

Check warning on line 254 in k8sutils/cluster-scaling.go

View check run for this annotation

Codecov / codecov/patch

k8sutils/cluster-scaling.go#L253-L254

Added lines #L253 - L254 were not covered by tests
}

if cr.Spec.KubernetesConfig.ExistingPasswordSecret != nil {
Expand Down Expand Up @@ -327,9 +328,9 @@

cmd = append(cmd, "--cluster", "del-node")
if *cr.Spec.ClusterVersion == "v7" {
cmd = append(cmd, getRedisHostname(existingPod, cr, "leader")+":6379")
cmd = append(cmd, getRedisHostname(existingPod, cr, "leader")+fmt.Sprintf(":%d", *cr.Spec.Port))

Check warning on line 331 in k8sutils/cluster-scaling.go

View check run for this annotation

Codecov / codecov/patch

k8sutils/cluster-scaling.go#L331

Added line #L331 was not covered by tests
} else {
cmd = append(cmd, getRedisServerIP(client, logger, existingPod)+":6379")
cmd = append(cmd, getRedisServerIP(client, logger, existingPod)+fmt.Sprintf(":%d", *cr.Spec.Port))

Check warning on line 333 in k8sutils/cluster-scaling.go

View check run for this annotation

Codecov / codecov/patch

k8sutils/cluster-scaling.go#L333

Added line #L333 was not covered by tests
}

for _, followerNodeID := range followerNodeIDs {
Expand Down Expand Up @@ -358,9 +359,9 @@
cmd = []string{"redis-cli", "--cluster", "del-node"}

if *cr.Spec.ClusterVersion == "v7" {
cmd = append(cmd, getRedisHostname(existingPod, cr, "leader")+":6379")
cmd = append(cmd, getRedisHostname(existingPod, cr, "leader")+fmt.Sprintf(":%d", *cr.Spec.Port))

Check warning on line 362 in k8sutils/cluster-scaling.go

View check run for this annotation

Codecov / codecov/patch

k8sutils/cluster-scaling.go#L362

Added line #L362 was not covered by tests
} else {
cmd = append(cmd, getRedisServerIP(client, logger, existingPod)+":6379")
cmd = append(cmd, getRedisServerIP(client, logger, existingPod)+fmt.Sprintf(":%d", *cr.Spec.Port))

Check warning on line 364 in k8sutils/cluster-scaling.go

View check run for this annotation

Codecov / codecov/patch

k8sutils/cluster-scaling.go#L364

Added line #L364 was not covered by tests
}

removePodNodeID := getRedisNodeID(ctx, client, logger, cr, removePod)
Expand Down Expand Up @@ -419,9 +420,9 @@
cmd = []string{"redis-cli", "cluster", "failover"}

if *cr.Spec.ClusterVersion == "v7" {
cmd = append(cmd, getRedisHostname(pod, cr, "leader")+":6379")
cmd = append(cmd, getRedisHostname(pod, cr, "leader")+fmt.Sprintf(":%d", *cr.Spec.Port))

Check warning on line 423 in k8sutils/cluster-scaling.go

View check run for this annotation

Codecov / codecov/patch

k8sutils/cluster-scaling.go#L423

Added line #L423 was not covered by tests
} else {
cmd = append(cmd, getRedisServerIP(client, logger, pod)+":6379")
cmd = append(cmd, getRedisServerIP(client, logger, pod)+fmt.Sprintf(":%d", *cr.Spec.Port))

Check warning on line 425 in k8sutils/cluster-scaling.go

View check run for this annotation

Codecov / codecov/patch

k8sutils/cluster-scaling.go#L425

Added line #L425 was not covered by tests
}

if cr.Spec.KubernetesConfig.ExistingPasswordSecret != nil {
Expand Down
8 changes: 5 additions & 3 deletions k8sutils/redis-cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
ServiceAccountName: cr.Spec.ServiceAccountName,
UpdateStrategy: cr.Spec.KubernetesConfig.UpdateStrategy,
IgnoreAnnotations: cr.Spec.KubernetesConfig.IgnoreAnnotations,
HostNetwork: cr.Spec.HostNetwork,
}
if cr.Spec.RedisExporter != nil {
res.EnableMetrics = cr.Spec.RedisExporter.Enabled
Expand Down Expand Up @@ -100,6 +101,7 @@
ImagePullPolicy: cr.Spec.KubernetesConfig.ImagePullPolicy,
Resources: cr.Spec.KubernetesConfig.Resources,
SecurityContext: securityContext,
Port: cr.Spec.Port,
}
if cr.Spec.EnvVars != nil {
containerProp.EnvVars = cr.Spec.EnvVars
Expand Down Expand Up @@ -246,12 +248,12 @@
objectMetaInfo := generateObjectMetaInformation(serviceName, cr.Namespace, labels, annotations)
headlessObjectMetaInfo := generateObjectMetaInformation(serviceName+"-headless", cr.Namespace, labels, annotations)
additionalObjectMetaInfo := generateObjectMetaInformation(serviceName+"-additional", cr.Namespace, labels, generateServiceAnots(cr.ObjectMeta, additionalServiceAnnotations))
err := CreateOrUpdateService(cr.Namespace, headlessObjectMetaInfo, redisClusterAsOwner(cr), false, true, "ClusterIP")
err := CreateOrUpdateService(cr.Namespace, headlessObjectMetaInfo, redisClusterAsOwner(cr), false, true, "ClusterIP", *cr.Spec.Port)

Check warning on line 251 in k8sutils/redis-cluster.go

View check run for this annotation

Codecov / codecov/patch

k8sutils/redis-cluster.go#L251

Added line #L251 was not covered by tests
if err != nil {
logger.Error(err, "Cannot create headless service for Redis", "Setup.Type", service.RedisServiceRole)
return err
}
err = CreateOrUpdateService(cr.Namespace, objectMetaInfo, redisClusterAsOwner(cr), enableMetrics, false, "ClusterIP")
err = CreateOrUpdateService(cr.Namespace, objectMetaInfo, redisClusterAsOwner(cr), enableMetrics, false, "ClusterIP", *cr.Spec.Port)

Check warning on line 256 in k8sutils/redis-cluster.go

View check run for this annotation

Codecov / codecov/patch

k8sutils/redis-cluster.go#L256

Added line #L256 was not covered by tests
if err != nil {
logger.Error(err, "Cannot create service for Redis", "Setup.Type", service.RedisServiceRole)
return err
Expand All @@ -260,7 +262,7 @@
if cr.Spec.KubernetesConfig.Service != nil {
additionalServiceType = cr.Spec.KubernetesConfig.Service.ServiceType
}
err = CreateOrUpdateService(cr.Namespace, additionalObjectMetaInfo, redisClusterAsOwner(cr), false, false, additionalServiceType)
err = CreateOrUpdateService(cr.Namespace, additionalObjectMetaInfo, redisClusterAsOwner(cr), false, false, additionalServiceType, *cr.Spec.Port)

Check warning on line 265 in k8sutils/redis-cluster.go

View check run for this annotation

Codecov / codecov/patch

k8sutils/redis-cluster.go#L265

Added line #L265 was not covered by tests
if err != nil {
logger.Error(err, "Cannot create additional service for Redis", "Setup.Type", service.RedisServiceRole)
return err
Expand Down
6 changes: 3 additions & 3 deletions k8sutils/redis-replication.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
objectMetaInfo := generateObjectMetaInformation(cr.ObjectMeta.Name, cr.Namespace, labels, annotations)
headlessObjectMetaInfo := generateObjectMetaInformation(cr.ObjectMeta.Name+"-headless", cr.Namespace, labels, annotations)
additionalObjectMetaInfo := generateObjectMetaInformation(cr.ObjectMeta.Name+"-additional", cr.Namespace, labels, generateServiceAnots(cr.ObjectMeta, additionalServiceAnnotations))
err := CreateOrUpdateService(cr.Namespace, headlessObjectMetaInfo, redisReplicationAsOwner(cr), false, true, "ClusterIP")
err := CreateOrUpdateService(cr.Namespace, headlessObjectMetaInfo, redisReplicationAsOwner(cr), false, true, "ClusterIP", redisPort)

Check warning on line 22 in k8sutils/redis-replication.go

View check run for this annotation

Codecov / codecov/patch

k8sutils/redis-replication.go#L22

Added line #L22 was not covered by tests
if err != nil {
logger.Error(err, "Cannot create replication headless service for Redis")
return err
}
err = CreateOrUpdateService(cr.Namespace, objectMetaInfo, redisReplicationAsOwner(cr), enableMetrics, false, "ClusterIP")
err = CreateOrUpdateService(cr.Namespace, objectMetaInfo, redisReplicationAsOwner(cr), enableMetrics, false, "ClusterIP", redisPort)

Check warning on line 27 in k8sutils/redis-replication.go

View check run for this annotation

Codecov / codecov/patch

k8sutils/redis-replication.go#L27

Added line #L27 was not covered by tests
if err != nil {
logger.Error(err, "Cannot create replication service for Redis")
return err
Expand All @@ -33,7 +33,7 @@
if cr.Spec.KubernetesConfig.Service != nil {
additionalServiceType = cr.Spec.KubernetesConfig.Service.ServiceType
}
err = CreateOrUpdateService(cr.Namespace, additionalObjectMetaInfo, redisReplicationAsOwner(cr), false, false, additionalServiceType)
err = CreateOrUpdateService(cr.Namespace, additionalObjectMetaInfo, redisReplicationAsOwner(cr), false, false, additionalServiceType, redisPort)

Check warning on line 36 in k8sutils/redis-replication.go

View check run for this annotation

Codecov / codecov/patch

k8sutils/redis-replication.go#L36

Added line #L36 was not covered by tests
if err != nil {
logger.Error(err, "Cannot create additional service for Redis Replication")
return err
Expand Down
6 changes: 3 additions & 3 deletions k8sutils/redis-sentinel.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,12 @@
headlessObjectMetaInfo := generateObjectMetaInformation(serviceName+"-headless", cr.Namespace, labels, annotations)
additionalObjectMetaInfo := generateObjectMetaInformation(serviceName+"-additional", cr.Namespace, labels, generateServiceAnots(cr.ObjectMeta, additionalServiceAnnotations))

err := CreateOrUpdateService(cr.Namespace, headlessObjectMetaInfo, redisSentinelAsOwner(cr), false, true, "ClusterIP")
err := CreateOrUpdateService(cr.Namespace, headlessObjectMetaInfo, redisSentinelAsOwner(cr), false, true, "ClusterIP", sentinelPort)

Check warning on line 218 in k8sutils/redis-sentinel.go

View check run for this annotation

Codecov / codecov/patch

k8sutils/redis-sentinel.go#L218

Added line #L218 was not covered by tests
if err != nil {
logger.Error(err, "Cannot create headless service for Redis", "Setup.Type", service.RedisServiceRole)
return err
}
err = CreateOrUpdateService(cr.Namespace, objectMetaInfo, redisSentinelAsOwner(cr), enableMetrics, false, "ClusterIP")
err = CreateOrUpdateService(cr.Namespace, objectMetaInfo, redisSentinelAsOwner(cr), enableMetrics, false, "ClusterIP", sentinelPort)

Check warning on line 223 in k8sutils/redis-sentinel.go

View check run for this annotation

Codecov / codecov/patch

k8sutils/redis-sentinel.go#L223

Added line #L223 was not covered by tests
if err != nil {
logger.Error(err, "Cannot create service for Redis", "Setup.Type", service.RedisServiceRole)
return err
Expand All @@ -230,7 +230,7 @@
if cr.Spec.KubernetesConfig.Service != nil {
additionalServiceType = cr.Spec.KubernetesConfig.Service.ServiceType
}
err = CreateOrUpdateService(cr.Namespace, additionalObjectMetaInfo, redisSentinelAsOwner(cr), false, false, additionalServiceType)
err = CreateOrUpdateService(cr.Namespace, additionalObjectMetaInfo, redisSentinelAsOwner(cr), false, false, additionalServiceType, sentinelPort)

Check warning on line 233 in k8sutils/redis-sentinel.go

View check run for this annotation

Codecov / codecov/patch

k8sutils/redis-sentinel.go#L233

Added line #L233 was not covered by tests
if err != nil {
logger.Error(err, "Cannot create additional service for Redis", "Setup.Type", service.RedisServiceRole)
return err
Expand Down
86 changes: 86 additions & 0 deletions k8sutils/redis-sentinel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package k8sutils

import (
"context"
"k8s.io/client-go/kubernetes"
"os"
"path/filepath"
"reflect"
"testing"

common "github.com/OT-CONTAINER-KIT/redis-operator/api"
Expand Down Expand Up @@ -246,3 +248,87 @@ func Test_generateRedisSentinelInitContainerParams(t *testing.T) {
actual := generateRedisSentinelInitContainerParams(input)
assert.EqualValues(t, expected, actual, "Expected %+v, got %+v", expected, actual)
}

func Test_getSentinelEnvVariable(t *testing.T) {
type args struct {
ctx context.Context
client kubernetes.Interface
logger logr.Logger
cr *redisv1beta2.RedisSentinel
}
tests := []struct {
name string
args args
want *[]corev1.EnvVar
}{
{
name: "When RedisSentinelConfig is nil",
args: args{
ctx: context.TODO(),
client: nil,
logger: logr.Logger{},
cr: &redisv1beta2.RedisSentinel{},
},
want: &[]corev1.EnvVar{},
},
{
name: "When RedisSentinelConfig is not nil",
args: args{
ctx: context.TODO(),
client: nil,
logger: logr.Logger{},
cr: &redisv1beta2.RedisSentinel{
Spec: redisv1beta2.RedisSentinelSpec{
RedisSentinelConfig: &redisv1beta2.RedisSentinelConfig{
RedisSentinelConfig: common.RedisSentinelConfig{
MasterGroupName: "master",
RedisPort: "6379",
Quorum: "2",
DownAfterMilliseconds: "30000",
ParallelSyncs: "1",
FailoverTimeout: "180000",
},
},
},
},
},
want: &[]corev1.EnvVar{
{
Name: "MASTER_GROUP_NAME",
Value: "master",
},
{
Name: "IP",
Value: "",
},
{
Name: "PORT",
Value: "6379",
},
{
Name: "QUORUM",
Value: "2",
},
{
Name: "DOWN_AFTER_MILLISECONDS",
Value: "30000",
},
{
Name: "PARALLEL_SYNCS",
Value: "1",
},
{
Name: "FAILOVER_TIMEOUT",
Value: "180000",
},
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := getSentinelEnvVariable(tt.args.ctx, tt.args.client, tt.args.logger, tt.args.cr); !reflect.DeepEqual(got, tt.want) {
t.Errorf("getSentinelEnvVariable() = %v, want %v", got, tt.want)
}
})
}
}
6 changes: 3 additions & 3 deletions k8sutils/redis-standalone.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
objectMetaInfo := generateObjectMetaInformation(cr.ObjectMeta.Name, cr.Namespace, labels, annotations)
headlessObjectMetaInfo := generateObjectMetaInformation(cr.ObjectMeta.Name+"-headless", cr.Namespace, labels, annotations)
additionalObjectMetaInfo := generateObjectMetaInformation(cr.ObjectMeta.Name+"-additional", cr.Namespace, labels, generateServiceAnots(cr.ObjectMeta, additionalServiceAnnotations))
err := CreateOrUpdateService(cr.Namespace, headlessObjectMetaInfo, redisAsOwner(cr), false, true, "ClusterIP")
err := CreateOrUpdateService(cr.Namespace, headlessObjectMetaInfo, redisAsOwner(cr), false, true, "ClusterIP", redisPort)

Check warning on line 26 in k8sutils/redis-standalone.go

View check run for this annotation

Codecov / codecov/patch

k8sutils/redis-standalone.go#L26

Added line #L26 was not covered by tests
if err != nil {
logger.Error(err, "Cannot create standalone headless service for Redis")
return err
}
err = CreateOrUpdateService(cr.Namespace, objectMetaInfo, redisAsOwner(cr), enableMetrics, false, "ClusterIP")
err = CreateOrUpdateService(cr.Namespace, objectMetaInfo, redisAsOwner(cr), enableMetrics, false, "ClusterIP", redisPort)

Check warning on line 31 in k8sutils/redis-standalone.go

View check run for this annotation

Codecov / codecov/patch

k8sutils/redis-standalone.go#L31

Added line #L31 was not covered by tests
if err != nil {
logger.Error(err, "Cannot create standalone service for Redis")
return err
Expand All @@ -37,7 +37,7 @@
if cr.Spec.KubernetesConfig.Service != nil {
additionalServiceType = cr.Spec.KubernetesConfig.Service.ServiceType
}
err = CreateOrUpdateService(cr.Namespace, additionalObjectMetaInfo, redisAsOwner(cr), false, false, additionalServiceType)
err = CreateOrUpdateService(cr.Namespace, additionalObjectMetaInfo, redisAsOwner(cr), false, false, additionalServiceType, redisPort)

Check warning on line 40 in k8sutils/redis-standalone.go

View check run for this annotation

Codecov / codecov/patch

k8sutils/redis-standalone.go#L40

Added line #L40 was not covered by tests
if err != nil {
logger.Error(err, "Cannot create additional service for Redis")
return err
Expand Down
Loading
Loading