Skip to content

Commit

Permalink
fix input snapshot template for sets change
Browse files Browse the repository at this point in the history
  • Loading branch information
ilackarms committed May 14, 2024
1 parent 07e0c11 commit 8ee9152
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 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,26 @@ 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 8ee9152

Please sign in to comment.