Skip to content

Commit

Permalink
update egresspolicy crd
Browse files Browse the repository at this point in the history
Signed-off-by: dcwbq <biqiang.wu@daocloud.io>
  • Loading branch information
dcwbq authored and biqiangwu committed May 30, 2023
1 parent 9590e06 commit 28ce42c
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 33 deletions.
6 changes: 3 additions & 3 deletions pkg/controller/endpoint_slice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func caseAddPolicy() TestCaseEPS {
Name: "policy1",
Namespace: "default",
},
Spec: egressv1.EgressGatewayPolicySpec{
Spec: egressv1.EgressPolicySpec{
EgressGatewayName: "",
EgressIP: egressv1.EgressIP{},
AppliedTo: egressv1.AppliedTo{
Expand Down Expand Up @@ -235,7 +235,7 @@ func caseUpdatePod() TestCaseEPS {
Name: "policy1",
Namespace: "default",
},
Spec: egressv1.EgressGatewayPolicySpec{
Spec: egressv1.EgressPolicySpec{
EgressGatewayName: "",
EgressIP: egressv1.EgressIP{},
AppliedTo: egressv1.AppliedTo{
Expand Down Expand Up @@ -350,7 +350,7 @@ func caseDeletePod() TestCaseEPS {
Name: "policy1",
Namespace: "default",
},
Spec: egressv1.EgressGatewayPolicySpec{
Spec: egressv1.EgressPolicySpec{
EgressGatewayName: "",
EgressIP: egressv1.EgressIP{},
AppliedTo: egressv1.AppliedTo{
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/webhook/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func TestValidateEgressGatewayPolicy(t *testing.T) {
ObjectMeta: metav1.ObjectMeta{
Name: "policy",
},
Spec: egressv1.EgressGatewayPolicySpec{
Spec: egressv1.EgressPolicySpec{
EgressGatewayName: "test",
EgressIP: egressv1.EgressIP{
UseNodeIP: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ type EgressPolicy struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata"`

Spec EgressGatewayPolicySpec `json:"spec,omitempty"`
Spec EgressPolicySpec `json:"spec,omitempty"`
}

type EgressGatewayPolicySpec struct {
type EgressPolicySpec struct {
// +kubebuilder:validation:Optional
EgressGatewayName string `json:"egressGatewayName,omitempty"`
// +kubebuilder:validation:Optional
Expand All @@ -39,9 +39,12 @@ type EgressGatewayPolicySpec struct {
}

type EgressIP struct {
IPv4 string `json:"ipv4,omitempty"`
IPv6 string `json:"ipv6,omitempty"`
UseNodeIP bool `json:"useNodeIP,omitempty"`
// +kubebuilder:validation:Optional
IPv4 string `json:"ipv4,omitempty"`
// +kubebuilder:validation:Optional
IPv6 string `json:"ipv6,omitempty"`
// +kubebuilder:validation:Optional
UseNodeIP bool `json:"useNodeIP,omitempty"`
}

type AppliedTo struct {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions test/e2e/common/egresspolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,21 @@ package common

import (
"context"
"time"

"github.com/spidernet-io/e2eframework/framework"
egressv1 "github.com/spidernet-io/egressgateway/pkg/k8s/apis/egressgateway.spidernet.io/v1beta1"
"github.com/spidernet-io/egressgateway/test/e2e/err"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
"time"
)

func GenerateEgressPolicyYaml(name string, labels map[string]string, dest []string) *egressv1.EgressPolicy {
return &egressv1.EgressPolicy{
ObjectMeta: metav1.ObjectMeta{
Name: name,
},
Spec: egressv1.EgressGatewayPolicySpec{
Spec: egressv1.EgressPolicySpec{
AppliedTo: egressv1.AppliedTo{
PodSelector: &metav1.LabelSelector{
MatchLabels: labels,
Expand Down

0 comments on commit 28ce42c

Please sign in to comment.