bugfix
This commit is contained in:
parent
498de9b0b8
commit
3f84766915
1 changed files with 3 additions and 4 deletions
7
main.go
7
main.go
|
|
@ -52,12 +52,11 @@ func main() {
|
||||||
},
|
},
|
||||||
UpdateFunc: func(_, obj interface{}) {
|
UpdateFunc: func(_, obj interface{}) {
|
||||||
pvc, ok := obj.(*corev1.PersistentVolumeClaim)
|
pvc, ok := obj.(*corev1.PersistentVolumeClaim)
|
||||||
owner := pvc.OwnerReferences
|
if !ok || pvc.DeletionTimestamp == nil || pvc.OwnerReferences == nil {
|
||||||
if !ok || pvc.DeletionTimestamp == nil || owner == nil {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if owner[0].APIVersion == "tekton.dev/v1alpha1" &&
|
if pvc.OwnerReferences[0].APIVersion == "tekton.dev/v1alpha1" &&
|
||||||
owner[0].Kind == "PipelineRun" {
|
pvc.OwnerReferences[0].Kind == "PipelineRun" {
|
||||||
pvs := cl.CoreV1().PersistentVolumes()
|
pvs := cl.CoreV1().PersistentVolumes()
|
||||||
pv, err := pvs.Get(pvc.Spec.VolumeName, metav1.GetOptions{})
|
pv, err := pvs.Get(pvc.Spec.VolumeName, metav1.GetOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue