-
Notifications
You must be signed in to change notification settings - Fork 10
chore(base-cluster/dependencies)!: update helm release velero to v11 - abandoned #1827
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,9 @@ | ||
| {{- if (.Values.backup.provider).velero }} | ||
| {{- range $index, $repo := (lookup "velero.io/v1" "BackupRepository" "backup" "").items}} | ||
| {{- if eq $repo.spec.repositoryType "restic" }} | ||
| {{- fail (printf "The Backuprepository '%s' is of unsupported type restic" $repo.metadata.name) }} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aren't they namespaced? If yes you should also print out the namespace |
||
| {{- end }} | ||
| {{- end }} | ||
|
Comment on lines
+2
to
+6
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # First, let's examine the actual file to see the code at lines 2-6
cat -n charts/base-cluster/templates/backup/velero/velero.yaml | head -20Repository: teutonet/teutonet-helm-charts Length of output: 963 🏁 Script executed: # Also check if there's context around this - let's see a wider range
wc -l charts/base-cluster/templates/backup/velero/velero.yamlRepository: teutonet/teutonet-helm-charts Length of output: 133 🏁 Script executed: # Search for similar lookup() patterns in the repository to see how they're handled
rg "lookup\s*\(" charts/ -A 2 -B 1 | head -100Repository: teutonet/teutonet-helm-charts Length of output: 55 🌐 Web query:
💡 Result: In Helm templates, the lookup function returns an empty map/dict {} when no matching resources are found in the cluster (or during helm template/--dry-run without cluster access). This empty map does not have an .items field. Accessing .items on an empty lookup result causes a "nil pointer" or similar template error because .items is nil/undefined. To safely handle this: 1. Check if lookup returned a non-empty result before accessing .items: {{- $lookupResult := lookup "v1" "Service" "mynamespace" "" }} {{- if $lookupResult }} {{- range $service := $lookupResult.items }} # process $service {{- end }} {{- end }} 2. For list lookups (empty name ""), check length: {{- if eq (len (lookup "v1" "Service" "mynamespace" "")) 0 }} # No services found {{- else }} # Services exist {{- end }} The official Helm docs confirm: "When lookup returns a list of objects, it is possible to access the object list via the items field" but "When no object is found, an empty value is returned." The Go template source code explicitly returns map[string]interface{}{} (empty map) on not found, enabling if not (lookup ...) checks. Always wrap .items access in if $lookupResult to avoid errors. Citations:
🏁 Script executed: # Check if there's any error handling or similar patterns in the templates
rg "if.*lookup\|if.*\$" charts/base-cluster/templates/ -A 2 -B 1 | head -50Repository: teutonet/teutonet-helm-charts Length of output: 55 🏁 Script executed: # Look for any Helm documentation or comments about lookup in the codebase
rg -i "lookup.*backuprepository\|backuprepository.*lookup" charts/Repository: teutonet/teutonet-helm-charts Length of output: 55 🏁 Script executed: # Check the git history to understand when this was added and why
git log --oneline -n 20 -- charts/base-cluster/templates/backup/velero/velero.yamlRepository: teutonet/teutonet-helm-charts Length of output: 150 🏁 Script executed: # Let's check the full context of how this template is used - are BackupRepositories always present?
cat -n charts/base-cluster/templates/backup/velero/velero.yaml | sed -n '1,30p'Repository: teutonet/teutonet-helm-charts Length of output: 1212 🏁 Script executed: # Check if there's any documentation or values file that explains the expected state
find charts/base-cluster -name "*.md" -o -name "*values*" | xargs rg -l "BackupRepository\|velero" 2>/dev/nullRepository: teutonet/teutonet-helm-charts Length of output: 57 🏁 Script executed: # Check the values defaults
fd "values" charts/base-cluster/ --type f | head -5Repository: teutonet/teutonet-helm-charts Length of output: 307 🏁 Script executed: # Check if there's documentation about the velero setup and expected state
cat -n charts/base-cluster/templates/backup/velero/README.md 2>/dev/null || echo "No README found"Repository: teutonet/teutonet-helm-charts Length of output: 89 🏁 Script executed: # Look at the chart's values.yaml to understand defaults
cat charts/base-cluster/values.yaml | grep -A 20 "backup:" | head -30Repository: teutonet/teutonet-helm-charts Length of output: 881 🏁 Script executed: # Verify if this pattern is consistently an issue - check when lookup is used without guarding
rg "lookup.*\(" charts/ -A 1 | grep -E "lookup|\.items" | head -20Repository: teutonet/teutonet-helm-charts Length of output: 851 Guard the The 🔧 Proposed fix {{- if (.Values.backup.provider).velero }}
-{{- range $index, $repo := (lookup "velero.io/v1" "BackupRepository" "backup" "").items}}
- {{- if eq $repo.spec.repositoryType "restic" }}
- {{- fail (printf "The Backuprepository '%s' is of unsupported type restic" $repo.metadata.name) }}
- {{- end }}
-{{- end }}
+{{- $repos := lookup "velero.io/v1" "BackupRepository" "backup" "" -}}
+{{- if $repos }}
+{{- range $repo := $repos.items }}
+ {{- if eq $repo.spec.repositoryType "restic" }}
+ {{- fail (printf "The BackupRepository '%s' is of unsupported type restic" $repo.metadata.name) }}
+ {{- end }}
+{{- end }}
+{{- end }}
apiVersion: helm.toolkit.fluxcd.io/v2🤖 Prompt for AI Agents |
||
| apiVersion: helm.toolkit.fluxcd.io/v2 | ||
| kind: HelmRelease | ||
| metadata: | ||
|
|
@@ -51,6 +56,16 @@ spec: | |
| allowPrivilegeEscalation: false | ||
| seccompProfile: | ||
| type: RuntimeDefault | ||
| extraVolumeMounts: | ||
| - mountPath: /udmrepo | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why |
||
| name: udmrepo | ||
| - mountPath: /.cache | ||
| name: cache | ||
| extraVolumes: | ||
| - emptyDir: {} | ||
| name: udmrepo | ||
| - emptyDir: {} | ||
| name: cache | ||
| resources: {{- include "common.resources" .Values.backup | nindent 6 }} | ||
| priorityClassName: system-cluster-critical | ||
| deployNodeAgent: true # enable FSB | ||
|
|
@@ -88,7 +103,7 @@ spec: | |
| {{- end }} | ||
| {{- end }} | ||
| volumeSnapshotLocation: [] | ||
| uploaderType: restic | ||
| uploaderType: kopia | ||
| metrics: | ||
| serviceMonitor: | ||
| additionalLabels: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -210,7 +210,7 @@ global: | |
| vmware: | ||
| url: https://vmware-tanzu.github.io/helm-charts | ||
| charts: | ||
| velero: 7.2.2 | ||
| velero: 11.3.2 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wasn't there 12 already released? |
||
| condition: '{{ ne (.Values.backup.provider).velero nil }}' | ||
| twin: | ||
| url: https://twin.github.io/helm-charts | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need the index