Skip to content

Commit

Permalink
remove unnecessary helper method in pod webhook
Browse files Browse the repository at this point in the history
  • Loading branch information
danielvegamyhre committed Nov 20, 2023
1 parent 2f474b0 commit ddac87b
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions pkg/webhooks/pod_admission_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,6 @@ import (

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (p *podWebhook) ValidateCreate(ctx context.Context, obj runtime.Object) (admission.Warnings, error) {
return p.validate(ctx, obj)
}

func (p *podWebhook) ValidateUpdate(ctx context.Context, oldObj, newObj runtime.Object) (admission.Warnings, error) {
return nil, nil
}

func (p *podWebhook) ValidateDelete(ctx context.Context, obj runtime.Object) (admission.Warnings, error) {
return nil, nil
}

func (p *podWebhook) validate(ctx context.Context, obj runtime.Object) (admission.Warnings, error) {
pod, ok := obj.(*corev1.Pod)
if !ok {
return nil, fmt.Errorf("expected a Pod but got a %T", obj)
Expand Down Expand Up @@ -71,6 +59,14 @@ func (p *podWebhook) validate(ctx context.Context, obj runtime.Object) (admissio
return nil, nil
}

func (p *podWebhook) ValidateUpdate(ctx context.Context, oldObj, newObj runtime.Object) (admission.Warnings, error) {
return nil, nil
}

func (p *podWebhook) ValidateDelete(ctx context.Context, obj runtime.Object) (admission.Warnings, error) {
return nil, nil
}

func (p *podWebhook) leaderPodScheduled(ctx context.Context, pod *corev1.Pod) (bool, error) {
leaderPod, err := p.leaderPodForFollower(ctx, pod)
if err != nil {
Expand Down

0 comments on commit ddac87b

Please sign in to comment.