Skip to content

Commit

Permalink
Disable vrgNamespace caching to prevent upgrade issues
Browse files Browse the repository at this point in the history
Previously, we implemented a caching mechanism for vrgNamespace to optimize
the process of fetching the namespace of the application when it is part of
the ApplicationSet. However, this approach caused an upgrade problem when
moving from version 4.12 to 4.13. This commit will disable the vrgNamespace
caching until all customers have upgraded to version 4.13 or later.

Signed-off-by: Benamar Mekhissi <[email protected]>
  • Loading branch information
Benamar Mekhissi authored and ShyamsundarR committed Aug 3, 2023
1 parent e78aa80 commit 572c9dc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 2 additions & 2 deletions controllers/drplacementcontrol.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ func (d *DRPCInstance) startDeploying(homeCluster, homeClusterNamespace string)

// All good, update the preferred decision and state
d.instance.Status.PreferredDecision.ClusterName = d.instance.Spec.PreferredCluster
d.instance.Status.PreferredDecision.ClusterNamespace = d.vrgNamespace
d.instance.Status.PreferredDecision.ClusterNamespace = d.instance.Spec.PreferredCluster

d.log.Info("Updated PreferredDecision", "PreferredDecision", d.instance.Status.PreferredDecision)

Expand Down Expand Up @@ -1356,7 +1356,7 @@ func (d *DRPCInstance) updatePreferredDecision() {
reflect.DeepEqual(d.instance.Status.PreferredDecision, plrv1.PlacementDecision{}) {
d.instance.Status.PreferredDecision = plrv1.PlacementDecision{
ClusterName: d.instance.Spec.PreferredCluster,
ClusterNamespace: d.vrgNamespace,
ClusterNamespace: d.instance.Spec.PreferredCluster,
}
}
}
Expand Down
6 changes: 1 addition & 5 deletions controllers/drplacementcontrol_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,7 @@ func (r *DRPlacementControlReconciler) finalizeDRPC(ctx context.Context, drpc *r
Ctx: ctx,
Log: r.Log,
InstName: drpc.Name,
TargetNamespace: drpc.Status.PreferredDecision.ClusterNamespace,
TargetNamespace: vrgNamespace,
}

drPolicy, err := r.getDRPolicy(ctx, drpc, log)
Expand Down Expand Up @@ -1811,10 +1811,6 @@ func selectVRGNamespace(
drpc *rmn.DRPlacementControl,
placementObj client.Object,
) (string, error) {
if drpc.Status.PreferredDecision.ClusterNamespace != "" {
return drpc.Status.PreferredDecision.ClusterNamespace, nil
}

switch placementObj.(type) {
case *clrapiv1beta1.Placement:
vrgNamespace, err := getApplicationDestinationNamespace(client, log, placementObj)
Expand Down

0 comments on commit 572c9dc

Please sign in to comment.