Skip to content

Commit

Permalink
Delete workloads before volumesets on GVC deletion (#245)
Browse files Browse the repository at this point in the history
  • Loading branch information
zzaakiirr authored Nov 30, 2024
1 parent 4c4f5ea commit f8b544d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ _Please add entries here for your pull requests that have not yet been released.

- Fixed potential infinite loop that could occur for a command if one of the execution steps fails and gets stuck. [PR 217](https://github.com/shakacode/control-plane-flow/pull/217) by [Zakir Dzhamaliddinov](https://github.com/zzaakiirr).

- Fixed issue where app cannot be deleted because one of the workloads has a volumeset in-use. [PR 245](https://github.com/shakacode/control-plane-flow/pull/245) by [Zakir Dzhamaliddinov](https://github.com/zzaakiirr).

## [4.0.0] - 2024-08-21

### Fixed
Expand Down
6 changes: 3 additions & 3 deletions lib/command/delete.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ def delete_workload(workload)
def delete_volumesets
@volumesets.each do |volumeset|
step("Deleting volumeset '#{volumeset['name']}' from app '#{config.app}'") do
# If the volumeset is attached to a workload, we need to delete the workload first
workload = volumeset.dig("status", "usedByWorkload")&.split("/")&.last
cp.delete_workload(workload) if workload
# If the volumeset is attached to workloads, we need to delete the workloads first
workloads = volumeset.dig("status", "workloadLinks")&.map { |workload_link| workload_link.split("/").last }
workloads&.each { |workload| cp.delete_workload(workload) }

cp.delete_volumeset(volumeset["name"])
end
Expand Down

0 comments on commit f8b544d

Please sign in to comment.