Skip to content
This repository was archived by the owner on Oct 28, 2024. It is now read-only.

Remove old webhookconfiguration if it alreasy exist before create new one #161

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,17 @@ func createValidatingWebhookConfiguration(client client.Client, caPEM []byte) er
if !apierrors.IsAlreadyExists(err) {
return err
}
log.Info(fmt.Sprintf("validatingwebhookconfiguration/%s already exist", VCWebhookCfgName))
log.Info(fmt.Sprintf("validatingwebhookconfiguration/%s already exist, need remove firstly", VCWebhookCfgName))
err := client.Delete(context.TODO(), &vwhCfg)
if err != nil {
return err
}

err = client.Create(context.TODO(), &vwhCfg)
if err != nil {
return err
}

return nil
}
log.Info(fmt.Sprintf("successfully created validatingwebhookconfiguration/%s", VCWebhookCfgName))
Expand Down