-
Notifications
You must be signed in to change notification settings - Fork 20
feat: make hub statefulset work by stripping some properties from generated PVCs #347
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
Changes from 7 commits
6e509d4
676df2a
3e06c8d
1befc44
5914312
b3edb75
6ec57d7
d6e48ca
540fe6f
d37ed21
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -104,6 +104,8 @@ func trackInMemberClusterObjAvailabilityByGVR( | |
| return trackCRDAvailability(inMemberClusterObj) | ||
| case utils.PodDisruptionBudgetGVR: | ||
| return trackPDBAvailability(inMemberClusterObj) | ||
| case utils.PersistentVolumeClaimGVR: | ||
| return trackPVCAvailability(inMemberClusterObj) | ||
| default: | ||
| if isDataResource(*gvr) { | ||
| klog.V(2).InfoS("The object from the member cluster is a data object, consider it to be immediately available", | ||
|
|
@@ -269,6 +271,28 @@ func trackPDBAvailability(curObj *unstructured.Unstructured) (ManifestProcessing | |
| return AvailabilityResultTypeNotYetAvailable, nil | ||
| } | ||
|
|
||
| // trackPVCAvailability tracks the availability of a persistent volume claim in the member cluster. | ||
| func trackPVCAvailability(inMemberClusterObj *unstructured.Unstructured) (ManifestProcessingAvailabilityResultType, error) { | ||
| var pvc corev1.PersistentVolumeClaim | ||
| if err := runtime.DefaultUnstructuredConverter.FromUnstructured(inMemberClusterObj.Object, &pvc); err != nil { | ||
| wrappedErr := fmt.Errorf("failed to convert the unstructured object to a persistent volume claim: %w", err) | ||
| _ = controller.NewUnexpectedBehaviorError(wrappedErr) | ||
| return AvailabilityResultTypeFailed, wrappedErr | ||
| } | ||
|
|
||
| // Check if the PVC is bound. | ||
| // A PVC is considered available when it's in the Bound phase, meaning it has been | ||
| // successfully bound to a PersistentVolume and is ready to be used by pods. | ||
| if pvc.Status.Phase == corev1.ClaimBound { | ||
|
||
| klog.V(2).InfoS("PersistentVolumeClaim is available", "pvc", klog.KObj(inMemberClusterObj)) | ||
| return AvailabilityResultTypeAvailable, nil | ||
| } | ||
|
|
||
| klog.V(2).InfoS("PersistentVolumeClaim is not ready yet, will check later to see if it becomes available", | ||
| "pvc", klog.KObj(inMemberClusterObj), "phase", pvc.Status.Phase) | ||
| return AvailabilityResultTypeNotYetAvailable, nil | ||
| } | ||
|
|
||
| // isDataResource checks if the resource is a data resource; such resources are | ||
| // available immediately after creation. | ||
| func isDataResource(gvr schema.GroupVersionResource) bool { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.