crossplane-contrib / crossplane-contrib/function-environment-configs

Support Resolve Policy `IfNotPresent`

Open
#6 0 comments 0 reactions 0 assignees View on GitHub
enhancement good first issue
Dominant language
Go
Stars
28
Forks
25
Avg merge
5d 19h
Merged PRs (30d)
2

Description

### What problem are you facing?

We currently don't support Resolve Policy `IfNotPresent`, but only `Always`, we could think of implementing it if needed.

Resolve Policy `IfNotPresent` was originally implemented by writing to the `XR`'s `spec.environmentConfigRefs`, Functions can only write to the `status` of the XR, so we can't do the same here, but at the end of the day, all we need is a way to "store" the EnvironmentConfigs returned the first time and only request those in subsequent calls, so we could think of some alternatives.

The `status` would be the most natural option, but usually that's not restored in case of Backup/Restores, so we should try thinking of another option.

We could output as part of the desired state an EnvironmentConfig containing the references to these resources, so that on subsequent reconciliations we could get it back as input and only request those back.

If Crossplane was to implement caching in some way, we can assume this function will get every time the same `EnvironmentConfigs` requested on the first run, so by trusting them we could effectively have `Always` resolve policy implemented with little effort.Invalidating these references in case of changes in the composition was an issue also in the original implementation AFAIR, but deleting the references from the resource spec was enough to manually invalidate it, how could we handle it here? this would probably be something to be defined at the Crossplane level though.

### How could this Function help solve your problem?

Support Resolve Policy `IfNotPresent`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.