Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated the delete conditions for removing an app's persistent volume #73

Merged
merged 5 commits into from
Jul 11, 2024

Conversation

alexlianides
Copy link
Collaborator

updated the delete conditions for removing an app's persistent volume only if the reclaim policy is "Retain". Otherwise, k3s delete the volume automatically via deletion of the volume claim

@alexlianides alexlianides requested a review from a team as a code owner July 10, 2024 22:21
modules/m_110_debugshim.sh Outdated Show resolved Hide resolved
Copy link
Contributor

@bigtallcampbell bigtallcampbell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The claim name is pulling from the wrong spot. For example, the results for hostsvc-link query you've got would be:

ryan@ryan-dev1:~/azure-orbital-space-sdk-setup$ kubectl get persistentvolume --output json -A | jq -r '.items[] | select(.metadata.labels."microsoft.azureorbital/appName" == "hostsvc-link") | {pv_name: .metadata.name, pv_namespace: .metadata.namespace, volume_name: .spec.volumeName, volume_reclaim_policy: .spec.persistentVolumeReClaimPolicy}'
{
  "pv_name": "hostsvc-link-xfer-pv",
  "pv_namespace": null,
  "volume_name": null,
  "volume_reclaim_policy": null
}
{
  "pv_name": "hostsvc-link-plugins-pv",
  "pv_namespace": null,
  "volume_name": null,
  "volume_reclaim_policy": null
}
{
  "pv_name": "hostsvc-link-allxfer-pv",
  "pv_namespace": null,
  "volume_name": null,
  "volume_reclaim_policy": null
}

It should be:

kubectl get persistentvolume --output json -A | jq -r '.items[] | select(.metadata.labels."microsoft.azureorbital/appName" == "hostsvc-link") | {pv_name: .metadata.name, volume_name: .spec.claimRef.name, volume_namespace: .spec.claimRef.namespace, volume_reclaim_policy: .spec.persistentVolumeReclaimPolicy}'
{
  "pv_name": "hostsvc-link-xfer-pv",
  "volume_name": "hostsvc-link-xfer-pvc",
  "volume_namespace": "hostsvc",
  "volume_reclaim_policy": "Delete"
}
{
  "pv_name": "hostsvc-link-plugins-pv",
  "volume_name": "hostsvc-link-plugins-pvc",
  "volume_namespace": "hostsvc",
  "volume_reclaim_policy": "Delete"
}
{
  "pv_name": "hostsvc-link-allxfer-pv",
  "volume_name": "hostsvc-link-allxfer-pvc",
  "volume_namespace": "hostsvc",
  "volume_reclaim_policy": "Delete"
}

Notable changes:

  • Namespace variable is updated for persistentvolumeclaim (PersistentVolumes don't have namespaces)
  • Typo correction on Volume Reclaim Policy
  • Variable name update

Once updated, you'll need to update line #46 and change the `kubectl delete persistentvolumeclaim' to use the volume_name and volume_namespace. Currently it's trying to delete the persistentvolumeclaim that matches the volume name.

@bigtallcampbell bigtallcampbell merged commit a493170 into main Jul 11, 2024
9 checks passed
@bigtallcampbell bigtallcampbell deleted the al/debugShim branch July 11, 2024 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants