Skip to content

Commit

Permalink
Remove action when relocate completes
Browse files Browse the repository at this point in the history
Once relocate completes it is pointless to keep the drpc in "Relocate"
phase. Removing the action switch to "Deployed" phase.

This solve the annoying error when trying to deploy after relocate
completes:

    drenv.commands.Error: Command failed:
       command: ('kubectl', 'wait', '--context', 'hub', 'drpc/busybox-drpc',
                 '--for=jsonpath={.status.phase}=Deployed',
                 '--namespace=busybox-sample', '--timeout=60s')
       exitcode: 1
       error:
          error: timed out waiting for the condition on drplacementcontrols/busybox-drpc

Example relocate flow:

    $ test/basic-test/relocate --cluster dr1 test/envs/regional-dr.yaml
    2023-07-09 23:29:48,746 INFO    [relocate] Relocate to cluster 'dr1'
    2023-07-09 23:29:48,746 INFO    [relocate] Waiting until peer is ready
    2023-07-09 23:29:48,892 INFO    [relocate] Waiting until application is replicated
    2023-07-09 23:29:48,942 INFO    [relocate] Starting relocate
    2023-07-09 23:29:49,017 INFO    [relocate] Waiting until application is relocated...
    2023-07-09 23:31:30,047 INFO    [relocate] Waiting until relocation completes...
    2023-07-09 23:31:58,116 INFO    [relocate] Ending relocate action
    2023-07-09 23:31:58,179 INFO    [relocate] Waiting until drpc is deployed
    2023-07-09 23:31:58,324 INFO    [relocate] Application was relocated to cluster dr1 successfully

Example drpc states during this run (redacted):

    $ kubectl get drpc -n busybox-sample --context hub -o wide -w
    DESIREDSTATE   CURRENTSTATE   PROGRESSION                   START TIME             DURATION         PEER READY
                   Deployed       Completed                     2023-07-09T20:26:52Z   2m8.156661282s   True
    Relocate       Deployed       Completed                     2023-07-09T20:26:52Z   2m8.156661282s   True
    Relocate       Initiating     PreparingFinalSync            2023-07-09T20:29:49Z                    True
    Relocate       Relocating     RunningFinalSync              2023-07-09T20:29:49Z                    False
    Relocate       Relocating     EnsuringVolumesAreSecondary   2023-07-09T20:29:49Z                    False
    Relocate       Relocating     WaitingForResourceRestore     2023-07-09T20:29:49Z                    False
    Relocate       Relocating     WaitingForResourceRestore     2023-07-09T20:29:49Z                    False
    Relocate       Relocating     WaitingForResourceRestore     2023-07-09T20:29:49Z                    False
    Relocate       Relocated      UpdatedPlacement              2023-07-09T20:29:49Z                    True
    Relocate       Relocated      Cleaning Up                   2023-07-09T20:29:49Z                    True
    Relocate       Relocated      Completed                     2023-07-09T20:29:49Z   2m9.091104326s   True
                   Relocated      Completed                     2023-07-09T20:29:49Z   2m9.091104326s   True
                   Deployed       Completed                     2023-07-09T20:29:49Z   2m9.091104326s   True

Signed-off-by: Nir Soffer <nsoffer@redhat.com>
  • Loading branch information
nirs committed Jul 9, 2023
1 parent 29f8b7b commit f11b436
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/basic-test/relocate
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,26 @@ kubectl.wait(
log=test.debug,
)

test.info("Ending relocate action")
patch = {"spec": {"action": None}}
kubectl.patch(
f"drpc/{config['name']}",
"--patch",
json.dumps(patch),
"--type=merge",
f"--namespace={config['namespace']}",
context=test.env["hub"],
log=test.debug,
)

test.info("Waiting until drpc is deployed")
kubectl.wait(
f"drpc/{config['name']}",
"--for=jsonpath={.status.phase}=Deployed",
f"--namespace={config['namespace']}",
"--timeout=60s",
context=test.env["hub"],
log=test.debug,
)

test.info("Application was relocated to cluster %s successfully", cluster)

0 comments on commit f11b436

Please sign in to comment.