Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Migrate validating webhook to kustomize #1617

Merged
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
34de814
migrate validating webhook to kustomize
shorim Nov 19, 2024
e53b64d
rename validating webhook in tests
shorim Nov 19, 2024
18a1a94
remove deletion of validating webhook from Telemetry reconciler
shorim Nov 19, 2024
1d0b871
delete old validating webhook
shorim Nov 19, 2024
e38b04d
fix linting
shorim Nov 19, 2024
b2e5773
adjust telemetry e2e test
shorim Nov 19, 2024
d645b0d
adjust overrides e2e test
shorim Nov 19, 2024
3cffe8a
Merge remote-tracking branch 'origin/main' into migrate_validating_we…
shorim Nov 19, 2024
51f3c9c
adjust unit tests
shorim Nov 19, 2024
0dd5e52
delete unnecessary unit test
shorim Nov 19, 2024
8e4e9f7
use update request instead of patch request for conversion webhook
shorim Nov 19, 2024
0b79afa
rename validatin webhook
shorim Nov 20, 2024
f725b9d
rename variable for ValidatingWebhookName in e2e tests common names
shorim Nov 20, 2024
d7e5b7a
rename logpipeline and logparsers webhooks
shorim Nov 20, 2024
66ba7c3
fix linting
shorim Nov 20, 2024
b0477b0
adjust test coverage threshold for internal/webhookcert pkg
shorim Nov 20, 2024
643fbd4
update clusterRole for manager to allow updating CRDs
shorim Nov 20, 2024
7addc21
Merge branch 'main' into migrate_validating_webhook_to_kustomize
shorim Nov 20, 2024
f17ef1d
rename updateLogPipelineWithWebhookConfig func
shorim Nov 20, 2024
ccb1863
Merge remote-tracking branch 'origin/main' into migrate_validating_we…
shorim Nov 20, 2024
ce48871
rename unnecessary WebhookHealthy assertion
shorim Nov 20, 2024
5edaff2
Merge remote-tracking branch 'origin/main' into migrate_validating_we…
shorim Nov 20, 2024
1a135dc
Merge remote-tracking branch 'origin/main' into migrate_validating_we…
shorim Nov 20, 2024
c91fc5d
Merge branch 'main' into migrate_validating_webhook_to_kustomize
skhalash Nov 21, 2024
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
Prev Previous commit
Next Next commit
remove deletion of validating webhook from Telemetry reconciler
shorim committed Nov 19, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 18a1a9403968182891ed42283d17f2a77fdface1
17 changes: 0 additions & 17 deletions internal/reconciler/telemetry/reconciler.go
Original file line number Diff line number Diff line change
@@ -7,8 +7,6 @@ import (
"gopkg.in/yaml.v3"
admissionregistrationv1 "k8s.io/api/admissionregistration/v1"
corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
@@ -255,11 +253,6 @@ func (r *Reconciler) handleFinalizer(ctx context.Context, telemetry *operatorv1a
return nil
}

err := r.deleteWebhook(ctx)
if err != nil && !apierrors.IsNotFound(err) {
return fmt.Errorf("failed to delete webhook: %w", err)
}

controllerutil.RemoveFinalizer(telemetry, finalizer)

if err := r.Update(ctx, telemetry); err != nil {
@@ -270,16 +263,6 @@ func (r *Reconciler) handleFinalizer(ctx context.Context, telemetry *operatorv1a
return nil
}

func (r *Reconciler) deleteWebhook(ctx context.Context) error {
webhook := &admissionregistrationv1.ValidatingWebhookConfiguration{
ObjectMeta: metav1.ObjectMeta{
Name: r.config.Webhook.CertConfig.WebhookName.Name,
},
}

return r.Delete(ctx, webhook)
}

func (r *Reconciler) reconcileWebhook(ctx context.Context, telemetry *operatorv1alpha1.Telemetry) error {
// We skip webhook reconciliation only if no pipelines are remaining. This avoids the risk of certificate expiration while waiting for deletion.
if !telemetry.DeletionTimestamp.IsZero() && !r.dependentCRsFound(ctx) {