some improvements

This commit is contained in:
ston1th 2019-12-01 01:12:22 +01:00
commit 498de9b0b8
4 changed files with 4 additions and 9 deletions

View file

@ -1,6 +1,6 @@
# pvc-reaper
The PersistentVolumeClaim Reaper cleans up `PersistentVolumes` created by Tekton Pipelines that are stuck in the `terminating` state.
The PersistentVolumeClaim Reaper cleans up `PersistentVolumeClaims` created by Tekton Pipelines that are stuck in the `Terminating` state.
# Build and run

View file

@ -9,8 +9,6 @@ spec:
requiredDropCapabilities:
- ALL
readOnlyRootFilesystem: true
volumes:
- 'secret'
hostNetwork: false
hostIPC: false
hostPID: false

View file

@ -9,7 +9,6 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: pvc-reaper
namespace: pvc-reaper
rules:
- apiGroups: [""]
resources: ["persistentvolumes", "persistentvolumeclaims"]
@ -23,7 +22,6 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: pvc-reaper
namespace: pvc-reaper
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole

View file

@ -27,14 +27,12 @@ var emptyFinalizers = []byte(`{"metadata":{"finalizers":null}}`)
func main() {
cfg, err := rest.InClusterConfig()
if err != nil {
log.Printf("error configuring kube client: %s\n", err)
os.Exit(1)
log.Fatalf("error configuring kube client: %s\n", err)
}
cl, err := kubernetes.NewForConfig(cfg)
if err != nil {
log.Printf("error creating new kube client: %s\n", err)
os.Exit(1)
log.Fatalf("error creating new kube client: %s\n", err)
}
factory := informers.NewSharedInformerFactory(cl, time.Second*30)
pvcInformer := factory.Core().V1().PersistentVolumeClaims().Informer()
@ -88,6 +86,7 @@ func main() {
stop := make(chan struct{})
factory.Start(stop)
log.Println("started pvc watcher")
sigs := make(chan os.Signal)
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)