Skip to content

Fabric8 ConfigMap vs Secrets priority/order #1338

@tomjankes

Description

@tomjankes

We used the same property name in configmap and secrets when using spring-cloud-kubernetes-fabric8-config.
The priority currently seems to be that property in secrets overrides what is stored in configmap.

Looking at the code there seems to be notion of ordering PropertySourceLocators

  • Fabric8ConfigMapPropertySourceLocator is annotated @Order(0)
  • Fabric8SecretsPropertySourceLocator is annotated @Order(1)
    and AnnotationAwareOrderComparator is used to sort those locators.

But this seems to no be the case when spring.cloud.kubernetes.config.fail-fast is enabled and retryable versions of those beans are in use:

  • RetryableFabric8ConfigMapPropertySourceLocator is annotated @Order(1)
  • RetryableFabric8SecretsPropertySourceLocator is not annotated (so I assume the annotation from parent @Order(1) is in use)
    I seems that order for ConfigMap and Secrets is not defined in case of using fail-fast/retries?

Can we rely on the order in spring-cloud-kubernetes-fabric8-config? Or we should avoid overriding config-map properties in secrets?

Describe the solution you'd like
A clear information on whether ConfigMap or Secrets takes priority should be added to documentation (alternatively notion that priority is not defined and it should not be relied upon). Or alternatively just answer in this issue would be very helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions