Skip to content

Commit

Permalink
fix(cert-manager): avoid index-out-of-bounds error when updating webh…
Browse files Browse the repository at this point in the history
…ook configs (#1497)

Signed-off-by: Florian Bacher <[email protected]>
  • Loading branch information
bacherfl authored May 31, 2023
1 parent 76a4bd9 commit 0f28b8c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ func (r *KeptnWebhookCertificateReconciler) updateConfigurations(ctx context.Con
}

for i := range validatingWebhookConfigurationList.Items {
r.Log.Info("injecting certificate into validating webhook config", "vwc", mutatingWebhookConfigurationList.Items[i].Name)
r.Log.Info("injecting certificate into validating webhook config", "vwc", validatingWebhookConfigurationList.Items[i].Name)
if err := r.updateClientConfigurations(ctx, bundle, validatingWebhookConfigs, &validatingWebhookConfigurationList.Items[i]); err != nil {
return err
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ func TestReconcile(t *testing.T) {
t.Run(`reconcile successfully with mutatingwebhookconfiguration`, func(t *testing.T) {
fakeClient := fake.NewClient(crd1, crd2, crd3, &admissionregistrationv1.MutatingWebhookConfiguration{
ObjectMeta: metav1.ObjectMeta{
Name: "my-mutating-webhook-config",
Name: "my-mutating-webhook-config",
Labels: getMatchLabel(),
},
Webhooks: []admissionregistrationv1.MutatingWebhook{
{
Expand All @@ -167,7 +168,8 @@ func TestReconcile(t *testing.T) {
t.Run(`reconcile successfully with validatingwebhookconfiguration`, func(t *testing.T) {
fakeClient := fake.NewClient(crd1, crd2, crd3, &admissionregistrationv1.ValidatingWebhookConfiguration{
ObjectMeta: metav1.ObjectMeta{
Name: "my-validating-webhook-config",
Name: "my-validating-webhook-config",
Labels: getMatchLabel(),
},
Webhooks: []admissionregistrationv1.ValidatingWebhook{
{
Expand Down

0 comments on commit 0f28b8c

Please sign in to comment.