crossplane / upjet

A code generation framework and runtime for Crossplane providers
Apache License 2.0
313 stars 87 forks source link

Consider moving/removing adding default tags in Initialize step #222

Open lsviben opened 1 year ago

lsviben commented 1 year ago

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:

turkenh commented 1 year ago

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.