grafana / crossplane-provider-grafana

Crossplane provider of https://github.com/grafana/terraform-provider-grafana. Generated by https://github.com/upbound/upjet
Apache License 2.0
26 stars 14 forks source link

Configure resources for sync reconcile #53

Closed patst closed 10 months ago

patst commented 10 months ago

Description of your changes

I reconfigured the resources to not be created/modified asynchronous. The upjet docs state the the UseAsync flag should be set to true for resources whose creation and/or deletion takes more than 1 minute (see https://github.com/crossplane/upjet/blob/c4a76d2a7505a45d94f491e496fda5391c3931ae/pkg/config/resource.go#L294 ).

Making this change we saw a performance gain around 30% creating 1000 folder MRs, probably because the amount of reconcile roundtrips is lower.

Additional to that we have the issue that sometimes resources never get into Ready + Reconciled state because some async process is not finished in time. We have set a very high value for the poll-interval(24h) to reduce the CPU load. Since all resources are created by Crossplane there never should be any changes in the Grafana instance which needs to be polled, except for the async resource creation status which gets obsolete after this PR.

What do you think?

I have:

How has this code been tested

I ran the test cases and built the provider locally testing it in k3s and our DEV cluster.

patst commented 10 months ago

Makes sense. I assumed that sync was the default setting. One thing though: Could you set grafana_cloud_stack to be async? This one can take ~2-3m, I think it's a good candidate for async creation

thanks for the super fast reply. I was surprised to see the default set to true as well (https://github.com/crossplane/upjet/blob/c4a76d2a7505a45d94f491e496fda5391c3931ae/pkg/config/common.go#L88C6-L88C6).

I configured the grafana_cloud_stack resource to async.