Motivation
When running a command that affects the state of the Okctl environment, Okctl will prevent other users from affecting the state simultaneously which can cause unexpected results.
In some cases, Okctl can fail to unlock the state after modifying it, preventing further modification to the state.
Solution
- In the AWS console, navigate to the DynamoDB service
- Navigate to
Tables
and select the table calledokctl-<cluster name>-state-lock
- Click
View items
in the top right corner - Select all items, click
Actions
and chooseDelete items
You should now be able to run commands that modify the state of the Okctl environment.
Implementation
Before each command that potentially modifies the state, Okctl will look for a DynamoDB table called okctl-<cluster name>-state-lock
and verify that it doesn't contain any items.
If an item exists (meaning someone else is running a command that can potentially modify the state), Okctl will stop the current operation ensuring only the first user can run their command.
If no items exist, Okctl will insert a string which it will remove after it's done running the requested command.