lib/configgin.rb in configgin-0.19.0 vs lib/configgin.rb in configgin-0.19.1
- old
+ new
@@ -113,10 +113,13 @@
# Some pods might have depended on the properties exported by this pod; given
# the annotations expected on the pods (keyed by the instance group name),
# patch the StatefulSets such that they will be restarted.
def restart_affected_pods(expected_annotations)
expected_annotations.each_pair do |instance_group_name, digests|
+ # Avoid restarting our own pod
+ next if instance_group_name == instance_group
+
begin
kube_client_stateful_set.patch_stateful_set(
instance_group_name,
{ spec: { template: { metadata: { annotations: digests } } } },
kube_namespace
@@ -194,9 +197,9 @@
def kube_client_stateful_set
@kube_client_stateful_set ||= create_kube_client(path: '/apis/apps')
end
def instance_group
- pod = kube_client.get_pod(@self_name, kube_namespace)
- pod['metadata']['labels']['app.kubernetes.io/component']
+ @pod ||= kube_client.get_pod(@self_name, kube_namespace)
+ @pod['metadata']['labels']['app.kubernetes.io/component']
end
end