Skip to content

Commit

Permalink
🐛 fix admission update flow (#1040)
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Milchev <[email protected]>
  • Loading branch information
imilchev authored Feb 28, 2024
1 parent 3646a0a commit 4156b63
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions controllers/admission/deployment_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,14 +268,9 @@ func (n *DeploymentHandler) syncWebhookDeployment(ctx context.Context) error {
// Not a full check for whether someone has modified our Deployment, but checking for some important bits so we know
// if an Update() is needed.
if !k8s.AreDeploymentsEqual(*existingDeployment, *desiredDeployment) {
// Note: changes to the labels/selector labels means we can't Update() the
// Deployment, so we'll do a delete/create instead.
if err := k8s.DeleteIfExists(ctx, n.KubeClient, existingDeployment); err != nil {
webhookLog.Error(err, "failed to delete exising webhook Deployment")
return err
}
if _, err := k8s.CreateIfNotExist(ctx, n.KubeClient, existingDeployment, desiredDeployment); err != nil {
webhookLog.Error(err, "failed to replace exising webhook Deployment")
k8s.UpdateDeployment(existingDeployment, *desiredDeployment)
if err := n.KubeClient.Update(ctx, existingDeployment); err != nil {
webhookLog.Error(err, "failed to update exising webhook Deployment")
return err
}
}
Expand Down

0 comments on commit 4156b63

Please sign in to comment.