diff --git a/CHANGELOG.md b/CHANGELOG.md index c37d4a8f2fa..fe60bcaf989 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ### 4.7-SNAPSHOT #### Bugs * Fix disabled Integration tests +* Fix #1859 - Pass caller's propagation-policy/cascade options to the underlying replicaset when deleting a deployment #### Improvements diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/DeploymentOperationsImpl.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/DeploymentOperationsImpl.java index 12958e7dd2a..595b54608c0 100644 --- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/DeploymentOperationsImpl.java +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/DeploymentOperationsImpl.java @@ -290,10 +290,18 @@ private void reapMatchingReplicaSets(LabelSelector selector) { if (selector == null || (selector.getMatchLabels() == null && selector.getMatchExpressions() == null)) { return; } - ReplicaSetOperationsImpl rsOper = new ReplicaSetOperationsImpl(new RollingOperationContext() + RollingOperationContext context = new RollingOperationContext() .withOkhttpClient(oper.client) .withConfig(oper.config) - .withNamespace(oper.getNamespace())); + .withNamespace(oper.getNamespace()); + + if (oper.getPropagationPolicy() != null) { + context = context.withPropagationPolicy(oper.getPropagationPolicy()); + } else if (oper.isCascading()) { + context = context.withCascading(oper.isCascading()); + } + + ReplicaSetOperationsImpl rsOper = new ReplicaSetOperationsImpl(context); rsOper.inNamespace(oper.getNamespace()).withLabelSelector(selector).delete(); } }