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

Annotate PVC with errors from Controller #1

Open
phenixblue opened this issue Aug 17, 2021 · 4 comments
Open

Annotate PVC with errors from Controller #1

phenixblue opened this issue Aug 17, 2021 · 4 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@phenixblue
Copy link
Owner

Need to add functionality to the controller to update target PVC resources when certain errors occur within the reconciliation.

At a minimum for when an incorrect volume retention policy is specified.

Example:

When labeling a PVC with a retention policy that isn't Retain, Delete, or Recycle the controller logs the following errors:

2021-08-17T20:28:05.659Z	INFO	controllers.PersistentVolumeClaim	Setting reclaim policy to match PVC label	{"pvc": "test2/datadir-crdb1-2", "pv": "pvc-70a047e8-bc55-4ff8-b389-76cd07440f3d", "policy-from-pvc-label": "Dummy", "policy-from-pv": "Delete"}
2021-08-17T20:28:05.663Z	ERROR	controller-runtime.controller	Reconciler error	{"controller": "persistentvolumeclaim", "request": "test2/datadir-crdb1-2", "error": "could not update PV: PersistentVolume \"pvc-70a047e8-bc55-4ff8-b389-76cd07440f3d\" is invalid: spec.persistentVolumeReclaimPolicy: Unsupported value: \"Dummy\": supported values: \"Delete\", \"Recycle\", \"Retain\""}

Information about the error could be added to an annotation on the target PVC resource to provide a feedback mechanism to end-users who probably don't have access to view the volrec controller logs.

@phenixblue phenixblue added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Aug 17, 2021
@phenixblue
Copy link
Owner Author

something like storage.k8s.twr.io/volrec-errors might be a good annotation key to use.

These should also probably be cleaned up on the first successful reconcile following the initial error.

@phenixblue
Copy link
Owner Author

Maybe also write a Kubernetes event to the target namespace as well. I feel like the more methods of feedback the better. In cases where there's a simple typo in the reclaim policy (ie. Retains instead of Retain) a user could inadvertently think the underlying volume would be retained, and it could actually be deleted.

@phenixblue
Copy link
Owner Author

This could be made generic to just reflect the status overall to let a user know if the labeling was successful or not.

@phenixblue
Copy link
Owner Author

Could also add a MagTape policy to warn users directly (using warning subsystem from Admission Controllers on k8s 1.19+)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant