Skip to content

Commit

Permalink
feat: exporter connect to redis with TLS URI
Browse files Browse the repository at this point in the history
Signed-off-by: wkd-woo <[email protected]>
  • Loading branch information
wkd-woo committed Apr 29, 2024
1 parent 3c5373e commit 5378577
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/go-logr/logr v1.4.1
github.com/go-redis/redismock/v9 v9.2.0
github.com/onsi/ginkgo/v2 v2.17.1
github.com/onsi/gomega v1.32.0
github.com/onsi/gomega v1.33.0
github.com/pkg/errors v0.9.1
github.com/redis/go-redis/v9 v9.5.1
github.com/stretchr/testify v1.9.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ github.com/onsi/ginkgo/v2 v2.17.1 h1:V++EzdbhI4ZV4ev0UTIj0PzhzOcReJFyJaLjtSF55M8
github.com/onsi/ginkgo/v2 v2.17.1/go.mod h1:llBI3WDLL9Z6taip6f33H76YcWtJv+7R3HigUjbIBOs=
github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.32.0 h1:JRYU78fJ1LPxlckP6Txi/EYqJvjtMrDC04/MM5XRHPk=
github.com/onsi/gomega v1.32.0/go.mod h1:a4x4gW6Pz2yK1MAmvluYme5lvYTn61afQ2ETw/8n4Lg=
github.com/onsi/gomega v1.33.0 h1:snPCflnZrpMsy94p4lXVEkHo12lmPnc3vY5XBbreexE=
github.com/onsi/gomega v1.33.0/go.mod h1:+925n5YtiFsLzzafLUHzVMBpvvRAzrydIBiSIxjX3wY=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand Down
4 changes: 3 additions & 1 deletion k8sutils/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ func enableRedisMonitoring(params containerParameters) corev1.Container {

func getExporterEnvironmentVariables(params containerParameters) []corev1.EnvVar {
var envVars []corev1.EnvVar
redisHost := "redis://localhost:"
if params.TLSConfig != nil {
envVars = append(envVars, corev1.EnvVar{
Name: "REDIS_EXPORTER_TLS_CLIENT_KEY_FILE",
Expand All @@ -508,6 +509,7 @@ func getExporterEnvironmentVariables(params containerParameters) []corev1.EnvVar
Name: "REDIS_EXPORTER_SKIP_TLS_VERIFICATION",
Value: "true",
})
redisHost = "rediss://localhost:"
}
if params.RedisExporterPort != nil {
envVars = append(envVars, corev1.EnvVar{
Expand All @@ -518,7 +520,7 @@ func getExporterEnvironmentVariables(params containerParameters) []corev1.EnvVar
if params.Port != nil {
envVars = append(envVars, corev1.EnvVar{
Name: "REDIS_ADDR",
Value: fmt.Sprintf("redis://localhost:%d", *params.Port),
Value: redisHost + strconv.Itoa(*params.Port),
})
}
if params.EnabledPassword != nil && *params.EnabledPassword {
Expand Down

0 comments on commit 5378577

Please sign in to comment.