Skip to content

Commit

Permalink
Add support for Redis TLS
Browse files Browse the repository at this point in the history
  • Loading branch information
mishok13 committed Aug 26, 2024
1 parent b9773cc commit 77de6b9
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 7 deletions.
2 changes: 1 addition & 1 deletion LICENCE
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
5 changes: 3 additions & 2 deletions charts/sentry/templates/_helper-sentry-relay.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{{- $redisHost := include "sentry.redis.host" . -}}
{{- $redisPort := include "sentry.redis.port" . -}}
{{- $redisPass := include "sentry.redis.password" . -}}
{{- $redisScheme := include "sentry.redis.scheme" . -}}
config.yml: |-
relay:
{{- if .Values.relay.mode }}
Expand All @@ -28,9 +29,9 @@ config.yml: |-
value: 50000000 # 50MB or bust

{{- if $redisPass }}
redis: "redis://:{{ $redisPass }}@{{ $redisHost }}:{{ $redisPort }}"
redis: "{{ $redisScheme }}://:{{ $redisPass }}@{{ $redisHost }}:{{ $redisPort }}"
{{- else }}
redis: "redis://{{ $redisHost }}:{{ $redisPort }}"
redis: "{{ $redisScheme }}://{{ $redisHost }}:{{ $redisPort }}"
{{- end }}
topics:
metrics_sessions: ingest-metrics
Expand Down
5 changes: 3 additions & 2 deletions charts/sentry/templates/_helper-sentry.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{{- $redisHost := include "sentry.redis.host" . -}}
{{- $redisPort := include "sentry.redis.port" . -}}
{{- $redisPass := include "sentry.redis.password" . -}}
{{- $redisScheme := include "sentry.redis.scheme" . -}}
config.yml: |-
{{- if .Values.system.adminEmail }}
system.admin-email: {{ .Values.system.adminEmail | quote }}
Expand Down Expand Up @@ -182,9 +183,9 @@ sentry.conf.py: |-
{{- if or (.Values.rabbitmq.enabled) (.Values.rabbitmq.host) }}
BROKER_URL = os.environ.get("BROKER_URL", "amqp://{{ .Values.rabbitmq.auth.username }}:{{ .Values.rabbitmq.auth.password }}@{{ template "sentry.rabbitmq.host" . }}:5672/{{ .Values.rabbitmq.vhost }}")
{{- else if $redisPass }}
BROKER_URL = os.environ.get("BROKER_URL", "redis://:{{ $redisPass }}@{{ $redisHost }}:{{ $redisPort }}/0")
BROKER_URL = os.environ.get("BROKER_URL", "{{ $redisScheme }}://:{{ $redisPass }}@{{ $redisHost }}:{{ $redisPort }}/0")
{{- else }}
BROKER_URL = os.environ.get("BROKER_URL", "redis://{{ $redisHost }}:{{ $redisPort }}/0")
BROKER_URL = os.environ.get("BROKER_URL", "{{ $redisScheme }}://{{ $redisHost }}:{{ $redisPort }}/0")
{{- end }}

#########
Expand Down
15 changes: 14 additions & 1 deletion charts/sentry/templates/_helper.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,17 @@ Set redis host
{{- end -}}
{{- end -}}

{{/*
Set redis host
*/}}
{{- define "sentry.redis.scheme" -}}
{{- if .Values.redis.enabled -}}
{{- default "redis" .Values.redis.scheme }}
{{- else -}}
{{ required "A valid .Values.externalRedis.scheme is required" .Values.externalRedis.scheme }}
{{- end -}}
{{- end -}}

{{/*
Set redis secret
*/}}
Expand Down Expand Up @@ -454,6 +465,8 @@ Common Snuba environment variables
value: /etc/snuba/settings.py
- name: DEFAULT_BROKERS
value: {{ include "sentry.kafka.bootstrap_servers_string" . | quote }}
- name: REDIS_SSL
value: "True"
{{- if .Values.externalClickhouse.existingSecret }}
- name: CLICKHOUSE_PASSWORD
valueFrom:
Expand Down Expand Up @@ -620,7 +633,7 @@ Common Sentry environment variables
valueFrom:
secretKeyRef:
name: {{ .Values.discord.existingSecret }}
key: {{ default "bot-token" .Values.slack.existingSecretBotToken }}
key: {{ default "bot-token" .Values.slack.existingSecretBotToken }}
{{- end }}
{{- if and .Values.github.existingSecret }}
- name: GITHUB_APP_PRIVATE_KEY
Expand Down
2 changes: 1 addition & 1 deletion charts/sentry/templates/deployment-sentry-web.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ metadata:
spec:
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
strategy:
type: {{ .Values.sentry.web.strategyType }}
type: Recreate
selector:
matchLabels:
app: {{ template "sentry.fullname" . }}
Expand Down

0 comments on commit 77de6b9

Please sign in to comment.