upjet icon indicating copy to clipboard operation
upjet copied to clipboard

Consider moving/removing adding default tags in Initialize step

Open lsviben opened this issue 2 years ago • 1 comments

What problem are you facing?

With the new granular management policies users will be able, among others, to ignore changes in select fields by skipping the late initialization through dropping the "LateInitialization" ManagementPolicy and/or setting initial fields which are used only during the creation of the resource in spec.initProvider.

All in all, the goal is not to have the field we want to ignore changes for in the spec.forProvider.

But due to the special case of tags which are being added to spec.forProvider in the Initialize step of the reconciler, the tags are always present in the spec.forProvider which makes it impossible to ignore them.

Upjet Initialize code Example provider aws resource

Those tags are just some default tags that state: crossplane-kind crossplane-name crossplane-providerconfig

I am not sure if those tags are just informational or used somewhere

How could Upjet help solve your problem?

Depending on the importance of adding the default tags we could consider:

  • drop adding the tags to spec.forProvider altogather
  • move adding the default tags to the Create step, so we don't initialize them every reconciler run
  • TBD

lsviben avatar Jun 20 '23 11:06 lsviben

I am wondering if we could just set spec.initProvider.tags instead of spec.forProvider.tags with a change like the following at this line:

- if err := paved.SetValue(fmt.Sprintf("spec.forProvider.%s", fieldName), tags); err != nil {
+ if err := paved.SetValue(fmt.Sprintf("spec.initProvider.%s", fieldName), tags); err != nil {

The caveat is that this would require having spec.initProvider defined in the schema of every resource, at least for the tags.

turkenh avatar Jun 20 '23 11:06 turkenh