Skip to content

Commit

Permalink
fix(common): RESTIC_REPOSITORY does not use a valid protocol and need…
Browse files Browse the repository at this point in the history
…s 2 protocols at some cases (#30336)

**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)-->


https://restic.readthedocs.io/en/latest/030_preparing_a_new_repo.html#s3-compatible-storage
<img width="377" alt="image"
src="https://github.com/user-attachments/assets/d0fce82f-d4a4-4ae4-8141-f0936f4a0a81"
/>

**⚙️ 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
- [ ] I made sure the title starts with `feat(chart-name):`,
`fix(chart-name):` or `chore(chart-name):`

**➕ App addition**

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

- [ ] 🖼️ 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 Dec 28, 2024
1 parent a7e53f7 commit 844932e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ tests:
credentials: &credentials
mys3:
type: s3
url: http://some-url
url: https://s3.some-url
bucket: some-bucket
encrKey: some-key
accessKey: some-access-key
Expand All @@ -48,7 +48,7 @@ tests:
AWS_ACCESS_KEY_ID: some-access-key
AWS_SECRET_ACCESS_KEY: some-secret-key
RESTIC_PASSWORD: some-key
RESTIC_REPOSITORY: s3:some-url/some-bucket/test-release-name/volsync/destbackup-volsync-mybackup1
RESTIC_REPOSITORY: s3:s3.some-url/some-bucket/test-release-name/volsync/destbackup-volsync-mybackup1
- documentIndex: &replicationDestDoc 1
isKind:
of: ReplicationDestination
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ tests:
AWS_ACCESS_KEY_ID: some-access-key
AWS_SECRET_ACCESS_KEY: some-secret-key
RESTIC_PASSWORD: some-key
RESTIC_REPOSITORY: s3:some-url/some-bucket/test-release-name/volsync/srcbackup-volsync-mybackup1
RESTIC_REPOSITORY: s3:http://some-url/some-bucket/test-release-name/volsync/srcbackup-volsync-mybackup1
- documentIndex: &replicationDestDoc 1
isKind:
of: ReplicationSource
Expand Down
2 changes: 1 addition & 1 deletion charts/library/common/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ sources:
- https://hub.docker.com/_/
- https://hub.docker.com/r/mikefarah/yq
type: library
version: 25.2.3
version: 25.2.4
6 changes: 5 additions & 1 deletion charts/library/common/templates/spawner/_pvc.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@

{{- $credentials := get $.Values.credentials $volsync.credentials -}}

{{- $url := $credentials.url | replace "http://" "" | replace "https://" "" -}}
{{/* Only amazon needs the https:// trimmed, anything else requires it */}}
{{- $url := $credentials.url -}}
{{- if hasPrefix "https://s3." $url -}}
{{- $url = trimPrefix "https://" $url -}}
{{- end -}}

{{- $baseRepo := printf "s3:%s/%s" $url $credentials.bucket -}}
{{- $repoSuffix := printf "%s/volsync/%s-volsync-%s" $.Release.Name $objectData.shortName $volsyncData.name -}}
Expand Down

0 comments on commit 844932e

Please sign in to comment.