diff --git a/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/AbstractConfigProperties.java b/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/AbstractConfigProperties.java index 45df92e7..acd9a529 100644 --- a/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/AbstractConfigProperties.java +++ b/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/AbstractConfigProperties.java @@ -16,6 +16,8 @@ package org.springframework.cloud.kubernetes.commons.config; +import org.springframework.boot.context.properties.bind.DefaultValue; + /** * Abstraction over configuration properties. * @@ -38,7 +40,7 @@ public abstract class AbstractConfigProperties { protected boolean failFast = false; - protected RetryProperties retry = new RetryProperties(); + protected RetryProperties retry = RetryProperties.DEFAULT; public boolean isEnabled() { return this.enabled; @@ -98,70 +100,20 @@ public abstract class AbstractConfigProperties { /** * Kubernetes config retry properties. + * @param initialInterval Initial retry interval in milliseconds. + * @param multiplier Maximum interval for backoff. + * @param maxInterval Maximum interval + * @param maxAttempts Maximum number of attempts. + * @param enabled Retry enabled or not */ - public static class RetryProperties { + public record RetryProperties(@DefaultValue("1000") long initialInterval, @DefaultValue("1.1") double multiplier, + @DefaultValue("2000") long maxInterval, @DefaultValue("6") int maxAttempts, + @DefaultValue("true") boolean enabled) { /** - * Initial retry interval in milliseconds. + * Default instance. */ - private long initialInterval = 1000; - - /** - * Multiplier for next interval. - */ - private double multiplier = 1.1; - - /** - * Maximum interval for backoff. - */ - private long maxInterval = 2000; - - /** - * Maximum number of attempts. - */ - private int maxAttempts = 6; - - private boolean enabled = true; - - public long getInitialInterval() { - return this.initialInterval; - } - - public void setInitialInterval(long initialInterval) { - this.initialInterval = initialInterval; - } - - public double getMultiplier() { - return this.multiplier; - } - - public void setMultiplier(double multiplier) { - this.multiplier = multiplier; - } - - public long getMaxInterval() { - return this.maxInterval; - } - - public void setMaxInterval(long maxInterval) { - this.maxInterval = maxInterval; - } - - public int getMaxAttempts() { - return this.maxAttempts; - } - - public void setMaxAttempts(int maxAttempts) { - this.maxAttempts = maxAttempts; - } - - public boolean isEnabled() { - return enabled; - } - - public void setEnabled(boolean enabled) { - this.enabled = enabled; - } + public static final RetryProperties DEFAULT = new RetryProperties(1000, 1.1, 2000, 6, true); } diff --git a/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/ConfigDataRetryableConfigMapPropertySourceLocator.java b/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/ConfigDataRetryableConfigMapPropertySourceLocator.java index 84cb4f93..5a8e9351 100644 --- a/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/ConfigDataRetryableConfigMapPropertySourceLocator.java +++ b/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/ConfigDataRetryableConfigMapPropertySourceLocator.java @@ -39,9 +39,9 @@ public class ConfigDataRetryableConfigMapPropertySourceLocator extends ConfigMap ConfigMapPropertySourceLocator configMapPropertySourceLocator, ConfigMapConfigProperties properties) { super(properties); this.configMapPropertySourceLocator = configMapPropertySourceLocator; - this.retryTemplate = RetryTemplate.builder().maxAttempts(properties.getRetry().getMaxAttempts()) - .exponentialBackoff(properties.getRetry().getInitialInterval(), properties.getRetry().getMultiplier(), - properties.getRetry().getMaxInterval()) + this.retryTemplate = RetryTemplate.builder().maxAttempts(properties.getRetry().maxAttempts()) + .exponentialBackoff(properties.getRetry().initialInterval(), properties.getRetry().multiplier(), + properties.getRetry().maxInterval()) .build(); } diff --git a/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/ConfigDataRetryableSecretsPropertySourceLocator.java b/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/ConfigDataRetryableSecretsPropertySourceLocator.java index 2f78f306..4044f013 100644 --- a/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/ConfigDataRetryableSecretsPropertySourceLocator.java +++ b/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/ConfigDataRetryableSecretsPropertySourceLocator.java @@ -31,7 +31,7 @@ import org.springframework.retry.support.RetryTemplate; */ public class ConfigDataRetryableSecretsPropertySourceLocator extends SecretsPropertySourceLocator { - private RetryTemplate retryTemplate; + private final RetryTemplate retryTemplate; private SecretsPropertySourceLocator secretsPropertySourceLocator; @@ -39,9 +39,9 @@ public class ConfigDataRetryableSecretsPropertySourceLocator extends SecretsProp SecretsConfigProperties secretsConfigProperties) { super(secretsConfigProperties); this.secretsPropertySourceLocator = propertySourceLocator; - this.retryTemplate = RetryTemplate.builder().maxAttempts(properties.getRetry().getMaxAttempts()) - .exponentialBackoff(properties.getRetry().getInitialInterval(), properties.getRetry().getMultiplier(), - properties.getRetry().getMaxInterval()) + this.retryTemplate = RetryTemplate.builder().maxAttempts(properties.getRetry().maxAttempts()) + .exponentialBackoff(properties.getRetry().initialInterval(), properties.getRetry().multiplier(), + properties.getRetry().maxInterval()) .build(); } diff --git a/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/KubernetesBootstrapConfiguration.java b/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/KubernetesBootstrapConfiguration.java index 9c06059b..d8996aec 100644 --- a/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/KubernetesBootstrapConfiguration.java +++ b/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/KubernetesBootstrapConfiguration.java @@ -50,9 +50,9 @@ public class KubernetesBootstrapConfiguration { public static RetryOperationsInterceptor retryOperationsInterceptor( AbstractConfigProperties.RetryProperties retryProperties) { - return RetryInterceptorBuilder.stateless().backOffOptions(retryProperties.getInitialInterval(), - retryProperties.getMultiplier(), retryProperties.getMaxInterval()) - .maxAttempts(retryProperties.getMaxAttempts()).build(); + return RetryInterceptorBuilder.stateless().backOffOptions(retryProperties.initialInterval(), + retryProperties.multiplier(), retryProperties.maxInterval()) + .maxAttempts(retryProperties.maxAttempts()).build(); } @Bean diff --git a/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/KubernetesConfigDataLocationResolver.java b/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/KubernetesConfigDataLocationResolver.java index 946af3b1..82bd2a44 100644 --- a/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/KubernetesConfigDataLocationResolver.java +++ b/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/KubernetesConfigDataLocationResolver.java @@ -154,12 +154,12 @@ public abstract class KubernetesConfigDataLocationResolver } protected boolean isRetryEnabledForConfigMap(ConfigMapConfigProperties configMapProperties) { - return RETRY_IS_PRESENT && configMapProperties != null && configMapProperties.getRetry().isEnabled() + return RETRY_IS_PRESENT && configMapProperties != null && configMapProperties.getRetry().enabled() && configMapProperties.isFailFast(); } protected boolean isRetryEnabledForSecrets(SecretsConfigProperties secretsProperties) { - return RETRY_IS_PRESENT && secretsProperties != null && secretsProperties.getRetry().isEnabled() + return RETRY_IS_PRESENT && secretsProperties != null && secretsProperties.getRetry().enabled() && secretsProperties.isFailFast(); } @@ -190,8 +190,8 @@ public abstract class KubernetesConfigDataLocationResolver kubernetesClientProperties); } else { - kubernetesClientProperties = binder - .bindOrCreate(KubernetesClientProperties.PREFIX, Bindable.of(KubernetesClientProperties.class), bindHandler); + kubernetesClientProperties = binder.bindOrCreate(KubernetesClientProperties.PREFIX, + Bindable.of(KubernetesClientProperties.class), bindHandler); } kubernetesClientProperties.setNamespace(namespace); @@ -200,7 +200,8 @@ public abstract class KubernetesConfigDataLocationResolver ConfigMapConfigProperties configMapConfigProperties = null; if (configEnabled) { - configMapConfigProperties = binder.bindOrCreate(ConfigMapConfigProperties.PREFIX, ConfigMapConfigProperties.class); + configMapConfigProperties = binder.bindOrCreate(ConfigMapConfigProperties.PREFIX, + ConfigMapConfigProperties.class); } SecretsConfigProperties secretsProperties = null; diff --git a/spring-cloud-kubernetes-commons/src/test/java/org/springframework/cloud/kubernetes/commons/config/bootstrap/ConfigAndSecretsFailFastEnabledWithDefaultRetryConfiguration.java b/spring-cloud-kubernetes-commons/src/test/java/org/springframework/cloud/kubernetes/commons/config/bootstrap/ConfigAndSecretsFailFastEnabledWithDefaultRetryConfiguration.java index 0d1290b1..416b9807 100644 --- a/spring-cloud-kubernetes-commons/src/test/java/org/springframework/cloud/kubernetes/commons/config/bootstrap/ConfigAndSecretsFailFastEnabledWithDefaultRetryConfiguration.java +++ b/spring-cloud-kubernetes-commons/src/test/java/org/springframework/cloud/kubernetes/commons/config/bootstrap/ConfigAndSecretsFailFastEnabledWithDefaultRetryConfiguration.java @@ -58,22 +58,21 @@ public class ConfigAndSecretsFailFastEnabledWithDefaultRetryConfiguration { @Test void retryConfigurationShouldBeDefault() { - AbstractConfigProperties.RetryProperties defaultRetryProperties = new AbstractConfigProperties.RetryProperties(); + AbstractConfigProperties.RetryProperties defaultRetryProperties = AbstractConfigProperties.RetryProperties.DEFAULT; AbstractConfigProperties.RetryProperties configMapRetryProperties = configMapConfigProperties.getRetry(); - assertThat(configMapRetryProperties.getMaxAttempts()).isEqualTo(defaultRetryProperties.getMaxAttempts()); - assertThat(configMapRetryProperties.getInitialInterval()) - .isEqualTo(defaultRetryProperties.getInitialInterval()); - assertThat(configMapRetryProperties.getMaxInterval()).isEqualTo(defaultRetryProperties.getMaxInterval()); - assertThat(configMapRetryProperties.getMultiplier()).isEqualTo(defaultRetryProperties.getMultiplier()); + assertThat(configMapRetryProperties.maxAttempts()).isEqualTo(defaultRetryProperties.maxAttempts()); + assertThat(configMapRetryProperties.initialInterval()).isEqualTo(defaultRetryProperties.initialInterval()); + assertThat(configMapRetryProperties.maxInterval()).isEqualTo(defaultRetryProperties.maxInterval()); + assertThat(configMapRetryProperties.multiplier()).isEqualTo(defaultRetryProperties.multiplier()); AbstractConfigProperties.RetryProperties secretsRetryProperties = secretsConfigProperties.getRetry(); - assertThat(secretsRetryProperties.getMaxAttempts()).isEqualTo(defaultRetryProperties.getMaxAttempts()); - assertThat(secretsRetryProperties.getInitialInterval()).isEqualTo(defaultRetryProperties.getInitialInterval()); - assertThat(secretsRetryProperties.getMaxInterval()).isEqualTo(defaultRetryProperties.getMaxInterval()); - assertThat(secretsRetryProperties.getMultiplier()).isEqualTo(defaultRetryProperties.getMultiplier()); + assertThat(secretsRetryProperties.maxAttempts()).isEqualTo(defaultRetryProperties.maxAttempts()); + assertThat(secretsRetryProperties.initialInterval()).isEqualTo(defaultRetryProperties.initialInterval()); + assertThat(secretsRetryProperties.maxInterval()).isEqualTo(defaultRetryProperties.maxInterval()); + assertThat(secretsRetryProperties.multiplier()).isEqualTo(defaultRetryProperties.multiplier()); } } diff --git a/spring-cloud-kubernetes-commons/src/test/java/org/springframework/cloud/kubernetes/commons/config/bootstrap/ConfigFailFastEnabled.java b/spring-cloud-kubernetes-commons/src/test/java/org/springframework/cloud/kubernetes/commons/config/bootstrap/ConfigFailFastEnabled.java index 0587b1d4..0cf480dc 100644 --- a/spring-cloud-kubernetes-commons/src/test/java/org/springframework/cloud/kubernetes/commons/config/bootstrap/ConfigFailFastEnabled.java +++ b/spring-cloud-kubernetes-commons/src/test/java/org/springframework/cloud/kubernetes/commons/config/bootstrap/ConfigFailFastEnabled.java @@ -54,12 +54,12 @@ class ConfigFailFastEnabled { @Test void retryConfigurationShouldBeDefault() { AbstractConfigProperties.RetryProperties retryProperties = configMapConfigProperties.getRetry(); - AbstractConfigProperties.RetryProperties defaultRetryProperties = new AbstractConfigProperties.RetryProperties(); + AbstractConfigProperties.RetryProperties defaultRetryProperties = AbstractConfigProperties.RetryProperties.DEFAULT; - assertThat(retryProperties.getMaxAttempts()).isEqualTo(defaultRetryProperties.getMaxAttempts()); - assertThat(retryProperties.getInitialInterval()).isEqualTo(defaultRetryProperties.getInitialInterval()); - assertThat(retryProperties.getMaxInterval()).isEqualTo(defaultRetryProperties.getMaxInterval()); - assertThat(retryProperties.getMultiplier()).isEqualTo(defaultRetryProperties.getMultiplier()); + assertThat(retryProperties.maxAttempts()).isEqualTo(defaultRetryProperties.maxAttempts()); + assertThat(retryProperties.initialInterval()).isEqualTo(defaultRetryProperties.initialInterval()); + assertThat(retryProperties.maxInterval()).isEqualTo(defaultRetryProperties.maxInterval()); + assertThat(retryProperties.multiplier()).isEqualTo(defaultRetryProperties.multiplier()); } } diff --git a/spring-cloud-kubernetes-commons/src/test/java/org/springframework/cloud/kubernetes/commons/config/bootstrap/ConfigFailFastEnabledWithCustomRetryConfiguration.java b/spring-cloud-kubernetes-commons/src/test/java/org/springframework/cloud/kubernetes/commons/config/bootstrap/ConfigFailFastEnabledWithCustomRetryConfiguration.java index 6644f06f..ed5b7289 100644 --- a/spring-cloud-kubernetes-commons/src/test/java/org/springframework/cloud/kubernetes/commons/config/bootstrap/ConfigFailFastEnabledWithCustomRetryConfiguration.java +++ b/spring-cloud-kubernetes-commons/src/test/java/org/springframework/cloud/kubernetes/commons/config/bootstrap/ConfigFailFastEnabledWithCustomRetryConfiguration.java @@ -44,10 +44,10 @@ class ConfigFailFastEnabledWithCustomRetryConfiguration { void retryConfigurationShouldBeCustomized() { AbstractConfigProperties.RetryProperties retryProperties = configMapConfigProperties.getRetry(); - assertThat(retryProperties.getMaxAttempts()).isEqualTo(3); - assertThat(retryProperties.getInitialInterval()).isEqualTo(1500L); - assertThat(retryProperties.getMaxInterval()).isEqualTo(3000L); - assertThat(retryProperties.getMultiplier()).isEqualTo(1.5D); + assertThat(retryProperties.maxAttempts()).isEqualTo(3); + assertThat(retryProperties.initialInterval()).isEqualTo(1500L); + assertThat(retryProperties.maxInterval()).isEqualTo(3000L); + assertThat(retryProperties.multiplier()).isEqualTo(1.5D); } } diff --git a/spring-cloud-kubernetes-commons/src/test/java/org/springframework/cloud/kubernetes/commons/config/bootstrap/SecretsFailFastEnabled.java b/spring-cloud-kubernetes-commons/src/test/java/org/springframework/cloud/kubernetes/commons/config/bootstrap/SecretsFailFastEnabled.java index 0e14a8a4..9267604d 100644 --- a/spring-cloud-kubernetes-commons/src/test/java/org/springframework/cloud/kubernetes/commons/config/bootstrap/SecretsFailFastEnabled.java +++ b/spring-cloud-kubernetes-commons/src/test/java/org/springframework/cloud/kubernetes/commons/config/bootstrap/SecretsFailFastEnabled.java @@ -54,12 +54,13 @@ class SecretsFailFastEnabled { @Test void retryConfigurationShouldBeDefault() { AbstractConfigProperties.RetryProperties retryProperties = secretsConfigProperties.getRetry(); - AbstractConfigProperties.RetryProperties defaultRetryProperties = new AbstractConfigProperties.RetryProperties(); + AbstractConfigProperties.RetryProperties defaultRetryProperties = new AbstractConfigProperties.RetryProperties( + 1000, 1.1, 2000, 6, true); - assertThat(retryProperties.getMaxAttempts()).isEqualTo(defaultRetryProperties.getMaxAttempts()); - assertThat(retryProperties.getInitialInterval()).isEqualTo(defaultRetryProperties.getInitialInterval()); - assertThat(retryProperties.getMaxInterval()).isEqualTo(defaultRetryProperties.getMaxInterval()); - assertThat(retryProperties.getMultiplier()).isEqualTo(defaultRetryProperties.getMultiplier()); + assertThat(retryProperties.maxAttempts()).isEqualTo(defaultRetryProperties.maxAttempts()); + assertThat(retryProperties.initialInterval()).isEqualTo(defaultRetryProperties.initialInterval()); + assertThat(retryProperties.maxInterval()).isEqualTo(defaultRetryProperties.maxInterval()); + assertThat(retryProperties.multiplier()).isEqualTo(defaultRetryProperties.multiplier()); } } diff --git a/spring-cloud-kubernetes-commons/src/test/java/org/springframework/cloud/kubernetes/commons/config/bootstrap/SecretsFailFastEnabledWithCustomRetryConfiguration.java b/spring-cloud-kubernetes-commons/src/test/java/org/springframework/cloud/kubernetes/commons/config/bootstrap/SecretsFailFastEnabledWithCustomRetryConfiguration.java index 9c760185..9b82826c 100644 --- a/spring-cloud-kubernetes-commons/src/test/java/org/springframework/cloud/kubernetes/commons/config/bootstrap/SecretsFailFastEnabledWithCustomRetryConfiguration.java +++ b/spring-cloud-kubernetes-commons/src/test/java/org/springframework/cloud/kubernetes/commons/config/bootstrap/SecretsFailFastEnabledWithCustomRetryConfiguration.java @@ -44,10 +44,10 @@ class SecretsFailFastEnabledWithCustomRetryConfiguration { void retryConfigurationShouldBeCustomized() { AbstractConfigProperties.RetryProperties retryProperties = secretsConfigProperties.getRetry(); - assertThat(retryProperties.getMaxAttempts()).isEqualTo(3); - assertThat(retryProperties.getInitialInterval()).isEqualTo(1500L); - assertThat(retryProperties.getMaxInterval()).isEqualTo(3000L); - assertThat(retryProperties.getMultiplier()).isEqualTo(1.5D); + assertThat(retryProperties.maxAttempts()).isEqualTo(3); + assertThat(retryProperties.initialInterval()).isEqualTo(1500L); + assertThat(retryProperties.maxInterval()).isEqualTo(3000L); + assertThat(retryProperties.multiplier()).isEqualTo(1.5D); } } diff --git a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/locator_retry/BoostrapConfigRetryEnabled.java b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/locator_retry/config_retry_enabled/BoostrapConfigRetryEnabled.java similarity index 98% rename from spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/locator_retry/BoostrapConfigRetryEnabled.java rename to spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/locator_retry/config_retry_enabled/BoostrapConfigRetryEnabled.java index a29eef0f..efe5f6ed 100644 --- a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/locator_retry/BoostrapConfigRetryEnabled.java +++ b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/locator_retry/config_retry_enabled/BoostrapConfigRetryEnabled.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.cloud.kubernetes.fabric8.config.locator_retry; +package org.springframework.cloud.kubernetes.fabric8.config.locator_retry.config_retry_enabled; import io.fabric8.kubernetes.client.KubernetesClient; import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient; diff --git a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/locator_retry/ConfigDataConfigRetryEnabled.java b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/locator_retry/config_retry_enabled/ConfigDataConfigRetryEnabled.java similarity index 86% rename from spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/locator_retry/ConfigDataConfigRetryEnabled.java rename to spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/locator_retry/config_retry_enabled/ConfigDataConfigRetryEnabled.java index 6390e213..68300666 100644 --- a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/locator_retry/ConfigDataConfigRetryEnabled.java +++ b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/locator_retry/config_retry_enabled/ConfigDataConfigRetryEnabled.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.cloud.kubernetes.fabric8.config.locator_retry; +package org.springframework.cloud.kubernetes.fabric8.config.locator_retry.config_retry_enabled; import io.fabric8.kubernetes.client.KubernetesClient; import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient; @@ -35,9 +35,10 @@ import static org.mockito.Mockito.spy; * @author Isik Erhan */ @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, - properties = { "spring.cloud.kubernetes.client.namespace=default", - "spring.cloud.kubernetes.config.fail-fast=true", "spring.cloud.kubernetes.config.retry.max-attempts=5", - "spring.main.cloud-platform=KUBERNETES", "spring.config.import=kubernetes:" }, + properties = { "spring.cloud.kubernetes.secrets.enabled=false", + "spring.cloud.kubernetes.client.namespace=default", "spring.cloud.kubernetes.config.fail-fast=true", + "spring.cloud.kubernetes.config.retry.max-attempts=5", "spring.main.cloud-platform=KUBERNETES", + "spring.config.import=kubernetes:" }, classes = Application.class) @EnableKubernetesMockClient class ConfigDataConfigRetryEnabled extends ConfigRetryEnabled { diff --git a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/locator_retry/ConfigRetryEnabled.java b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/locator_retry/config_retry_enabled/ConfigRetryEnabled.java similarity index 99% rename from spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/locator_retry/ConfigRetryEnabled.java rename to spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/locator_retry/config_retry_enabled/ConfigRetryEnabled.java index e2e27b0c..27ecd4e6 100644 --- a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/locator_retry/ConfigRetryEnabled.java +++ b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/locator_retry/config_retry_enabled/ConfigRetryEnabled.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.cloud.kubernetes.fabric8.config.locator_retry; +package org.springframework.cloud.kubernetes.fabric8.config.locator_retry.config_retry_enabled; import java.util.HashMap; import java.util.Map; diff --git a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/retry/BootstrapSecretsRetryEnabled.java b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/retry/secrets_enabled/BootstrapSecretsRetryEnabled.java similarity index 89% rename from spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/retry/BootstrapSecretsRetryEnabled.java rename to spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/retry/secrets_enabled/BootstrapSecretsRetryEnabled.java index 89cabd90..ef102e57 100644 --- a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/retry/BootstrapSecretsRetryEnabled.java +++ b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/retry/secrets_enabled/BootstrapSecretsRetryEnabled.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.cloud.kubernetes.fabric8.config.retry; +package org.springframework.cloud.kubernetes.fabric8.config.retry.secrets_enabled; import io.fabric8.kubernetes.client.KubernetesClient; import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient; @@ -31,8 +31,8 @@ import org.springframework.cloud.kubernetes.fabric8.config.Fabric8SecretsPropert * @author Isik Erhan */ @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, - properties = { "spring.cloud.kubernetes.client.namespace=default", - "spring.cloud.kubernetes.secrets.fail-fast=true", + properties = { "spring.cloud.kubernetes.config.enabled=false", "spring.cloud.kubernetes.secrets.enabled=true", + "spring.cloud.kubernetes.client.namespace=default", "spring.cloud.kubernetes.secrets.fail-fast=true", "spring.cloud.kubernetes.secrets.retry.max-attempts=5", "spring.cloud.kubernetes.secrets.name=my-secret", "spring.cloud.kubernetes.secrets.enable-api=true", "spring.main.cloud-platform=KUBERNETES", "spring.cloud.bootstrap.enabled=true" }, diff --git a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/retry/ConfigDataSecretsRetryEnabled.java b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/retry/secrets_enabled/ConfigDataSecretsRetryEnabled.java similarity index 90% rename from spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/retry/ConfigDataSecretsRetryEnabled.java rename to spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/retry/secrets_enabled/ConfigDataSecretsRetryEnabled.java index d15eff9f..93b853bc 100644 --- a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/retry/ConfigDataSecretsRetryEnabled.java +++ b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/retry/secrets_enabled/ConfigDataSecretsRetryEnabled.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.cloud.kubernetes.fabric8.config.retry; +package org.springframework.cloud.kubernetes.fabric8.config.retry.secrets_enabled; import io.fabric8.kubernetes.client.KubernetesClient; import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient; @@ -33,8 +33,8 @@ import static org.mockito.Mockito.spy; * @author Isik Erhan */ @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, - properties = { "spring.cloud.kubernetes.client.namespace=default", - "spring.cloud.kubernetes.secrets.fail-fast=true", + properties = { "spring.cloud.kubernetes.config.enabled=false", "spring.cloud.kubernetes.secrets.enabled=true", + "spring.cloud.kubernetes.client.namespace=default", "spring.cloud.kubernetes.secrets.fail-fast=true", "spring.cloud.kubernetes.secrets.retry.max-attempts=5", "spring.cloud.kubernetes.secrets.name=my-secret", "spring.cloud.kubernetes.secrets.enable-api=true", "spring.main.cloud-platform=KUBERNETES", "spring.config.import=kubernetes:" }, diff --git a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/retry/SecretsRetryEnabled.java b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/retry/secrets_enabled/SecretsRetryEnabled.java similarity index 99% rename from spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/retry/SecretsRetryEnabled.java rename to spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/retry/secrets_enabled/SecretsRetryEnabled.java index 26909120..a655dbc4 100644 --- a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/retry/SecretsRetryEnabled.java +++ b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/retry/secrets_enabled/SecretsRetryEnabled.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.cloud.kubernetes.fabric8.config.retry; +package org.springframework.cloud.kubernetes.fabric8.config.retry.secrets_enabled; import java.util.Base64; import java.util.HashMap;