From 2dda702f17a7eeeb1eb9717037289375b7d705bc Mon Sep 17 00:00:00 2001 From: "Carvajal, Luis" Date: Wed, 4 Oct 2017 13:31:24 -0400 Subject: [PATCH] Updating rolling updater selector. The labels need to match. In this context it means that they need to be part of the manifest, but that doesn't imply that the manifest can't have extra labels. --- pykube/rolling_updater.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pykube/rolling_updater.py b/pykube/rolling_updater.py index 170d52f..6df060e 100644 --- a/pykube/rolling_updater.py +++ b/pykube/rolling_updater.py @@ -37,7 +37,9 @@ def update(self): self.old_rc.name )) new_labels = self.new_rc.obj["spec"]["template"]["metadata"]["labels"] - if new_selector != new_labels: + new_labels_set = set((x, new_labels[x]) for x in new_labels) + new_selector_set = set((x, new_selector[x]) for x in new_selector) + if not new_selector_set <= new_labels_set: raise KubernetesError( "The ReplicationController {} is invalid. spec.template.metadata.labels: Invalid value: {}: `selector` does not match template `labels` {}".format( self.new_rc.name,