Skip to content

Commit 839613e

Browse files
committed
Reinitialize agent instances if those are null
1 parent 262bd4f commit 839613e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,15 @@ private void refreshInstancesForAllClusters(List<ClusterProfileProperties> listO
122122
}
123123
}
124124

125-
private AgentInstances<KubernetesInstance> getAgentInstancesFor(ClusterProfileProperties clusterProfileProperties) {
126-
return clusterSpecificAgentInstances.get(clusterProfileProperties.uuid());
125+
private AgentInstances<KubernetesInstance> getAgentInstancesFor(ClusterProfileProperties clusterProfileProperties) throws Exception {
126+
KubernetesAgentInstances agentInstances = clusterSpecificAgentInstances.get(clusterProfileProperties.uuid());
127+
128+
//initalize agent instances if those are null
129+
if (agentInstances == null) {
130+
refreshInstancesForCluster(clusterProfileProperties);
131+
}
132+
133+
return agentInstances;
127134
}
128135

129136
private void refreshInstancesForCluster(ClusterProfileProperties clusterProfileProperties) throws Exception {

0 commit comments

Comments
 (0)