Skip to content

Commit c0a2504

Browse files
committed
Clear out cached kubernetes client on load of status report
1 parent 5d23a5d commit c0a2504

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/main/java/cd/go/contrib/elasticagent/KubernetesClientFactory.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,8 @@ private KubernetesClient createClientFor(PluginSettings pluginSettings) {
5454

5555
return new DefaultKubernetesClient(configBuilder.build());
5656
}
57-
}
57+
58+
public void clearOutExistingClient() {
59+
this.client = null;
60+
}
61+
}

src/main/java/cd/go/contrib/elasticagent/KubernetesPlugin.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ public GoPluginApiResponse handle(GoPluginApiRequest request) {
9696
case REQUEST_CLUSTER_STATUS_REPORT:
9797
ClusterStatusReportRequest clusterStatusReportRequest = ClusterStatusReportRequest.fromJSON(request.requestBody());
9898
clusterProfileProperties = clusterStatusReportRequest.clusterProfileProperties();
99+
KubernetesClientFactory.instance().clearOutExistingClient();
99100
refreshInstancesForCluster(clusterProfileProperties);
100101
return clusterStatusReportRequest.executor().execute();
101102
case REQUEST_ELASTIC_AGENT_STATUS_REPORT:

0 commit comments

Comments
 (0)