-
Notifications
You must be signed in to change notification settings - Fork 899
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add warning log when duplicate key is detected in environment config merge #5583
Comments
That's by design, selected EnvironmentConfigs are meant to be merged in the order they were specified, if access to all EnvironmentConfigs is needed please look at https://github.com/crossplane-contrib/function-extra-resources |
@phisco Hmmm, I might be missing something here -- but this issue isn't really concerned with the order in which the env configs are merged. This issue is geared towards emitting an error/warning message when a composition selects multiple EnvironmentConfigs via a label, and those env configs have duplicate keys. Since it's a single label selector, there's no way to define the order of the env configs that match the label selector. If two env configs that contain the same key (but different value) are being merged (via a single label selector), Crossplane will silently merge the maps and overwrite the previous key's value with the key value in the map being merged. This could cause undesired behavior if the platform engineer / composition developer is not aware of it. A simple warning/event would help reduce the possibility of this undesired behavior going unnoticed. For example: Imagine a platform team has developed a composition with this env config selector:
Now, imagine there are two env configs with label eg: apiVersion: apiextensions.crossplane.io/v1alpha1
kind: EnvironmentConfig
metadata:
name: env-config-1
labels:
my-label-key: my-label-value
data:
data: "my data"
---
apiVersion: apiextensions.crossplane.io/v1alpha1
kind: EnvironmentConfig
metadata:
name: env-config-2
labels:
my-label-key: my-label-value
data:
data: "my data3" When Crossplane merges these maps it isn't immediately clear which value the final map will have for Hope that clarifies, and please let me know if I'm still missing something. |
What problem are you facing?
When using an environment config selector with
mode: Multiple
it’s possible for two environment configs to be selected that contain the same key with different values. When the environment configs are merged, one of the values ends up being overwritten with no warning log/event emitted.I think it would be useful to composition developers/platform engineers to see some sort of warning when duplicate keys are merged into one map when using
mode: Multiple
environmentconfig selector.How could Crossplane help solve your problem?
Add a warning log/event when duplicate keys are found during environmentconfig merge for
mode: Multiple
.The text was updated successfully, but these errors were encountered: