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

Enable custom secrets for redis password and update redigo to v1.9.2 for redis ACL support #1766

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ require (
github.com/fsnotify/fsnotify v1.6.0
github.com/go-redsync/redsync/v4 v4.8.1
github.com/golang/protobuf v1.5.3
github.com/gomodule/redigo v2.0.1-0.20191111085604-09d84710e01a+incompatible
github.com/gomodule/redigo v1.9.2
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.2
github.com/pkg/errors v0.9.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/gomodule/redigo v1.7.1-0.20190322064113-39e2c31b7ca3/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4=
github.com/gomodule/redigo v1.8.2/go.mod h1:P9dn9mFrCBvWhGE1wpxx6fgq7BAeLBk+UUUzlpkBYO0=
github.com/gomodule/redigo v2.0.1-0.20191111085604-09d84710e01a+incompatible h1:1mCVU17Wc8oyVUlx1ZXpnWz1DNP6v0R5z5ElKCTvVrY=
github.com/gomodule/redigo v2.0.1-0.20191111085604-09d84710e01a+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4=
github.com/gomodule/redigo v1.9.2 h1:HrutZBLhSIU8abiSfW8pj8mPhOyMYjZT/wcA4/L9L9s=
github.com/gomodule/redigo v1.9.2/go.mod h1:KsU3hiK/Ay8U42qpaJk+kuNa3C+spxapWpM+ywhcgtw=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I=
Expand Down
4 changes: 4 additions & 0 deletions install/helm/open-match/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,13 @@ resources:
{{- if .Values.redis.auth.enabled }}
- name: redis-password
secret:
{{- if .Values.redis.secretName }}
secretName: {{ .Values.redis.secretName }}
{{- else }}
secretName: {{ include "call-nested" (list . "redis" "common.names.fullname") }}
{{- end -}}
{{- end -}}
{{- end -}}

{{- define "openmatch.labels.nodegrouping" -}}
{{- if .Values.global.kubernetes.affinity }}
Expand Down
8 changes: 5 additions & 3 deletions internal/statestore/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ package statestore
import (
"context"
"fmt"
"io/ioutil"
"net/url"
"os"
"time"

rs "github.com/go-redsync/redsync/v4"
Expand Down Expand Up @@ -228,11 +229,12 @@ func redisURLFromAddr(addr string, cfg config.View, usePassword bool) string {
if usePassword {
passwordFile := cfg.GetString("redis.passwordPath")
redisLogger.Debugf("loading Redis password from file %s", passwordFile)
passwordData, err := ioutil.ReadFile(passwordFile)
passwordData, err := os.ReadFile(passwordFile)
if err != nil {
redisLogger.Fatalf("cannot read Redis password from file %s, desc: %s", passwordFile, err.Error())
}
redisURL += fmt.Sprintf("%s:%s@", cfg.GetString("redis.user"), string(passwordData))
redisUser := url.QueryEscape(cfg.GetString("redis.user"))
redisURL += fmt.Sprintf("%s:%s@", redisUser, url.QueryEscape(string(passwordData)))
}

return redisURL + addr
Expand Down