diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/DefaultKubernetesClient.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/DefaultKubernetesClient.java index 6d9649630ca..c88ffce2743 100644 --- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/DefaultKubernetesClient.java +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/DefaultKubernetesClient.java @@ -112,7 +112,6 @@ import java.util.Collection; import java.util.concurrent.ExecutorService; import java.util.concurrent.ForkJoinPool; -import java.util.concurrent.TimeUnit; /** * Class for Default Kubernetes Client implementing KubernetesClient interface. @@ -158,7 +157,7 @@ public ParameterNamespaceListVisitFromServerGetDeleteRecreateWaitApplicable resourceList(KubernetesResourceList item) { - return new NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl(httpClient, getConfiguration(), getNamespace(), null, false, false, new ArrayList(), item, null, null, -1, DeletionPropagation.BACKGROUND, true) { + return new NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl(httpClient, getConfiguration(), getNamespace(), null, false, false, new ArrayList<>(), item, null, DeletionPropagation.BACKGROUND, true) { }; } @@ -174,20 +173,20 @@ public NamespaceListVisitFromServerGetDeleteRecreateWaitApplicable resourceList(String s) { - return new NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl(httpClient, getConfiguration(), getNamespace(), null, false, false, new ArrayList(), s, null, null, -1, DeletionPropagation.BACKGROUND, true) { + return new NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl(httpClient, getConfiguration(), getNamespace(), null, false, false, new ArrayList<>(), s, null, DeletionPropagation.BACKGROUND, true) { }; } @Override public NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicable resource(HasMetadata item) { - return new NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableImpl(httpClient, getConfiguration(), getNamespace(), null, false, false, new ArrayList(), item, -1, DeletionPropagation.BACKGROUND, true, 5, 2) { + return new NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableImpl(httpClient, getConfiguration(), getNamespace(), null, false, false, new ArrayList(), item, -1, DeletionPropagation.BACKGROUND, true, Waitable.DEFAULT_INITIAL_BACKOFF_MILLIS, Waitable.DEFAULT_BACKOFF_MULTIPLIER) { }; } @Override public NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicable resource(String s) { - return new NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableImpl(httpClient, getConfiguration(), getNamespace(), null, false, false, new ArrayList(), s, -1, DeletionPropagation.BACKGROUND, true, 5, 2) { + return new NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableImpl(httpClient, getConfiguration(), getNamespace(), null, false, false, new ArrayList(), s, -1, DeletionPropagation.BACKGROUND, true, Waitable.DEFAULT_INITIAL_BACKOFF_MILLIS, Waitable.DEFAULT_BACKOFF_MULTIPLIER) { }; } diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/WaitRetryBackoffConfigurable.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/WaitRetryBackoffConfigurable.java deleted file mode 100644 index 3e947d591b6..00000000000 --- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/WaitRetryBackoffConfigurable.java +++ /dev/null @@ -1,15 +0,0 @@ -package io.fabric8.kubernetes.client; - -import java.util.concurrent.TimeUnit; - -public interface WaitRetryBackoffConfigurable { - - /** - * Configure the backoff strategy to use when waiting for conditions, in case the watcher encounters a retryable error. - * @param initialBackoff the value for the initial backoff on first error - * @param backoffUnit the TimeUnit for the initial backoff value - * @param backoffMultiplier what to multiply the backoff by on each subsequent error - * @return - */ - T withWaitRetryBackoff(long initialBackoff, TimeUnit backoffUnit, double backoffMultiplier); -} diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/Resource.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/Resource.java index 12df7dcd5ac..9e61f333e0d 100644 --- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/Resource.java +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/Resource.java @@ -27,5 +27,5 @@ public interface Resource extends CreateOrReplaceable, CreateFromServerGettable, CascadingEditReplacePatchDeletable, VersionWatchable>, - WatchingWaitableWithBackoff, Requirable, Readiable { + Waitable, Requirable, Readiable { } diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/VisitFromServerGetWatchDeleteRecreateWaitApplicable.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/VisitFromServerGetWatchDeleteRecreateWaitApplicable.java index d03b3b1bbba..d18244c43b4 100644 --- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/VisitFromServerGetWatchDeleteRecreateWaitApplicable.java +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/VisitFromServerGetWatchDeleteRecreateWaitApplicable.java @@ -27,7 +27,7 @@ public interface VisitFromServerGetWatchDeleteRecreateWaitApplicable exten FromServerGettable, RecreateApplicable, CascadingDeletable, Watchable>, - WatchingWaitableWithBackoff, + Waitable, GracePeriodConfigurable>, PropagationPolicyConfigurable> { } diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/Waitable.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/Waitable.java index 60449dabfd7..34f99d4f3f9 100644 --- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/Waitable.java +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/Waitable.java @@ -1,12 +1,12 @@ /** * Copyright (C) 2015 Red Hat, Inc. - * + *

* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,7 +20,19 @@ public interface Waitable { - T waitUntilReady(long amount, TimeUnit timeUnit) throws InterruptedException; + long DEFAULT_INITIAL_BACKOFF_MILLIS = 5; + double DEFAULT_BACKOFF_MULTIPLIER = 2; - T waitUntilCondition(Predicate

condition, long amount, TimeUnit timeUnit) throws InterruptedException; + T waitUntilReady(long amount, TimeUnit timeUnit) throws InterruptedException; + + T waitUntilCondition(Predicate

condition, long amount, TimeUnit timeUnit) throws InterruptedException; + + /** + * Configure the backoff strategy to use when waiting for conditions, in case the watcher encounters a retryable error. + * @param initialBackoff the value for the initial backoff on first error + * @param backoffUnit the TimeUnit for the initial backoff value + * @param backoffMultiplier what to multiply the backoff by on each subsequent error + * @return + */ + Waitable withWaitRetryBackoff(long initialBackoff, TimeUnit backoffUnit, double backoffMultiplier); } diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/WatchingWaitableWithBackoff.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/WatchingWaitableWithBackoff.java deleted file mode 100644 index 1c776788397..00000000000 --- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/WatchingWaitableWithBackoff.java +++ /dev/null @@ -1,6 +0,0 @@ -package io.fabric8.kubernetes.client.dsl; - -import io.fabric8.kubernetes.client.WaitRetryBackoffConfigurable; - -public interface WatchingWaitableWithBackoff extends Waitable, WaitRetryBackoffConfigurable> { -} diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/base/OperationContext.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/base/OperationContext.java index df671410218..b3344ff1d18 100644 --- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/base/OperationContext.java +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/base/OperationContext.java @@ -20,6 +20,7 @@ import io.fabric8.kubernetes.api.model.DeletionPropagation; import io.fabric8.kubernetes.client.Config; +import io.fabric8.kubernetes.client.dsl.Waitable; import io.fabric8.kubernetes.client.utils.ApiVersionUtil; import io.fabric8.kubernetes.client.utils.Utils; import okhttp3.OkHttpClient; @@ -44,8 +45,8 @@ public class OperationContext { protected long gracePeriodSeconds = -1L; protected DeletionPropagation propagationPolicy; - protected long watchRetryInitialBackoffMillis = 5; - protected double watchRetryBackoffMultiplier = 2; + protected long watchRetryInitialBackoffMillis = Waitable.DEFAULT_INITIAL_BACKOFF_MILLIS; + protected double watchRetryBackoffMultiplier = Waitable.DEFAULT_BACKOFF_MULTIPLIER; protected Map labels; protected Map labelsNot; @@ -270,6 +271,8 @@ public OperationContext withOperationContext(OperationContext operationContext) boolean cascadingCloned = getCascading(); boolean reloadingFromServerCloned = getReloadingFromServer(); long gracePeriodSecondsCloned = getGracePeriodSeconds(); + long watchRetryInitialBackoffMillis = getWatchRetryInitialBackoffMillis(); + double watchRetryBackoffMultiplier = getWatchRetryBackoffMultiplier(); DeletionPropagation propagationPolicyCloned = getPropagationPolicy(); Map labelsCloned = getLabels(); Map labelsNotCloned = getLabelsNot(); @@ -354,6 +357,6 @@ public OperationContext withOperationContext(OperationContext operationContext) propagationPolicyCloned = operationContext.getPropagationPolicy(); } - return new OperationContext(clientCloned, configCloned, pluralCloned, namespaceCloned, nameCloned, apiGroupNameCloned, apiGroupVersionCloned, cascadingCloned, itemCloned, labelsCloned, labelsNotCloned, labelsInCloned, labelsNotInCloned, fieldsCloned, fieldsNotCloned, resourceVersionCloned, reloadingFromServerCloned, gracePeriodSecondsCloned, propagationPolicyCloned); + return new OperationContext(clientCloned, configCloned, pluralCloned, namespaceCloned, nameCloned, apiGroupNameCloned, apiGroupVersionCloned, cascadingCloned, itemCloned, labelsCloned, labelsNotCloned, labelsInCloned, labelsNotInCloned, fieldsCloned, fieldsNotCloned, resourceVersionCloned, reloadingFromServerCloned, gracePeriodSecondsCloned, propagationPolicyCloned, watchRetryInitialBackoffMillis, watchRetryBackoffMultiplier); } } diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/base/WaitForConditionWatcher.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/base/WaitForConditionWatcher.java index 6863cea65e2..52dcb1a9f15 100644 --- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/base/WaitForConditionWatcher.java +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/base/WaitForConditionWatcher.java @@ -1,3 +1,18 @@ +/** + * Copyright (C) 2015 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package io.fabric8.kubernetes.client.dsl.base; import java.net.HttpURLConnection; diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableImpl.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableImpl.java index 5662054993a..230e098b74d 100644 --- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableImpl.java +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableImpl.java @@ -16,7 +16,6 @@ package io.fabric8.kubernetes.client.dsl.internal; import io.fabric8.kubernetes.api.model.DeletionPropagation; -import io.fabric8.kubernetes.client.dsl.WatchingWaitableWithBackoff; import io.fabric8.kubernetes.client.utils.Utils; import java.util.function.Predicate; @@ -59,7 +58,7 @@ import okhttp3.OkHttpClient; public class NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableImpl extends OperationSupport implements NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicable, - WatchingWaitableWithBackoff, + Waitable, Readiable { private static final Logger LOGGER = LoggerFactory.getLogger(NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableImpl.class); @@ -227,7 +226,7 @@ public Deletable cascading(boolean cascading) { } @Override - public WatchingWaitableWithBackoff withWaitRetryBackoff(long initialBackoff, TimeUnit backoffUnit, double backoffMultiplier) { + public Waitable withWaitRetryBackoff(long initialBackoff, TimeUnit backoffUnit, double backoffMultiplier) { long watchRetryInitialBackoffMillis = backoffUnit.toMillis(initialBackoff); return new NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableImpl(client, config, fallbackNamespace, explicitNamespace, fromServer, true, visitors, item, gracePeriodSeconds, propagationPolicy, cascading, watchRetryInitialBackoffMillis, backoffMultiplier); } diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl.java index e652fbba76a..93f987b0778 100644 --- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl.java +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl.java @@ -75,7 +75,9 @@ public class NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImp private final Boolean fromServer; private final Boolean deletingExisting; private final List visitors; - private final Object item; + private final long watchRetryInitialBackoffMillis; + private final double watchRetryBackoffMultiplier; + private final Object item; private final InputStream inputStream; private final long gracePeriodSeconds; @@ -126,7 +128,7 @@ public List waitUntilReady(final long amount, final TimeUnit timeUn executor.shutdown(); } } - + @Override public List waitUntilCondition(Predicate condition, long amount, TimeUnit timeUnit) throws InterruptedException { @@ -183,7 +185,7 @@ public Boolean isReady() { @Override public NamespaceListVisitFromServerGetDeleteRecreateWaitApplicable withParameters(Map parameters) { - return new NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl(client, config, namespace, explicitNamespace, fromServer, deletingExisting, visitors, null, inputStream, parameters, -1, propagationPolicy, cascading); + return new NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl(client, config, namespace, explicitNamespace, fromServer, deletingExisting, visitors, null, inputStream, parameters, -1, propagationPolicy, cascading, watchRetryInitialBackoffMillis, watchRetryBackoffMultiplier); } /** @@ -212,18 +214,24 @@ public void visit(ObjectMetaBuilder builder) { } public NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl(OkHttpClient client, Config config, String namespace, String explicitNamespace, Boolean fromServer, Boolean deletingExisting, List visitors, InputStream is, Map parameters, Boolean cascading, DeletionPropagation propagationPolicy) { - this(client, config, namespace, explicitNamespace, fromServer, deletingExisting, visitors, null, is, parameters, -1, propagationPolicy, cascading); + this(client, config, namespace, explicitNamespace, fromServer, deletingExisting, visitors, null, is, parameters, -1, propagationPolicy, cascading, Waitable.DEFAULT_INITIAL_BACKOFF_MILLIS, Waitable.DEFAULT_BACKOFF_MULTIPLIER); + } + + public NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl(OkHttpClient client, Config config, String namespace, String explicitNamespace, Boolean fromServer, Boolean deletingExisting, List visitors, Object item, Map parameters, DeletionPropagation propagationPolicy, Boolean cascading) { + this(client, config, namespace, explicitNamespace, fromServer, deletingExisting, visitors, item, null, parameters, -1, propagationPolicy, cascading, Waitable.DEFAULT_INITIAL_BACKOFF_MILLIS, Waitable.DEFAULT_BACKOFF_MULTIPLIER); } - public NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl(OkHttpClient client, Config config, String namespace, String explicitNamespace, Boolean fromServer, Boolean deletingExisting, List visitors, Object item, InputStream inputStream, Map parameters, long gracePeriodSeconds, DeletionPropagation propagationPolicy, Boolean cascading) { + public NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl(OkHttpClient client, Config config, String namespace, String explicitNamespace, Boolean fromServer, Boolean deletingExisting, List visitors, Object item, InputStream inputStream, Map parameters, long gracePeriodSeconds, DeletionPropagation propagationPolicy, Boolean cascading, long watchRetryInitialBackoffMillis, double watchRetryBackoffMultiplier) { super(client, config); this.fallbackNamespace = namespace; this.explicitNamespace = explicitNamespace; this.fromServer = fromServer; this.deletingExisting = deletingExisting; this.visitors = visitors != null ? new ArrayList<>(visitors) : new ArrayList(); + this.watchRetryInitialBackoffMillis = watchRetryInitialBackoffMillis; + this.watchRetryBackoffMultiplier = watchRetryBackoffMultiplier; - if (item != null) { + if (item != null) { this.item = item; } else if (inputStream != null) { this.item = Serialization.unmarshal(inputStream, parameters); @@ -280,7 +288,7 @@ public List createOrReplace() { @Override public Waitable, HasMetadata> createOrReplaceAnd() { - return new NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl(client, config, fallbackNamespace, explicitNamespace, fromServer, deletingExisting, visitors, createOrReplace(), inputStream, null, gracePeriodSeconds, propagationPolicy, cascading); + return new NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl(client, config, fallbackNamespace, explicitNamespace, fromServer, deletingExisting, visitors, createOrReplace(), inputStream, null, gracePeriodSeconds, propagationPolicy, cascading, watchRetryInitialBackoffMillis, watchRetryBackoffMultiplier); } @@ -343,40 +351,45 @@ private static List acceptVisitors(List list, List inNamespace(String explicitNamespace) { - return new NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl(client, config, fallbackNamespace, explicitNamespace, fromServer, deletingExisting, visitors, item, null, null, gracePeriodSeconds, propagationPolicy, cascading); + return new NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl(client, config, fallbackNamespace, explicitNamespace, fromServer, deletingExisting, visitors, item, null, null, gracePeriodSeconds, propagationPolicy, cascading, watchRetryInitialBackoffMillis, watchRetryBackoffMultiplier); } @Override public Gettable> fromServer() { - return new NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl(client, config, fallbackNamespace, explicitNamespace, true, deletingExisting, visitors, item, null, null, gracePeriodSeconds, propagationPolicy, cascading); + return new NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl(client, config, fallbackNamespace, explicitNamespace, true, deletingExisting, visitors, item, null, null, gracePeriodSeconds, propagationPolicy, cascading, watchRetryInitialBackoffMillis, watchRetryBackoffMultiplier); } @Override public Applicable> deletingExisting() { - return new NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl(client, config, fallbackNamespace, explicitNamespace, fromServer, true, visitors, item, null, null, gracePeriodSeconds, propagationPolicy, cascading); + return new NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl(client, config, fallbackNamespace, explicitNamespace, fromServer, true, visitors, item, null, null, gracePeriodSeconds, propagationPolicy, cascading, watchRetryInitialBackoffMillis, watchRetryBackoffMultiplier); } @Override public ListVisitFromServerGetDeleteRecreateWaitApplicable accept(Visitor visitor) { List newVisitors = new ArrayList<>(visitors); newVisitors.add(visitor); - return new NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl(client, config, fallbackNamespace, explicitNamespace, fromServer, true, newVisitors, item, null, null, gracePeriodSeconds, propagationPolicy, cascading); + return new NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl(client, config, fallbackNamespace, explicitNamespace, fromServer, true, newVisitors, item, null, null, gracePeriodSeconds, propagationPolicy, cascading, watchRetryInitialBackoffMillis, watchRetryBackoffMultiplier); } @Override public CascadingDeletable withGracePeriod(long gracePeriodSeconds) { - return new NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl(client, config, fallbackNamespace, explicitNamespace, fromServer, true, visitors, item, null, null, gracePeriodSeconds, propagationPolicy, cascading); + return new NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl(client, config, fallbackNamespace, explicitNamespace, fromServer, true, visitors, item, null, null, gracePeriodSeconds, propagationPolicy, cascading, watchRetryInitialBackoffMillis, watchRetryBackoffMultiplier); } @Override public CascadingDeletable withPropagationPolicy(DeletionPropagation propagationPolicy) { - return new NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl(client, config, fallbackNamespace, explicitNamespace, fromServer, true, visitors, item, null, null, gracePeriodSeconds, propagationPolicy, cascading); + return new NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl(client, config, fallbackNamespace, explicitNamespace, fromServer, true, visitors, item, null, null, gracePeriodSeconds, propagationPolicy, cascading, watchRetryInitialBackoffMillis, watchRetryBackoffMultiplier); } + @Override + public Waitable, HasMetadata> withWaitRetryBackoff(long initialBackoff, TimeUnit backoffUnit, double backoffMultiplier) { + long watchRetryInitialBackoffMillis = backoffUnit.toMillis(initialBackoff); + return new NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl(client, config, fallbackNamespace, explicitNamespace, fromServer, true, visitors, item, null, null, gracePeriodSeconds, propagationPolicy, cascading, watchRetryInitialBackoffMillis, backoffMultiplier); + } @Override public Deletable cascading(boolean cascading) { - return new NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl(client, config, fallbackNamespace, explicitNamespace, fromServer, true, visitors, item, null, null, gracePeriodSeconds, propagationPolicy, cascading); + return new NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl(client, config, fallbackNamespace, explicitNamespace, fromServer, true, visitors, item, null, null, gracePeriodSeconds, propagationPolicy, cascading, watchRetryInitialBackoffMillis, watchRetryBackoffMultiplier); } private static List asHasMetadata(T item, Boolean enableProccessing) { diff --git a/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/dsl/base/WaitForConditionWatcherTest.java b/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/dsl/base/WaitForConditionWatcherTest.java index 10dd6666c30..2ec33deeb52 100644 --- a/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/dsl/base/WaitForConditionWatcherTest.java +++ b/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/dsl/base/WaitForConditionWatcherTest.java @@ -1,3 +1,18 @@ +/** + * Copyright (C) 2015 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package io.fabric8.kubernetes.client.dsl.base; import static org.junit.jupiter.api.Assertions.assertEquals;