Skip to content

Commit

Permalink
Fix failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
CoreyCook8 committed Sep 15, 2023
1 parent 165e63f commit ee77c83
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions internal/pkg/webhooks/binding/binding.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ import (
"sync"

"github.com/go-logr/logr"
"github.com/google/go-cmp/cmp"
corev1 "k8s.io/api/core/v1"
kerrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down Expand Up @@ -119,7 +119,7 @@ func (p *podBinder) Handle(ctx context.Context, req admission.Request) admission
profilebindings := profileBindings.Items

pod, admissionResponse := p.updatePod(ctx, profilebindings, req)
if admissionResponse.Result.Status == metav1.StatusFailure {
if !cmp.Equal(admissionResponse, admission.Response{}) {
return admissionResponse
}

Expand All @@ -133,14 +133,15 @@ func (p *podBinder) Handle(ctx context.Context, req admission.Request) admission
}

func (p *podBinder) updatePod(ctx context.Context, profilebindings []profilebindingv1alpha1.ProfileBinding, req admission.Request) (*corev1.Pod, admission.Response) {
podChanged := false
var err error
var podBindProfile *interface{}
var containers sync.Map
var podProfileBinding *profilebindingv1alpha1.ProfileBinding
podID := req.Namespace + "/" + req.Name
pod := &corev1.Pod{}
var containers sync.Map
podChanged := false
if req.Operation != "DELETE" {
pod, err := p.impl.DecodePod(req)
pod, err = p.impl.DecodePod(req)
if err != nil {
p.log.Error(err, "failed to decode pod")
return pod, admission.Errored(http.StatusBadRequest, err)
Expand Down Expand Up @@ -215,7 +216,7 @@ func (p *podBinder) updatePod(ctx context.Context, profilebindings []profilebind
}
}
}
return pod, admission.Allowed("pod changed")
return pod, admission.Response{}
}

func (p *podBinder) getSeccompProfile(
Expand Down

0 comments on commit ee77c83

Please sign in to comment.