From 35498766927e3b6ae7a708c095d197302895eb02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergen=20Yal=C3=A7=C4=B1n?= Date: Tue, 15 Aug 2023 10:58:41 +0200 Subject: [PATCH] Add some details to the code comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sergen Yalçın --- pkg/migration/converter.go | 4 +++- pkg/migration/registry.go | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/migration/converter.go b/pkg/migration/converter.go index 914dfd14..c8f86bbd 100644 --- a/pkg/migration/converter.go +++ b/pkg/migration/converter.go @@ -260,7 +260,9 @@ func toPackageLock(u unstructured.Unstructured) (*xppkgv1beta1.Lock, error) { return lock, nil } -// ConvertComposedTemplatePatchesMap converts the composed templates with given conversion map +// ConvertComposedTemplatePatchesMap converts the composed templates with given conversionMap +// Key of the conversionMap points to the source field +// Value of the conversionMap points to the target field func ConvertComposedTemplatePatchesMap(sourceTemplate xpv1.ComposedTemplate, conversionMap map[string]string) []xpv1.Patch { var patchesToAdd []xpv1.Patch for _, p := range sourceTemplate.Patches { diff --git a/pkg/migration/registry.go b/pkg/migration/registry.go index c9994227..b88a7b27 100644 --- a/pkg/migration/registry.go +++ b/pkg/migration/registry.go @@ -473,6 +473,8 @@ func (d *delegatingConverter) ComposedTemplate(sourceTemplate xpv1.ComposedTempl // DefaultCompositionConverter is a generic composition converter // conversionMap: is fieldpath map for conversion +// Key of the conversionMap points to the source field +// Value of the conversionMap points to the target field // Example: "spec.forProvider.assumeRolePolicyDocument": "spec.forProvider.assumeRolePolicy", // fns are functions that manipulate the patchsets func DefaultCompositionConverter(conversionMap map[string]string, fns ...func(sourceTemplate xpv1.ComposedTemplate) ([]xpv1.Patch, error)) ComposedTemplateConversionFn {