Skip to content

Commit

Permalink
fix(redis-creds): do not use redisUsername if its empty (#527)
Browse files Browse the repository at this point in the history
**Description**
<!--
Please include a summary of the change and which issue is fixed. Please
also include relevant motivation and context. List any dependencies that
are required for this change.
-->
⚒️ Fixes  # <!--(issue)-->

**⚙️ Type of change**

- [ ] ⚙️ Feature/App addition
- [ ] 🪛 Bugfix
- [ ] ⚠️ Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] 🔃 Refactor of current code

**🧪 How Has This Been Tested?**
<!--
Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration
-->

**📃 Notes:**
<!-- Please enter any other relevant information here -->

**✔️ Checklist:**

- [ ] ⚖️ My code follows the style guidelines of this project
- [ ] 👀 I have performed a self-review of my own code
- [ ] #️⃣ I have commented my code, particularly in hard-to-understand
areas
- [ ] 📄 I have made corresponding changes to the documentation
- [ ] ⚠️ My changes generate no new warnings
- [ ] 🧪 I have added tests to this description that prove my fix is
effective or that my feature works
- [ ] ⬆️ I increased versions for any altered app according to semantic
versioning

**➕ App addition**

If this PR is an app addition please make sure you have done the
following.

- [ ] 🪞 I have opened a PR on
[truecharts/containers](https://github.com/truecharts/containers) adding
the container to TrueCharts mirror repo.
- [ ] 🖼️ I have added an icon in the Chart's root directory called
`icon.png`

---

_Please don't blindly check all the boxes. Read them and only check
those that apply.
Those checkboxes are there for the reviewer to see what is this all
about and
the status of this PR with a quick glance._
  • Loading branch information
stavros-k authored Oct 7, 2023
1 parent 59f6605 commit a39e1ed
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion library/common/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ maintainers:
name: common
sources: null
type: library
version: 14.0.6
version: 14.0.7
8 changes: 6 additions & 2 deletions library/common/templates/lib/dependencies/_redisInjector.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@ This template generates a random password and ensures it persists across updates
{{- $dbPass = (index $dbprevious.data "redis-password") | b64dec -}}
{{- end -}}

{{- $redisUser := .Values.redis.redisUsername -}}
{{- if not $redisUser -}}{{/* If you try to print a nil value it will print as <nil> */}}
{{- $redisUser = "" -}}
{{- end -}}
{{/* Prepare data */}}
{{- $dbHost := printf "%v-%v" .Release.Name "redis" -}}
{{- $portHost := printf "%v:6379" $dbHost -}}
{{- $url := printf "redis://%v:%v@%v/%v" .Values.redis.redisUsername $dbPass $portHost $dbIndex -}}
{{- $hostPass := printf "%v:%v@%v" .Values.redis.redisUsername $dbPass $dbHost -}}
{{- $url := printf "redis://%v:%v@%v/%v" $redisUser $dbPass $portHost $dbIndex -}}
{{- $hostPass := printf "%v:%v@%v" $redisUser $dbPass $dbHost -}}

{{/* Append some values to redis.creds, so apps using the dep, can use them */}}
{{- $_ := set .Values.redis.creds "redisPassword" ($dbPass | quote) -}}
Expand Down
3 changes: 2 additions & 1 deletion library/common/templates/lib/imagePullSecret/_createData.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ objectData:
"email" (tpl .email $rootCtx) "auth" $auth) -}}
{{- end -}}

{{- $_ := set $registrySecret "auths" (dict (tpl $objectData.data.registry $rootCtx) $registry) -}}
{{- $registryKey := tpl $objectData.data.registry $rootCtx -}}
{{- $_ := set $registrySecret "auths" (dict $registryKey $registry) -}}

{{/*
This should result in something like this:
Expand Down

0 comments on commit a39e1ed

Please sign in to comment.