Skip to content

Commit

Permalink
Fix snapshot template (#562)
Browse files Browse the repository at this point in the history
* fix snapshot template

* ch
  • Loading branch information
ilackarms committed May 14, 2024
1 parent 3e58001 commit 1ef231a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
4 changes: 4 additions & 0 deletions changelog/v0.39.1/fix-template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
changelog:
- type: FIX
description: "Fix snapshot template"
issueLink: https://github.com/solo-io/skv2/issues/563
23 changes: 13 additions & 10 deletions contrib/codegen/templates/input/input_snapshot.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -236,22 +236,25 @@ func (s *snapshot{{ $snapshotName }}) SyncStatusesMultiCluster(ctx context.Conte
{{/* generate calls to update status here */}}
{{- range $group := $groups }}
{{ $set_import_prefix := printf "%v_sets" (group_import_name $group) }}
{{- $types_import_prefix := printf "%v_types" (group_import_name $group) }}
{{- range $resource := $group.Resources }}
{{- $kindPlural := pluralize $resource.Kind }}
{{- $kindLowerCamel := lower_camel $resource.Kind }}
{{- $kindLowerCamelPlural := pluralize $kindLowerCamel }}
{{- if $resource.Status }}
if opts.{{ $resource.Kind }} {
for _, obj := range s.{{ $kindPlural }}().List() {
clusterClient, err := mcClient.Cluster(ezkube.GetClusterName(obj))
if err != nil {
errs = multierror.Append(errs, err)
continue
}
if _, err := controllerutils.UpdateStatusImmutable(ctx, clusterClient, obj); err != nil {
errs = multierror.Append(errs, err)
}
}

s.{{ $kindPlural }}().Iter(func(_ int, obj *{{ $types_import_prefix }}.{{ $resource.Kind }}) bool {
clusterClient, err := mcClient.Cluster(ezkube.GetClusterName(obj))
if err != nil {
errs = multierror.Append(errs, err)
return true
}
if _, err := controllerutils.UpdateStatusImmutable(ctx, clusterClient, obj); err != nil {
errs = multierror.Append(errs, err)
}
return true
})
}
{{- end }}
{{- end }}
Expand Down

0 comments on commit 1ef231a

Please sign in to comment.