From de4839da9683e9af3b157cf67e275b3e55da089d Mon Sep 17 00:00:00 2001 From: Dmytro Aleksandrov Date: Fri, 31 May 2019 14:36:33 +0300 Subject: [PATCH] feat(provider/google): explicitly fail if a request tries to change session affinity while there are connected instances https://github.com/spinnaker/spinnaker/issues/3521 --- .../UpsertGoogleLoadBalancerAtomicOperation.groovy | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/clouddriver-google/src/main/groovy/com/netflix/spinnaker/clouddriver/google/deploy/ops/loadbalancer/UpsertGoogleLoadBalancerAtomicOperation.groovy b/clouddriver-google/src/main/groovy/com/netflix/spinnaker/clouddriver/google/deploy/ops/loadbalancer/UpsertGoogleLoadBalancerAtomicOperation.groovy index 9160623cfce..0b5704bd314 100644 --- a/clouddriver-google/src/main/groovy/com/netflix/spinnaker/clouddriver/google/deploy/ops/loadbalancer/UpsertGoogleLoadBalancerAtomicOperation.groovy +++ b/clouddriver-google/src/main/groovy/com/netflix/spinnaker/clouddriver/google/deploy/ops/loadbalancer/UpsertGoogleLoadBalancerAtomicOperation.groovy @@ -192,6 +192,11 @@ class UpsertGoogleLoadBalancerAtomicOperation extends GoogleAtomicOperation def targetPoolResourceOperation def targetPoolResourceLink + if (needToUpdateSessionAffinity && existingTargetPool.instances.any()) { + task.updateStatus BASE_PHASE, "Impossible to change Session Affinity for target pool $targetPoolName with existing instances in $region" + task.fail() + } + // There's a chance that the target pool doesn't in fact get updated. If needToUpdateTargetPool was set because // the description.instances property was specified, but the specified set matches the existing set of instances, // no updates will be made to the target pool.