diff --git a/internal/onepassword/client.go b/internal/onepassword/client.go index 0b804f2..46abed5 100644 --- a/internal/onepassword/client.go +++ b/internal/onepassword/client.go @@ -77,7 +77,6 @@ func (op *Client) GetSecret(vault, secretID string) (*Secret, error) { if err != nil { return nil, err } - item := response{} if err := json.Unmarshal(res, &item); err != nil { return nil, err diff --git a/main.go b/main.go index 0bc28e2..a0d23c5 100644 --- a/main.go +++ b/main.go @@ -3,6 +3,7 @@ package main import ( "context" "fmt" + "log" "os" "os/user" "time" @@ -38,19 +39,21 @@ func main() { } for { + log.Println("[DEBUG] Syncing secrets") list, err := clientset.CoreV1().Secrets(apiv1.NamespaceAll).List(context.Background(), metav1.ListOptions{}) if err != nil { panic(err) } for _, s := range list.Items { if passwordID, exists := s.ObjectMeta.Annotations[idAnnotation]; exists { + log.Printf("[INFO] Syncing secret %s with 1Password secret %s\n", s.GetName(), passwordID) keys := parseAnnotations(s.ObjectMeta.Annotations) vault := keys["vault"] item, err := opClient.GetSecret(vault, passwordID) if err != nil { - fmt.Println("[ERROR] Could not get secret", err) + log.Println("[ERROR] Could not get secret", err) continue } @@ -69,7 +72,7 @@ func main() { } if _, err := clientset.CoreV1().Secrets(s.GetNamespace()).Update(context.Background(), &s, metav1.UpdateOptions{}); err != nil { - fmt.Println("[ERROR] Could not update secret value", err) + log.Println("[ERROR] Could not update secret value", err) continue } }