Skip to content

Commit

Permalink
Update Dependencies
Browse files Browse the repository at this point in the history
Signed-off-by: Frank Jogeleit <[email protected]>
  • Loading branch information
Frank Jogeleit committed Oct 19, 2023
1 parent 5d51460 commit 80928e4
Show file tree
Hide file tree
Showing 7 changed files with 346 additions and 342 deletions.
211 changes: 107 additions & 104 deletions backend/go.mod

Large diffs are not rendered by default.

447 changes: 224 additions & 223 deletions backend/go.sum

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions backend/pkg/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"strings"
"time"

"github.com/kyverno/kyverno/api/kyverno/v2alpha1"
"github.com/kyverno/kyverno/api/kyverno/v2beta1"
"github.com/kyverno/kyverno/pkg/auth/checker"
"github.com/kyverno/kyverno/pkg/client/clientset/versioned"
"github.com/kyverno/kyverno/pkg/clients/dclient"
Expand Down Expand Up @@ -36,7 +36,7 @@ type Cluster interface {
Search(context.Context, string, string, string, map[string]string) ([]SearchResult, error)
Get(context.Context, string, string, string, string) (*unstructured.Unstructured, error)
DClient(...unstructured.Unstructured) (dclient.Interface, error)
PolicyExceptionSelector(namespace string, exceptions ...*v2alpha1.PolicyException) engineapi.PolicyExceptionSelector
PolicyExceptionSelector(namespace string, exceptions ...*v2beta1.PolicyException) engineapi.PolicyExceptionSelector
IsFake() bool
}

Expand Down Expand Up @@ -139,7 +139,7 @@ func (c cluster) Get(ctx context.Context, apiVersion string, kind string, namesp
return c.dClient.GetResource(ctx, apiVersion, kind, namespace, name)
}

func (c cluster) PolicyExceptionSelector(namespace string, exceptions ...*v2alpha1.PolicyException) engineapi.PolicyExceptionSelector {
func (c cluster) PolicyExceptionSelector(namespace string, exceptions ...*v2beta1.PolicyException) engineapi.PolicyExceptionSelector {
return NewPolicyExceptionSelector(namespace, c.kyvernoClient, exceptions...)
}

Expand Down
4 changes: 2 additions & 2 deletions backend/pkg/cluster/fake.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"errors"

"github.com/kyverno/kyverno/api/kyverno/v2alpha1"
"github.com/kyverno/kyverno/api/kyverno/v2beta1"
"github.com/kyverno/kyverno/pkg/clients/dclient"
engineapi "github.com/kyverno/kyverno/pkg/engine/api"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
Expand Down Expand Up @@ -32,7 +32,7 @@ func (c fakeCluster) Get(ctx context.Context, apiVersion string, kind string, na
return nil, errors.New("getting resource not supported in fake cluster")
}

func (c fakeCluster) PolicyExceptionSelector(namespace string, exceptions ...*v2alpha1.PolicyException) engineapi.PolicyExceptionSelector {
func (c fakeCluster) PolicyExceptionSelector(namespace string, exceptions ...*v2beta1.PolicyException) engineapi.PolicyExceptionSelector {
return NewPolicyExceptionSelector(namespace, nil, exceptions...)
}

Expand Down
12 changes: 6 additions & 6 deletions backend/pkg/cluster/policy_exception.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cluster
import (
"context"

kyvernov2alpha1 "github.com/kyverno/kyverno/api/kyverno/v2alpha1"
"github.com/kyverno/kyverno/api/kyverno/v2beta1"
"github.com/kyverno/kyverno/pkg/client/clientset/versioned"
engineapi "github.com/kyverno/kyverno/pkg/engine/api"
kerrors "k8s.io/apimachinery/pkg/api/errors"
Expand All @@ -12,20 +12,20 @@ import (
)

type policyExceptionSelector struct {
additional []*kyvernov2alpha1.PolicyException
additional []*v2beta1.PolicyException
kyvernoClient versioned.Interface
namespace string
}

func (c policyExceptionSelector) List(selector labels.Selector) ([]*kyvernov2alpha1.PolicyException, error) {
var exceptions []*kyvernov2alpha1.PolicyException
func (c policyExceptionSelector) List(selector labels.Selector) ([]*v2beta1.PolicyException, error) {
var exceptions []*v2beta1.PolicyException
if c.kyvernoClient != nil {
list, err := c.kyvernoClient.KyvernoV2alpha1().PolicyExceptions(c.namespace).List(context.TODO(), metav1.ListOptions{
LabelSelector: selector.String(),
})
if err == nil {
for i := range list.Items {
pe := kyvernov2alpha1.PolicyException(list.Items[i])
pe := v2beta1.PolicyException(list.Items[i])
exceptions = append(exceptions, &pe)
}
} else if !kerrors.IsNotFound(err) {
Expand All @@ -40,7 +40,7 @@ func (c policyExceptionSelector) List(selector labels.Selector) ([]*kyvernov2alp
return exceptions, nil
}

func NewPolicyExceptionSelector(namespace string, client versioned.Interface, exceptions ...*kyvernov2alpha1.PolicyException) engineapi.PolicyExceptionSelector {
func NewPolicyExceptionSelector(namespace string, client versioned.Interface, exceptions ...*v2beta1.PolicyException) engineapi.PolicyExceptionSelector {
return policyExceptionSelector{
additional: exceptions,
kyvernoClient: client,
Expand Down
4 changes: 2 additions & 2 deletions backend/pkg/engine/models/ruleresponse.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package models

import (
kyvernov2alpha1 "github.com/kyverno/kyverno/api/kyverno/v2alpha1"
"github.com/kyverno/kyverno/api/kyverno/v2beta1"
engineapi "github.com/kyverno/kyverno/pkg/engine/api"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
Expand All @@ -27,5 +27,5 @@ type RuleResponse struct {
// podSecurityChecks contains pod security checks (only if this is a pod security rule)
PodSecurityChecks *engineapi.PodSecurityChecks `json:"podSecurityChecks"`
// exception is the exception applied (if any)
Exception *kyvernov2alpha1.PolicyException `json:"exception"`
Exception *v2beta1.PolicyException `json:"exception"`
}
4 changes: 2 additions & 2 deletions backend/pkg/server/api/engine/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"testing/fstest"

kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1"
kyvernov2alpha1 "github.com/kyverno/kyverno/api/kyverno/v2alpha1"
"github.com/kyverno/kyverno/api/kyverno/v2beta1"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/exception"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/resource/loader"
"k8s.io/api/admissionregistration/v1alpha1"
Expand Down Expand Up @@ -57,7 +57,7 @@ func (r *EngineRequest) LoadOldResources(resourceLoader loader.Loader) ([]unstru
return resource.LoadResources(resourceLoader, []byte(r.OldResources))
}

func (r *EngineRequest) LoadPolicyExceptions(resourceLoader loader.Loader) ([]*kyvernov2alpha1.PolicyException, error) {
func (r *EngineRequest) LoadPolicyExceptions(resourceLoader loader.Loader) ([]*v2beta1.PolicyException, error) {
return exception.Load([]byte(r.PolicyExceptions))
}

Expand Down

0 comments on commit 80928e4

Please sign in to comment.