diff --git a/README.md b/README.md index a1bd601..aa69b02 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/config/01-podsecuritypolicy.yaml b/config/01-podsecuritypolicy.yaml index b25db9e..722161a 100644 --- a/config/01-podsecuritypolicy.yaml +++ b/config/01-podsecuritypolicy.yaml @@ -9,8 +9,6 @@ spec: requiredDropCapabilities: - ALL readOnlyRootFilesystem: true - volumes: - - 'secret' hostNetwork: false hostIPC: false hostPID: false diff --git a/config/02-sa.yaml b/config/02-sa.yaml index e27a230..21ceb4f 100644 --- a/config/02-sa.yaml +++ b/config/02-sa.yaml @@ -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 diff --git a/main.go b/main.go index e288292..375a95f 100644 --- a/main.go +++ b/main.go @@ -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)