Skip to content

Commit

Permalink
Revert "Merge pull request #164 from yix/master"
Browse files Browse the repository at this point in the history
This reverts commit 39076f5, reversing
changes made to 6a6519f.
  • Loading branch information
181192 committed Mar 22, 2021
1 parent 5f44a30 commit c462e3a
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions cmd/azure-keyvault-controller/controller/azureKeyVaultSecret.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,16 +228,15 @@ func (c *Controller) syncAzureKeyVault(key string) error {

klog.InfoS("updating with recent changes from azure key vault", "azurekeyvaultsecret", klog.KObj(akvs), "secret", klog.KRef(akvs.Namespace, akvs.Spec.Output.Secret.Name))
existingSecret, err := c.kubeclientset.CoreV1().Secrets(akvs.Namespace).Get(context.TODO(), akvs.Spec.Output.Secret.Name, metav1.GetOptions{})
var updatedSecret *corev1.Secret
if err != nil {
klog.ErrorS(err, "failed to get existing secret", "secret", akvs.Spec.Output.Secret.Name)
updatedSecret = createNewSecret(akvs, secretValue)
} else {
updatedSecret, err = createNewSecretFromExisting(akvs, secretValue, existingSecret)
if err != nil {
return fmt.Errorf("failed to update existing secret %s, error: %+v", akvs.Spec.Output.Secret.Name, err)
}
return fmt.Errorf("failed to get existing secret %s, error: %+v", akvs.Spec.Output.Secret.Name, err)
}

updatedSecret, err := createNewSecretFromExisting(akvs, secretValue, existingSecret)
if err != nil {
return fmt.Errorf("failed to update existing secret %s, error: %+v", akvs.Spec.Output.Secret.Name, err)
}

secret, err := c.kubeclientset.CoreV1().Secrets(akvs.Namespace).Update(context.TODO(), updatedSecret, metav1.UpdateOptions{})
if err != nil {
return fmt.Errorf("failed to update secret, error: %+v", err)
Expand Down

0 comments on commit c462e3a

Please sign in to comment.