Skip to content

Commit

Permalink
Fix duplicate deployment names in klusterlet-agent availability message
Browse files Browse the repository at this point in the history
Signed-off-by: Rokibul Hasan <mdrokibulhasan@appscode.com>
  • Loading branch information
RokibulHasan7 committed Oct 25, 2024
1 parent 865ae06 commit 73e068e
Showing 1 changed file with 16 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,24 +78,27 @@ func (k *klusterletStatusController) sync(ctx context.Context, controllerContext
registrationDeploymentName := fmt.Sprintf("%s-registration-agent", klusterlet.Name)
workDeploymentName := fmt.Sprintf("%s-work-agent", klusterlet.Name)

if helpers.IsSingleton(klusterlet.Spec.DeployOption.Mode) {
IsSingleton := helpers.IsSingleton(klusterlet.Spec.DeployOption.Mode)
if IsSingleton {
registrationDeploymentName = fmt.Sprintf("%s-agent", klusterlet.Name)
workDeploymentName = registrationDeploymentName
}

availableCondition := checkAgentsDeploymentAvailable(
ctx, k.kubeClient,
[]klusterletAgent{
{
deploymentName: registrationDeploymentName,
namespace: agentNamespace,
},
{
deploymentName: workDeploymentName,
namespace: agentNamespace,
},
agents := []klusterletAgent{
{
deploymentName: registrationDeploymentName,
namespace: agentNamespace,
},
)
}

if !IsSingleton {
agents = append(agents, klusterletAgent{
deploymentName: workDeploymentName,
namespace: agentNamespace,
})
}

availableCondition := checkAgentsDeploymentAvailable(ctx, k.kubeClient, agents)
availableCondition.ObservedGeneration = klusterlet.Generation
meta.SetStatusCondition(&newKlusterlet.Status.Conditions, availableCondition)

Expand Down

0 comments on commit 73e068e

Please sign in to comment.