From 9e77e7f378a6095cf31710c4fce74ea5dff6ef83 Mon Sep 17 00:00:00 2001 From: Tim Buchinger Date: Fri, 16 Dec 2022 17:21:15 -0500 Subject: [PATCH] Increment counter for failed sync --- .../controller/azureKeyVaultSecret.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/azure-keyvault-controller/controller/azureKeyVaultSecret.go b/cmd/azure-keyvault-controller/controller/azureKeyVaultSecret.go index 9537f926..2bbf6659 100644 --- a/cmd/azure-keyvault-controller/controller/azureKeyVaultSecret.go +++ b/cmd/azure-keyvault-controller/controller/azureKeyVaultSecret.go @@ -42,6 +42,7 @@ func (c *Controller) initAzureKeyVaultSecret() { akvs, err := convertToAzureKeyVaultSecret(obj) if err != nil { klog.ErrorS(err, "failed to convert to azurekeyvaultsecret") + syncFailures.WithLabelValues("add", "AzureKeyVaultSecret").Inc() return } @@ -55,12 +56,14 @@ func (c *Controller) initAzureKeyVaultSecret() { newAkvs, err := convertToAzureKeyVaultSecret(new) if err != nil { klog.ErrorS(err, "failed to convert to azurekeyvaultsecret") + syncFailures.WithLabelValues("update", "AzureKeyVault").Inc() return } oldAkvs, err := convertToAzureKeyVaultSecret(old) if err != nil { klog.ErrorS(err, "failed to convert to azurekeyvaultsecret") + syncFailures.WithLabelValues("update", "AzureKeyVault").Inc() return } @@ -82,6 +85,7 @@ func (c *Controller) initAzureKeyVaultSecret() { akvs, err := convertToAzureKeyVaultSecret(obj) if err != nil { klog.ErrorS(err, "failed to convert to azurekeyvaultsecret") + syncFailures.WithLabelValues("delete", "AzureKeyVaultSecret").Inc() return } @@ -93,6 +97,7 @@ func (c *Controller) initAzureKeyVaultSecret() { err = c.deleteKubernetesValues(akvs) if err != nil { klog.ErrorS(err, "failed to delete secret data from azurekeyvaultsecret", "azurekeyvaultsecret", klog.KObj(akvs)) + syncFailures.WithLabelValues("delete", "AzureKeyVaultSecret").Inc() } // Getting default key to remove from Azure work queue