Skip to content

Commit

Permalink
fix panic: argoRolloutsEnabled=false
Browse files Browse the repository at this point in the history
  • Loading branch information
Nandan B N committed Mar 4, 2022
1 parent f1dc5b4 commit 8a0488a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions admiral/pkg/clusters/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,9 @@ func (gtp *GlobalTrafficHandler) Added(obj *v1.GlobalTrafficPolicy) {
//IMPORTANT: The deployment/Rollout matched with a GTP will not necessarily be from the same cluster. This is because the same service could be deployed in multiple clusters and we need to guarantee consistent behavior
for _, remoteCluster := range gtp.RemoteRegistry.RemoteControllers {
matchedDeployments = append(matchedDeployments, remoteCluster.DeploymentController.GetDeploymentByLabel(obj.Labels[common.GetGlobalTrafficDeploymentLabel()], obj.Namespace)...)
matchedRollouts = append(matchedRollouts, remoteCluster.RolloutController.GetRolloutByLabel(obj.Labels[common.GetGlobalTrafficDeploymentLabel()], obj.Namespace)...)
if gtp.RemoteRegistry.AdmiralCache.argoRolloutsEnabled {
matchedRollouts = append(matchedRollouts, remoteCluster.RolloutController.GetRolloutByLabel(obj.Labels[common.GetGlobalTrafficDeploymentLabel()], obj.Namespace)...)
}
}

deployments := common.MatchDeploymentsToGTP(obj, matchedDeployments)
Expand Down Expand Up @@ -317,7 +319,9 @@ func (gtp *GlobalTrafficHandler) Updated(obj *v1.GlobalTrafficPolicy) {
//IMPORTANT: The deployment/Rollout matched with a GTP will not necessarily be from the same cluster. This is because the same service could be deployed in multiple clusters and we need to guarantee consistent behavior
for _, remoteCluster := range gtp.RemoteRegistry.RemoteControllers {
matchedDeployments = append(matchedDeployments, remoteCluster.DeploymentController.GetDeploymentByLabel(obj.Labels[common.GetGlobalTrafficDeploymentLabel()], obj.Namespace)...)
matchedRollouts = append(matchedRollouts, remoteCluster.RolloutController.GetRolloutByLabel(obj.Labels[common.GetGlobalTrafficDeploymentLabel()], obj.Namespace)...)
if gtp.RemoteRegistry.AdmiralCache.argoRolloutsEnabled {
matchedRollouts = append(matchedRollouts, remoteCluster.RolloutController.GetRolloutByLabel(obj.Labels[common.GetGlobalTrafficDeploymentLabel()], obj.Namespace)...)
}
}

deployments := common.MatchDeploymentsToGTP(obj, matchedDeployments)
Expand Down

0 comments on commit 8a0488a

Please sign in to comment.