updated
This commit is contained in:
parent
6a06551838
commit
e155cf9437
2 changed files with 4 additions and 13 deletions
1
.ko.yaml
Normal file
1
.ko.yaml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
defaultBaseImage: gcr.io/distroless/static:nonroot
|
||||||
16
main.go
16
main.go
|
|
@ -38,21 +38,11 @@ func main() {
|
||||||
pvcInformer := factory.Core().V1().PersistentVolumeClaims().Informer()
|
pvcInformer := factory.Core().V1().PersistentVolumeClaims().Informer()
|
||||||
|
|
||||||
pvcInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{
|
pvcInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{
|
||||||
AddFunc: func(obj interface{}) {
|
AddFunc: func(_ interface{}) {},
|
||||||
pvc, ok := obj.(*corev1.PersistentVolumeClaim)
|
DeleteFunc: func(_ interface{}) {},
|
||||||
if ok {
|
|
||||||
log.Printf("pvc added: %s/%s\n", pvc.Namespace, pvc.Name)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
DeleteFunc: func(obj interface{}) {
|
|
||||||
pvc, ok := obj.(*corev1.PersistentVolumeClaim)
|
|
||||||
if ok {
|
|
||||||
log.Printf("pvc deleted: %s/%s\n", pvc.Namespace, pvc.Name)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
UpdateFunc: func(_, obj interface{}) {
|
UpdateFunc: func(_, obj interface{}) {
|
||||||
pvc, ok := obj.(*corev1.PersistentVolumeClaim)
|
pvc, ok := obj.(*corev1.PersistentVolumeClaim)
|
||||||
if !ok || pvc.DeletionTimestamp == nil || pvc.OwnerReferences == nil {
|
if !ok || pvc.DeletionTimestamp == nil || len(pvc.OwnerReferences) < 1 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if pvc.OwnerReferences[0].APIVersion == "tekton.dev/v1alpha1" &&
|
if pvc.OwnerReferences[0].APIVersion == "tekton.dev/v1alpha1" &&
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue