diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index da5f8b4e5..05df87c71 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,7 +30,7 @@ jobs: run: make build - name: "run go test and out codecov" - run: make prebuild; go test ./cmd/... ./ingress/... -race -coverprofile=coverage.out -covermode=atomic + run: make prebuild; go test ./cmd/... ./pkg/... -race -coverprofile=coverage.out -covermode=atomic - name: "upload coverage" uses: codecov/codecov-action@v3 diff --git a/cmd/higress/main.go b/cmd/higress/main.go index bf8338db7..6ac027482 100644 --- a/cmd/higress/main.go +++ b/cmd/higress/main.go @@ -15,6 +15,7 @@ package main import ( + "fmt" "os" "time" @@ -26,13 +27,10 @@ import ( "istio.io/pkg/log" "istio.io/pkg/version" - "github.com/alibaba/higress/cmd/higress/bootstrap" + "github.com/alibaba/higress/pkg/bootstrap" ) var ( - probeAddr string - enableLeaderElection bool - serverArgs *bootstrap.ServerArgs loggingOptions = log.DefaultOptions() @@ -43,13 +41,10 @@ var ( serveCmd = &cobra.Command{ Use: "serve", Aliases: []string{"serve"}, - Short: "Starts the ingress controller", + Short: "Starts the higress ingress controller", Example: "higress serve", PreRunE: func(c *cobra.Command, args []string) error { - if err := log.Configure(loggingOptions); err != nil { - return err - } - return nil + return log.Configure(loggingOptions) }, RunE: func(c *cobra.Command, args []string) error { cmd.PrintFlags(c.Flags()) @@ -59,10 +54,12 @@ var ( server, err := bootstrap.NewServer(serverArgs) if err != nil { - return err + return fmt.Errorf("fail to create higress server: %v", err) } - server.Start(stop) + if err := server.Start(stop); err != nil { + return fmt.Errorf("fail to start higress server: %v", err) + } cmd.WaitSignal(stop) diff --git a/cmd/higress/bootstrap/server.go b/pkg/bootstrap/server.go similarity index 98% rename from cmd/higress/bootstrap/server.go rename to pkg/bootstrap/server.go index 4cfe2ba8c..fc68f7750 100644 --- a/cmd/higress/bootstrap/server.go +++ b/pkg/bootstrap/server.go @@ -20,7 +20,6 @@ import ( "net/http" "time" - "github.com/alibaba/higress/ingress/kube/common" prometheus "github.com/grpc-ecosystem/go-grpc-prometheus" "google.golang.org/grpc" "google.golang.org/grpc/reflection" @@ -46,8 +45,9 @@ import ( "k8s.io/client-go/rest" "k8s.io/client-go/tools/cache" - ingressconfig "github.com/alibaba/higress/ingress/config" - "github.com/alibaba/higress/ingress/mcp" + ingressconfig "github.com/alibaba/higress/pkg/ingress/config" + "github.com/alibaba/higress/pkg/ingress/kube/common" + "github.com/alibaba/higress/pkg/ingress/mcp" ) type XdsOptions struct { diff --git a/ingress/config/ingress_config.go b/pkg/ingress/config/ingress_config.go similarity index 98% rename from ingress/config/ingress_config.go rename to pkg/ingress/config/ingress_config.go index e56a71e63..d44908299 100644 --- a/ingress/config/ingress_config.go +++ b/pkg/ingress/config/ingress_config.go @@ -37,13 +37,13 @@ import ( listersv1 "k8s.io/client-go/listers/core/v1" "k8s.io/client-go/tools/cache" - "github.com/alibaba/higress/ingress/kube/annotations" - "github.com/alibaba/higress/ingress/kube/common" - "github.com/alibaba/higress/ingress/kube/ingress" - "github.com/alibaba/higress/ingress/kube/ingressv1" - secretkube "github.com/alibaba/higress/ingress/kube/secret/kube" - "github.com/alibaba/higress/ingress/kube/util" - . "github.com/alibaba/higress/ingress/log" + "github.com/alibaba/higress/pkg/ingress/kube/annotations" + "github.com/alibaba/higress/pkg/ingress/kube/common" + "github.com/alibaba/higress/pkg/ingress/kube/ingress" + "github.com/alibaba/higress/pkg/ingress/kube/ingressv1" + secretkube "github.com/alibaba/higress/pkg/ingress/kube/secret/kube" + "github.com/alibaba/higress/pkg/ingress/kube/util" + . "github.com/alibaba/higress/pkg/ingress/log" ) var ( diff --git a/ingress/config/ingress_config_test.go b/pkg/ingress/config/ingress_config_test.go similarity index 98% rename from ingress/config/ingress_config_test.go rename to pkg/ingress/config/ingress_config_test.go index f0ffb1a85..6829dc48e 100644 --- a/ingress/config/ingress_config_test.go +++ b/pkg/ingress/config/ingress_config_test.go @@ -28,10 +28,10 @@ import ( ingress "k8s.io/api/networking/v1" ingressv1beta1 "k8s.io/api/networking/v1beta1" - "github.com/alibaba/higress/ingress/kube/annotations" - "github.com/alibaba/higress/ingress/kube/common" - controllerv1beta1 "github.com/alibaba/higress/ingress/kube/ingress" - controllerv1 "github.com/alibaba/higress/ingress/kube/ingressv1" + "github.com/alibaba/higress/pkg/ingress/kube/annotations" + "github.com/alibaba/higress/pkg/ingress/kube/common" + controllerv1beta1 "github.com/alibaba/higress/pkg/ingress/kube/ingress" + controllerv1 "github.com/alibaba/higress/pkg/ingress/kube/ingressv1" ) func TestNormalizeWeightedCluster(t *testing.T) { diff --git a/ingress/kube/annotations/annotations.go b/pkg/ingress/kube/annotations/annotations.go similarity index 100% rename from ingress/kube/annotations/annotations.go rename to pkg/ingress/kube/annotations/annotations.go diff --git a/ingress/kube/annotations/annotations_test.go b/pkg/ingress/kube/annotations/annotations_test.go similarity index 100% rename from ingress/kube/annotations/annotations_test.go rename to pkg/ingress/kube/annotations/annotations_test.go diff --git a/ingress/kube/annotations/auth.go b/pkg/ingress/kube/annotations/auth.go similarity index 97% rename from ingress/kube/annotations/auth.go rename to pkg/ingress/kube/annotations/auth.go index 20b7909f7..ccaea574a 100644 --- a/ingress/kube/annotations/auth.go +++ b/pkg/ingress/kube/annotations/auth.go @@ -21,8 +21,8 @@ import ( corev1 "k8s.io/api/core/v1" - "github.com/alibaba/higress/ingress/kube/util" - . "github.com/alibaba/higress/ingress/log" + "github.com/alibaba/higress/pkg/ingress/kube/util" + . "github.com/alibaba/higress/pkg/ingress/log" ) const ( diff --git a/ingress/kube/annotations/auth_test.go b/pkg/ingress/kube/annotations/auth_test.go similarity index 98% rename from ingress/kube/annotations/auth_test.go rename to pkg/ingress/kube/annotations/auth_test.go index c60986e8f..d50dd6a5b 100644 --- a/ingress/kube/annotations/auth_test.go +++ b/pkg/ingress/kube/annotations/auth_test.go @@ -29,7 +29,7 @@ import ( listerv1 "k8s.io/client-go/listers/core/v1" "k8s.io/client-go/tools/cache" - "github.com/alibaba/higress/ingress/kube/util" + "github.com/alibaba/higress/pkg/ingress/kube/util" ) func TestAuthParse(t *testing.T) { diff --git a/ingress/kube/annotations/canary.go b/pkg/ingress/kube/annotations/canary.go similarity index 100% rename from ingress/kube/annotations/canary.go rename to pkg/ingress/kube/annotations/canary.go diff --git a/ingress/kube/annotations/canary_test.go b/pkg/ingress/kube/annotations/canary_test.go similarity index 100% rename from ingress/kube/annotations/canary_test.go rename to pkg/ingress/kube/annotations/canary_test.go diff --git a/ingress/kube/annotations/cors.go b/pkg/ingress/kube/annotations/cors.go similarity index 100% rename from ingress/kube/annotations/cors.go rename to pkg/ingress/kube/annotations/cors.go diff --git a/ingress/kube/annotations/cors_test.go b/pkg/ingress/kube/annotations/cors_test.go similarity index 100% rename from ingress/kube/annotations/cors_test.go rename to pkg/ingress/kube/annotations/cors_test.go diff --git a/ingress/kube/annotations/default_backend.go b/pkg/ingress/kube/annotations/default_backend.go similarity index 97% rename from ingress/kube/annotations/default_backend.go rename to pkg/ingress/kube/annotations/default_backend.go index da08e4daf..8e9c096da 100644 --- a/ingress/kube/annotations/default_backend.go +++ b/pkg/ingress/kube/annotations/default_backend.go @@ -20,8 +20,8 @@ import ( networking "istio.io/api/networking/v1alpha3" "istio.io/istio/pilot/pkg/model" - "github.com/alibaba/higress/ingress/kube/util" - . "github.com/alibaba/higress/ingress/log" + "github.com/alibaba/higress/pkg/ingress/kube/util" + . "github.com/alibaba/higress/pkg/ingress/log" ) const ( diff --git a/ingress/kube/annotations/default_backend_test.go b/pkg/ingress/kube/annotations/default_backend_test.go similarity index 100% rename from ingress/kube/annotations/default_backend_test.go rename to pkg/ingress/kube/annotations/default_backend_test.go diff --git a/ingress/kube/annotations/downstreamtls.go b/pkg/ingress/kube/annotations/downstreamtls.go similarity index 98% rename from ingress/kube/annotations/downstreamtls.go rename to pkg/ingress/kube/annotations/downstreamtls.go index 4ba46e8c4..39dd70e5c 100644 --- a/ingress/kube/annotations/downstreamtls.go +++ b/pkg/ingress/kube/annotations/downstreamtls.go @@ -18,12 +18,13 @@ import ( "strings" networking "istio.io/api/networking/v1alpha3" - "github.com/alibaba/higress/ingress/kube/util" - . "github.com/alibaba/higress/ingress/log" "istio.io/istio/pilot/pkg/credentials/kube" "istio.io/istio/pilot/pkg/model" gatewaytool "istio.io/istio/pkg/config/gateway" "istio.io/istio/pkg/config/security" + + "github.com/alibaba/higress/pkg/ingress/kube/util" + . "github.com/alibaba/higress/pkg/ingress/log" ) const ( diff --git a/ingress/kube/annotations/downstreamtls_test.go b/pkg/ingress/kube/annotations/downstreamtls_test.go similarity index 100% rename from ingress/kube/annotations/downstreamtls_test.go rename to pkg/ingress/kube/annotations/downstreamtls_test.go diff --git a/ingress/kube/annotations/header_control.go b/pkg/ingress/kube/annotations/header_control.go similarity index 99% rename from ingress/kube/annotations/header_control.go rename to pkg/ingress/kube/annotations/header_control.go index 635df65b2..c93dbb776 100644 --- a/ingress/kube/annotations/header_control.go +++ b/pkg/ingress/kube/annotations/header_control.go @@ -19,7 +19,7 @@ import ( networking "istio.io/api/networking/v1alpha3" - . "github.com/alibaba/higress/ingress/log" + . "github.com/alibaba/higress/pkg/ingress/log" ) const ( diff --git a/ingress/kube/annotations/header_control_test.go b/pkg/ingress/kube/annotations/header_control_test.go similarity index 100% rename from ingress/kube/annotations/header_control_test.go rename to pkg/ingress/kube/annotations/header_control_test.go diff --git a/ingress/kube/annotations/interface.go b/pkg/ingress/kube/annotations/interface.go similarity index 100% rename from ingress/kube/annotations/interface.go rename to pkg/ingress/kube/annotations/interface.go diff --git a/ingress/kube/annotations/ip_access_control.go b/pkg/ingress/kube/annotations/ip_access_control.go similarity index 100% rename from ingress/kube/annotations/ip_access_control.go rename to pkg/ingress/kube/annotations/ip_access_control.go diff --git a/ingress/kube/annotations/ip_access_control_test.go b/pkg/ingress/kube/annotations/ip_access_control_test.go similarity index 100% rename from ingress/kube/annotations/ip_access_control_test.go rename to pkg/ingress/kube/annotations/ip_access_control_test.go diff --git a/ingress/kube/annotations/loadbalance.go b/pkg/ingress/kube/annotations/loadbalance.go similarity index 100% rename from ingress/kube/annotations/loadbalance.go rename to pkg/ingress/kube/annotations/loadbalance.go diff --git a/ingress/kube/annotations/loadbalance_test.go b/pkg/ingress/kube/annotations/loadbalance_test.go similarity index 100% rename from ingress/kube/annotations/loadbalance_test.go rename to pkg/ingress/kube/annotations/loadbalance_test.go diff --git a/ingress/kube/annotations/local_rate_limit.go b/pkg/ingress/kube/annotations/local_rate_limit.go similarity index 100% rename from ingress/kube/annotations/local_rate_limit.go rename to pkg/ingress/kube/annotations/local_rate_limit.go diff --git a/ingress/kube/annotations/local_rate_limit_test.go b/pkg/ingress/kube/annotations/local_rate_limit_test.go similarity index 100% rename from ingress/kube/annotations/local_rate_limit_test.go rename to pkg/ingress/kube/annotations/local_rate_limit_test.go diff --git a/ingress/kube/annotations/parser.go b/pkg/ingress/kube/annotations/parser.go similarity index 100% rename from ingress/kube/annotations/parser.go rename to pkg/ingress/kube/annotations/parser.go diff --git a/ingress/kube/annotations/redirect.go b/pkg/ingress/kube/annotations/redirect.go similarity index 100% rename from ingress/kube/annotations/redirect.go rename to pkg/ingress/kube/annotations/redirect.go diff --git a/ingress/kube/annotations/retry.go b/pkg/ingress/kube/annotations/retry.go similarity index 100% rename from ingress/kube/annotations/retry.go rename to pkg/ingress/kube/annotations/retry.go diff --git a/ingress/kube/annotations/retry_test.go b/pkg/ingress/kube/annotations/retry_test.go similarity index 100% rename from ingress/kube/annotations/retry_test.go rename to pkg/ingress/kube/annotations/retry_test.go diff --git a/ingress/kube/annotations/rewrite.go b/pkg/ingress/kube/annotations/rewrite.go similarity index 100% rename from ingress/kube/annotations/rewrite.go rename to pkg/ingress/kube/annotations/rewrite.go diff --git a/ingress/kube/annotations/rewrite_test.go b/pkg/ingress/kube/annotations/rewrite_test.go similarity index 100% rename from ingress/kube/annotations/rewrite_test.go rename to pkg/ingress/kube/annotations/rewrite_test.go diff --git a/ingress/kube/annotations/timeout.go b/pkg/ingress/kube/annotations/timeout.go similarity index 100% rename from ingress/kube/annotations/timeout.go rename to pkg/ingress/kube/annotations/timeout.go diff --git a/ingress/kube/annotations/timeout_test.go b/pkg/ingress/kube/annotations/timeout_test.go similarity index 100% rename from ingress/kube/annotations/timeout_test.go rename to pkg/ingress/kube/annotations/timeout_test.go diff --git a/ingress/kube/annotations/upstreamtls.go b/pkg/ingress/kube/annotations/upstreamtls.go similarity index 98% rename from ingress/kube/annotations/upstreamtls.go rename to pkg/ingress/kube/annotations/upstreamtls.go index 98941c508..6f8e7c24a 100644 --- a/ingress/kube/annotations/upstreamtls.go +++ b/pkg/ingress/kube/annotations/upstreamtls.go @@ -22,7 +22,7 @@ import ( networking "istio.io/api/networking/v1alpha3" "istio.io/istio/pilot/pkg/model/credentials" - "github.com/alibaba/higress/ingress/kube/util" + "github.com/alibaba/higress/pkg/ingress/kube/util" ) const ( diff --git a/ingress/kube/annotations/util.go b/pkg/ingress/kube/annotations/util.go similarity index 100% rename from ingress/kube/annotations/util.go rename to pkg/ingress/kube/annotations/util.go diff --git a/ingress/kube/annotations/util_test.go b/pkg/ingress/kube/annotations/util_test.go similarity index 100% rename from ingress/kube/annotations/util_test.go rename to pkg/ingress/kube/annotations/util_test.go diff --git a/ingress/kube/common/controller.go b/pkg/ingress/kube/common/controller.go similarity index 98% rename from ingress/kube/common/controller.go rename to pkg/ingress/kube/common/controller.go index 74d43eccf..779635d0a 100644 --- a/ingress/kube/common/controller.go +++ b/pkg/ingress/kube/common/controller.go @@ -24,7 +24,7 @@ import ( listerv1 "k8s.io/client-go/listers/core/v1" "k8s.io/client-go/tools/cache" - "github.com/alibaba/higress/ingress/kube/annotations" + "github.com/alibaba/higress/pkg/ingress/kube/annotations" ) type ServiceKey struct { diff --git a/ingress/kube/common/metrics.go b/pkg/ingress/kube/common/metrics.go similarity index 100% rename from ingress/kube/common/metrics.go rename to pkg/ingress/kube/common/metrics.go diff --git a/ingress/kube/common/model.go b/pkg/ingress/kube/common/model.go similarity index 99% rename from ingress/kube/common/model.go rename to pkg/ingress/kube/common/model.go index 0c8c65b6c..dd5e60188 100644 --- a/ingress/kube/common/model.go +++ b/pkg/ingress/kube/common/model.go @@ -28,7 +28,7 @@ import ( "istio.io/istio/pkg/config/schema/collections" "k8s.io/apimachinery/pkg/labels" - . "github.com/alibaba/higress/ingress/log" + . "github.com/alibaba/higress/pkg/ingress/log" ) type PathType string diff --git a/ingress/kube/common/tool.go b/pkg/ingress/kube/common/tool.go similarity index 99% rename from ingress/kube/common/tool.go rename to pkg/ingress/kube/common/tool.go index 49731cf4a..f01a9bd17 100644 --- a/ingress/kube/common/tool.go +++ b/pkg/ingress/kube/common/tool.go @@ -28,7 +28,7 @@ import ( v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/util/version" - . "github.com/alibaba/higress/ingress/log" + . "github.com/alibaba/higress/pkg/ingress/log" ) // V1Available check if the "networking/v1" Ingress is available. diff --git a/ingress/kube/common/tool_test.go b/pkg/ingress/kube/common/tool_test.go similarity index 99% rename from ingress/kube/common/tool_test.go rename to pkg/ingress/kube/common/tool_test.go index 2311d060e..39f99eeac 100644 --- a/ingress/kube/common/tool_test.go +++ b/pkg/ingress/kube/common/tool_test.go @@ -22,7 +22,7 @@ import ( v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/alibaba/higress/ingress/kube/annotations" + "github.com/alibaba/higress/pkg/ingress/kube/annotations" ) func TestConstructRouteName(t *testing.T) { diff --git a/ingress/kube/ingress/controller.go b/pkg/ingress/kube/ingress/controller.go similarity index 99% rename from ingress/kube/ingress/controller.go rename to pkg/ingress/kube/ingress/controller.go index 1fc1c71cf..5117d15eb 100644 --- a/ingress/kube/ingress/controller.go +++ b/pkg/ingress/kube/ingress/controller.go @@ -48,11 +48,11 @@ import ( "k8s.io/client-go/tools/cache" "k8s.io/client-go/util/workqueue" - "github.com/alibaba/higress/ingress/kube/annotations" - "github.com/alibaba/higress/ingress/kube/common" - "github.com/alibaba/higress/ingress/kube/secret" - "github.com/alibaba/higress/ingress/kube/util" - . "github.com/alibaba/higress/ingress/log" + "github.com/alibaba/higress/pkg/ingress/kube/annotations" + "github.com/alibaba/higress/pkg/ingress/kube/common" + "github.com/alibaba/higress/pkg/ingress/kube/secret" + "github.com/alibaba/higress/pkg/ingress/kube/util" + . "github.com/alibaba/higress/pkg/ingress/log" ) var ( diff --git a/ingress/kube/ingress/controller_test.go b/pkg/ingress/kube/ingress/controller_test.go similarity index 97% rename from ingress/kube/ingress/controller_test.go rename to pkg/ingress/kube/ingress/controller_test.go index ffca0c1a4..9fcc12b24 100644 --- a/ingress/kube/ingress/controller_test.go +++ b/pkg/ingress/kube/ingress/controller_test.go @@ -20,7 +20,7 @@ import ( "k8s.io/api/networking/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/alibaba/higress/ingress/kube/common" + "github.com/alibaba/higress/pkg/ingress/kube/common" ) func TestShouldProcessIngressUpdate(t *testing.T) { diff --git a/ingress/kube/ingress/status.go b/pkg/ingress/kube/ingress/status.go similarity index 92% rename from ingress/kube/ingress/status.go rename to pkg/ingress/kube/ingress/status.go index a5c4f808d..50a93007a 100644 --- a/ingress/kube/ingress/status.go +++ b/pkg/ingress/kube/ingress/status.go @@ -16,6 +16,8 @@ package ingress import ( "context" + common2 "github.com/alibaba/higress/pkg/ingress/kube/common" + . "github.com/alibaba/higress/pkg/ingress/log" "reflect" "sort" "time" @@ -28,9 +30,6 @@ import ( listerv1 "k8s.io/client-go/listers/core/v1" ingresslister "k8s.io/client-go/listers/networking/v1beta1" "k8s.io/client-go/tools/cache" - - "github.com/alibaba/higress/ingress/kube/common" - . "github.com/alibaba/higress/ingress/log" ) // statusSyncer keeps the status IP in each Ingress resource updated @@ -62,7 +61,7 @@ func newStatusSyncer(localKubeClient, client kubelib.Client, controller *control func (s *statusSyncer) run(stopCh <-chan struct{}) { cache.WaitForCacheSync(stopCh, s.controller.HasSynced) - ticker := time.NewTicker(common.DefaultStatusUpdateInterval) + ticker := time.NewTicker(common2.DefaultStatusUpdateInterval) for { select { case <-stopCh: @@ -77,14 +76,14 @@ func (s *statusSyncer) run(stopCh <-chan struct{}) { } func (s *statusSyncer) runUpdateStatus() error { - svcList, err := s.serviceLister.Services(s.watchedNamespace).List(common.SvcLabelSelector) + svcList, err := s.serviceLister.Services(s.watchedNamespace).List(common2.SvcLabelSelector) if err != nil { return err } IngressLog.Debugf("found number %d of svc", len(svcList)) - lbStatusList := common.GetLbStatusList(svcList) + lbStatusList := common2.GetLbStatusList(svcList) if len(lbStatusList) == 0 { return nil } @@ -111,7 +110,7 @@ func (s *statusSyncer) updateStatus(status []coreV1.LoadBalancerIngress) error { } curIPs := ingress.Status.LoadBalancer.Ingress - sort.SliceStable(curIPs, common.SortLbIngressList(curIPs)) + sort.SliceStable(curIPs, common2.SortLbIngressList(curIPs)) if reflect.DeepEqual(status, curIPs) { IngressLog.Debugf("skipping update of Ingress %v/%v within cluster %s (no change)", diff --git a/ingress/kube/ingressv1/controller.go b/pkg/ingress/kube/ingressv1/controller.go similarity index 99% rename from ingress/kube/ingressv1/controller.go rename to pkg/ingress/kube/ingressv1/controller.go index 0c2c48d3a..28e58305d 100644 --- a/ingress/kube/ingressv1/controller.go +++ b/pkg/ingress/kube/ingressv1/controller.go @@ -47,11 +47,11 @@ import ( "k8s.io/client-go/tools/cache" "k8s.io/client-go/util/workqueue" - "github.com/alibaba/higress/ingress/kube/annotations" - "github.com/alibaba/higress/ingress/kube/common" - "github.com/alibaba/higress/ingress/kube/secret" - "github.com/alibaba/higress/ingress/kube/util" - . "github.com/alibaba/higress/ingress/log" + "github.com/alibaba/higress/pkg/ingress/kube/annotations" + "github.com/alibaba/higress/pkg/ingress/kube/common" + "github.com/alibaba/higress/pkg/ingress/kube/secret" + "github.com/alibaba/higress/pkg/ingress/kube/util" + . "github.com/alibaba/higress/pkg/ingress/log" ) var ( diff --git a/ingress/kube/ingressv1/controller_test.go b/pkg/ingress/kube/ingressv1/controller_test.go similarity index 97% rename from ingress/kube/ingressv1/controller_test.go rename to pkg/ingress/kube/ingressv1/controller_test.go index 12395382e..3fd3107ea 100644 --- a/ingress/kube/ingressv1/controller_test.go +++ b/pkg/ingress/kube/ingressv1/controller_test.go @@ -20,7 +20,7 @@ import ( v1 "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/alibaba/higress/ingress/kube/common" + "github.com/alibaba/higress/pkg/ingress/kube/common" ) func TestShouldProcessIngressUpdate(t *testing.T) { diff --git a/ingress/kube/ingressv1/status.go b/pkg/ingress/kube/ingressv1/status.go similarity index 97% rename from ingress/kube/ingressv1/status.go rename to pkg/ingress/kube/ingressv1/status.go index 7eb2c7f97..8417868d2 100644 --- a/ingress/kube/ingressv1/status.go +++ b/pkg/ingress/kube/ingressv1/status.go @@ -29,8 +29,8 @@ import ( ingresslister "k8s.io/client-go/listers/networking/v1" "k8s.io/client-go/tools/cache" - "github.com/alibaba/higress/ingress/kube/common" - . "github.com/alibaba/higress/ingress/log" + "github.com/alibaba/higress/pkg/ingress/kube/common" + . "github.com/alibaba/higress/pkg/ingress/log" ) // statusSyncer keeps the status IP in each Ingress resource updated diff --git a/ingress/kube/secret/kube/controller.go b/pkg/ingress/kube/secret/kube/controller.go similarity index 95% rename from ingress/kube/secret/kube/controller.go rename to pkg/ingress/kube/secret/kube/controller.go index 0168fabf8..37077afe2 100644 --- a/ingress/kube/secret/kube/controller.go +++ b/pkg/ingress/kube/secret/kube/controller.go @@ -33,10 +33,10 @@ import ( "k8s.io/client-go/tools/cache" "k8s.io/client-go/util/workqueue" - "github.com/alibaba/higress/ingress/kube/common" - "github.com/alibaba/higress/ingress/kube/secret" - "github.com/alibaba/higress/ingress/kube/util" - . "github.com/alibaba/higress/ingress/log" + "github.com/alibaba/higress/pkg/ingress/kube/common" + "github.com/alibaba/higress/pkg/ingress/kube/secret" + "github.com/alibaba/higress/pkg/ingress/kube/util" + . "github.com/alibaba/higress/pkg/ingress/log" ) var _ secret.Controller = &controller{} diff --git a/ingress/kube/secret/model.go b/pkg/ingress/kube/secret/model.go similarity index 94% rename from ingress/kube/secret/model.go rename to pkg/ingress/kube/secret/model.go index 2b3a42648..e8bc66b6f 100644 --- a/ingress/kube/secret/model.go +++ b/pkg/ingress/kube/secret/model.go @@ -18,7 +18,7 @@ import ( listerv1 "k8s.io/client-go/listers/core/v1" "k8s.io/client-go/tools/cache" - "github.com/alibaba/higress/ingress/kube/util" + "github.com/alibaba/higress/pkg/ingress/kube/util" ) type Controller interface { diff --git a/ingress/kube/util/util.go b/pkg/ingress/kube/util/util.go similarity index 100% rename from ingress/kube/util/util.go rename to pkg/ingress/kube/util/util.go diff --git a/ingress/kube/util/util_test.go b/pkg/ingress/kube/util/util_test.go similarity index 100% rename from ingress/kube/util/util_test.go rename to pkg/ingress/kube/util/util_test.go diff --git a/ingress/log/log.go b/pkg/ingress/log/log.go similarity index 100% rename from ingress/log/log.go rename to pkg/ingress/log/log.go diff --git a/ingress/mcp/generator.go b/pkg/ingress/mcp/generator.go similarity index 100% rename from ingress/mcp/generator.go rename to pkg/ingress/mcp/generator.go