diff --git a/go.mod b/go.mod index 0f0e5a11e1..edad142527 100644 --- a/go.mod +++ b/go.mod @@ -103,5 +103,3 @@ require ( sigs.k8s.io/structured-merge-diff/v4 v4.3.0 // indirect sigs.k8s.io/yaml v1.4.0 // indirect ) - -replace knative.dev/networking => github.com/ReToCode/networking v0.0.0-20240109073627-bc010699726a diff --git a/go.sum b/go.sum index dc991b3ea2..d06d0c0441 100644 --- a/go.sum +++ b/go.sum @@ -37,8 +37,6 @@ contrib.go.opencensus.io/exporter/prometheus v0.4.2/go.mod h1:dvEHbiKmgvbr5pjaF9 dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/ReToCode/networking v0.0.0-20240109073627-bc010699726a h1:tNqizB6R53cc8/k0GmYQNh3qAvG7JGZXuUpD0Qc8cOQ= -github.com/ReToCode/networking v0.0.0-20240109073627-bc010699726a/go.mod h1:KL3tdfTQ58qOdE66WagSuFtppfMCNp+ZlDL3Oc6Bxno= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -698,6 +696,8 @@ k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 h1:qY1Ad8PODbnymg2pRbkyMT/ylpTrC k8s.io/utils v0.0.0-20230406110748-d93618cff8a2/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= knative.dev/hack v0.0.0-20240108153050-3ea694d6dad7 h1:mICurlRke2mlKP3LmyWYQYl6KZe80rYP5+ag9w2HQLA= knative.dev/hack v0.0.0-20240108153050-3ea694d6dad7/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q= +knative.dev/networking v0.0.0-20240108134621-7cca4b010b25 h1:2H/mvXGSgfBcpNFUMWC3XCWL5zOrGGvas4RBbclEJ1M= +knative.dev/networking v0.0.0-20240108134621-7cca4b010b25/go.mod h1:ynNh7EoqxkST4jWPw6ZVyI9jwuF68WJNrX65yoAQ7FE= knative.dev/pkg v0.0.0-20240108152118-de3e9cc204c9 h1:4nsTvrgApGtLTt6Gpo7ulJS03pBI+wSJ8+EOwVamDx0= knative.dev/pkg v0.0.0-20240108152118-de3e9cc204c9/go.mod h1:YzKN/kzcJPhL+Z4fwuzbaiEnRLIbYvOiZUuCWFJ7PRA= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= diff --git a/vendor/knative.dev/networking/pkg/apis/networking/metadata_validation.go b/vendor/knative.dev/networking/pkg/apis/networking/metadata_validation.go index ff081dcd0b..fbd6c155fd 100644 --- a/vendor/knative.dev/networking/pkg/apis/networking/metadata_validation.go +++ b/vendor/knative.dev/networking/pkg/apis/networking/metadata_validation.go @@ -25,7 +25,7 @@ import ( ) var ( - allowedAnnotations = sets.New[string]( + allowedAnnotations = sets.NewString( IngressClassAnnotationKey, CertificateClassAnnotationKey, DisableAutoTLSAnnotationKey, diff --git a/vendor/knative.dev/networking/pkg/client/injection/reconciler/networking/v1alpha1/ingress/reconciler.go b/vendor/knative.dev/networking/pkg/client/injection/reconciler/networking/v1alpha1/ingress/reconciler.go index a63561ef4d..c135c56a27 100644 --- a/vendor/knative.dev/networking/pkg/client/injection/reconciler/networking/v1alpha1/ingress/reconciler.go +++ b/vendor/knative.dev/networking/pkg/client/injection/reconciler/networking/v1alpha1/ingress/reconciler.go @@ -357,14 +357,14 @@ func (r *reconcilerImpl) updateStatus(ctx context.Context, logger *zap.SugaredLo // updateFinalizersFiltered will update the Finalizers of the resource. // TODO: this method could be generic and sync all finalizers. For now it only // updates defaultFinalizerName or its override. -func (r *reconcilerImpl) updateFinalizersFiltered(ctx context.Context, resource *v1alpha1.Ingress, desiredFinalizers sets.Set[string]) (*v1alpha1.Ingress, error) { +func (r *reconcilerImpl) updateFinalizersFiltered(ctx context.Context, resource *v1alpha1.Ingress, desiredFinalizers sets.String) (*v1alpha1.Ingress, error) { // Don't modify the informers copy. existing := resource.DeepCopy() var finalizers []string // If there's nothing to update, just return. - existingFinalizers := sets.New[string](existing.Finalizers...) + existingFinalizers := sets.NewString(existing.Finalizers...) if desiredFinalizers.Has(r.finalizerName) { if existingFinalizers.Has(r.finalizerName) { @@ -380,7 +380,7 @@ func (r *reconcilerImpl) updateFinalizersFiltered(ctx context.Context, resource } // Remove the finalizer. existingFinalizers.Delete(r.finalizerName) - finalizers = sets.List(existingFinalizers) + finalizers = existingFinalizers.List() } mergePatch := map[string]interface{}{ @@ -414,7 +414,7 @@ func (r *reconcilerImpl) setFinalizerIfFinalizer(ctx context.Context, resource * return resource, nil } - finalizers := sets.New[string](resource.Finalizers...) + finalizers := sets.NewString(resource.Finalizers...) // If this resource is not being deleted, mark the finalizer. if resource.GetDeletionTimestamp().IsZero() { @@ -433,7 +433,7 @@ func (r *reconcilerImpl) clearFinalizer(ctx context.Context, resource *v1alpha1. return resource, nil } - finalizers := sets.New[string](resource.Finalizers...) + finalizers := sets.NewString(resource.Finalizers...) if reconcileEvent != nil { var event *reconciler.ReconcilerEvent diff --git a/vendor/knative.dev/networking/pkg/client/injection/reconciler/networking/v1alpha1/serverlessservice/reconciler.go b/vendor/knative.dev/networking/pkg/client/injection/reconciler/networking/v1alpha1/serverlessservice/reconciler.go index 0ead54735f..761cbf090c 100644 --- a/vendor/knative.dev/networking/pkg/client/injection/reconciler/networking/v1alpha1/serverlessservice/reconciler.go +++ b/vendor/knative.dev/networking/pkg/client/injection/reconciler/networking/v1alpha1/serverlessservice/reconciler.go @@ -346,14 +346,14 @@ func (r *reconcilerImpl) updateStatus(ctx context.Context, logger *zap.SugaredLo // updateFinalizersFiltered will update the Finalizers of the resource. // TODO: this method could be generic and sync all finalizers. For now it only // updates defaultFinalizerName or its override. -func (r *reconcilerImpl) updateFinalizersFiltered(ctx context.Context, resource *v1alpha1.ServerlessService, desiredFinalizers sets.Set[string]) (*v1alpha1.ServerlessService, error) { +func (r *reconcilerImpl) updateFinalizersFiltered(ctx context.Context, resource *v1alpha1.ServerlessService, desiredFinalizers sets.String) (*v1alpha1.ServerlessService, error) { // Don't modify the informers copy. existing := resource.DeepCopy() var finalizers []string // If there's nothing to update, just return. - existingFinalizers := sets.New[string](existing.Finalizers...) + existingFinalizers := sets.NewString(existing.Finalizers...) if desiredFinalizers.Has(r.finalizerName) { if existingFinalizers.Has(r.finalizerName) { @@ -369,7 +369,7 @@ func (r *reconcilerImpl) updateFinalizersFiltered(ctx context.Context, resource } // Remove the finalizer. existingFinalizers.Delete(r.finalizerName) - finalizers = sets.List(existingFinalizers) + finalizers = existingFinalizers.List() } mergePatch := map[string]interface{}{ @@ -403,7 +403,7 @@ func (r *reconcilerImpl) setFinalizerIfFinalizer(ctx context.Context, resource * return resource, nil } - finalizers := sets.New[string](resource.Finalizers...) + finalizers := sets.NewString(resource.Finalizers...) // If this resource is not being deleted, mark the finalizer. if resource.GetDeletionTimestamp().IsZero() { @@ -422,7 +422,7 @@ func (r *reconcilerImpl) clearFinalizer(ctx context.Context, resource *v1alpha1. return resource, nil } - finalizers := sets.New[string](resource.Finalizers...) + finalizers := sets.NewString(resource.Finalizers...) if reconcileEvent != nil { var event *reconciler.ReconcilerEvent diff --git a/vendor/knative.dev/networking/pkg/ingress/ingress.go b/vendor/knative.dev/networking/pkg/ingress/ingress.go index f1ffb88c44..5e24eecfa9 100644 --- a/vendor/knative.dev/networking/pkg/ingress/ingress.go +++ b/vendor/knative.dev/networking/pkg/ingress/ingress.go @@ -73,13 +73,13 @@ func InsertProbe(ing *v1alpha1.Ingress) (string, error) { // HostsPerVisibility takes an Ingress and a map from visibility levels to a set of string keys, // it then returns a map from that key space to the hosts under that visibility. -func HostsPerVisibility(ing *v1alpha1.Ingress, visibilityToKey map[v1alpha1.IngressVisibility]sets.Set[string]) map[string]sets.Set[string] { - output := make(map[string]sets.Set[string], 2) // We currently have public and internal. +func HostsPerVisibility(ing *v1alpha1.Ingress, visibilityToKey map[v1alpha1.IngressVisibility]sets.String) map[string]sets.String { + output := make(map[string]sets.String, 2) // We currently have public and internal. for _, rule := range ing.Spec.Rules { - for host := range ExpandedHosts(sets.New(rule.Hosts...)) { + for host := range ExpandedHosts(sets.NewString(rule.Hosts...)) { for key := range visibilityToKey[rule.Visibility] { if _, ok := output[key]; !ok { - output[key] = make(sets.Set[string], len(rule.Hosts)) + output[key] = make(sets.String, len(rule.Hosts)) } output[key].Insert(host) } @@ -89,15 +89,15 @@ func HostsPerVisibility(ing *v1alpha1.Ingress, visibilityToKey map[v1alpha1.Ingr } // ExpandedHosts sets up hosts for the short-names for cluster DNS names. -func ExpandedHosts(hosts sets.Set[string]) sets.Set[string] { +func ExpandedHosts(hosts sets.String) sets.String { allowedSuffixes := []string{ "", "." + network.GetClusterDomainName(), ".svc." + network.GetClusterDomainName(), } // Optimistically pre-alloc. - expanded := make(sets.Set[string], len(hosts)*len(allowedSuffixes)) - for _, h := range sets.List(hosts) { + expanded := make(sets.String, len(hosts)*len(allowedSuffixes)) + for _, h := range hosts.List() { for _, suffix := range allowedSuffixes { if th := strings.TrimSuffix(h, suffix); suffix == "" || len(th) < len(h) { if isValidTopLevelDomain(th) { diff --git a/vendor/knative.dev/networking/pkg/prober/prober.go b/vendor/knative.dev/networking/pkg/prober/prober.go index ec93306063..4ff7fb06ec 100644 --- a/vendor/knative.dev/networking/pkg/prober/prober.go +++ b/vendor/knative.dev/networking/pkg/prober/prober.go @@ -143,14 +143,14 @@ type Manager struct { // mu guards keys. mu sync.Mutex - keys sets.Set[string] + keys sets.String } // New creates a new Manager, that will invoke the given callback when // async probing is finished. func New(cb Done, transport http.RoundTripper) *Manager { return &Manager{ - keys: sets.New[string](), + keys: sets.NewString(), cb: cb, transport: transport, } diff --git a/vendor/knative.dev/networking/pkg/status/status.go b/vendor/knative.dev/networking/pkg/status/status.go index 4ea161001d..cf8ae5c788 100644 --- a/vendor/knative.dev/networking/pkg/status/status.go +++ b/vendor/knative.dev/networking/pkg/status/status.go @@ -96,7 +96,7 @@ type workItem struct { // ProbeTarget contains the URLs to probes for a set of Pod IPs serving out of the same port. type ProbeTarget struct { - PodIPs sets.Set[string] + PodIPs sets.String PodPort string Port string URLs []*url.URL diff --git a/vendor/knative.dev/networking/test/conformance/ingress/grpc.go b/vendor/knative.dev/networking/test/conformance/ingress/grpc.go index 90485c030f..0dabb3de95 100644 --- a/vendor/knative.dev/networking/test/conformance/ingress/grpc.go +++ b/vendor/knative.dev/networking/test/conformance/ingress/grpc.go @@ -102,7 +102,7 @@ func TestGRPCSplit(t *testing.T) { greenName, greenPort, _ := CreateGRPCService(ctx, t, clients, suffixGreen) // The suffixes we expect to see. - want := sets.New(suffixBlue, suffixGreen) + want := sets.NewString(suffixBlue, suffixGreen) // Create a simple Ingress over the Service. name := test.ObjectNameForTest(t) @@ -150,7 +150,7 @@ func TestGRPCSplit(t *testing.T) { defer cancel() const maxRequests = 100 - got := sets.New[string]() + got := sets.NewString() for i := 0; i < maxRequests; i++ { stream, err := pc.PingStream(ctx) if err != nil { diff --git a/vendor/knative.dev/networking/test/conformance/ingress/headers.go b/vendor/knative.dev/networking/test/conformance/ingress/headers.go index 57617cdd58..148bb1fbc2 100644 --- a/vendor/knative.dev/networking/test/conformance/ingress/headers.go +++ b/vendor/knative.dev/networking/test/conformance/ingress/headers.go @@ -283,7 +283,7 @@ func TestPostSplitSetHeaders(t *testing.T) { ) backends := make([]v1alpha1.IngressBackendSplit, 0, splits) - names := make(sets.Set[string], splits) + names := make(sets.String, splits) for i := 0; i < splits; i++ { name, port, _ := CreateRuntimeService(ctx, t, clients, networking.ServicePortNameHTTP1) backends = append(backends, v1alpha1.IngressBackendSplit{ @@ -322,7 +322,7 @@ func TestPostSplitSetHeaders(t *testing.T) { // Make enough requests that the likelihood of us seeing each variation is high, // but don't check the distribution of requests, as that isn't the point of this // particular test. - seen := make(sets.Set[string], len(names)) + seen := make(sets.String, len(names)) for i := 0; i < maxRequests; i++ { ri := RuntimeRequest(ctx, t, client, "http://"+name+".example.com") if ri == nil { @@ -345,7 +345,7 @@ func TestPostSplitSetHeaders(t *testing.T) { // Make enough requests that the likelihood of us seeing each variation is high, // but don't check the distribution of requests, as that isn't the point of this // particular test. - seen := make(sets.Set[string], len(names)) + seen := make(sets.String, len(names)) for i := 0; i < maxRequests; i++ { ri := RuntimeRequest(ctx, t, client, "http://"+name+".example.com", func(req *http.Request) { // Specify a value for the header to verify that implementations diff --git a/vendor/knative.dev/networking/test/conformance/ingress/path.go b/vendor/knative.dev/networking/test/conformance/ingress/path.go index b00507573b..e6d56989af 100644 --- a/vendor/knative.dev/networking/test/conformance/ingress/path.go +++ b/vendor/knative.dev/networking/test/conformance/ingress/path.go @@ -209,7 +209,7 @@ func TestPathAndPercentageSplit(t *testing.T) { totalHalf = total / 2 tolerance = total * 0.15 ) - wantKeys := sets.New(fooName, barName) + wantKeys := sets.NewString(fooName, barName) resultCh := make(chan string, total) var g errgroup.Group diff --git a/vendor/knative.dev/networking/test/conformance/ingress/util.go b/vendor/knative.dev/networking/test/conformance/ingress/util.go index 2ee057d880..721cb0b772 100644 --- a/vendor/knative.dev/networking/test/conformance/ingress/util.go +++ b/vendor/knative.dev/networking/test/conformance/ingress/util.go @@ -1104,7 +1104,7 @@ type ResponseExpectation func(response *http.Response) error func RuntimeRequest(ctx context.Context, t *testing.T, client *http.Client, url string, opts ...RequestOption) *types.RuntimeInfo { return RuntimeRequestWithExpectations(ctx, t, client, url, - []ResponseExpectation{StatusCodeExpectation(sets.New(http.StatusOK))}, + []ResponseExpectation{StatusCodeExpectation(sets.NewInt(http.StatusOK))}, false, opts...) } @@ -1173,7 +1173,7 @@ func DumpResponse(_ context.Context, t *testing.T, resp *http.Response) { t.Log(string(b)) } -func StatusCodeExpectation(statusCodes sets.Set[int]) ResponseExpectation { +func StatusCodeExpectation(statusCodes sets.Int) ResponseExpectation { return func(response *http.Response) error { if !statusCodes.Has(response.StatusCode) { return fmt.Errorf("got unexpected status: %d, expected %v", response.StatusCode, statusCodes) diff --git a/vendor/knative.dev/networking/test/conformance/ingress/visibility.go b/vendor/knative.dev/networking/test/conformance/ingress/visibility.go index 12d90f3dce..a9fe0f3925 100644 --- a/vendor/knative.dev/networking/test/conformance/ingress/visibility.go +++ b/vendor/knative.dev/networking/test/conformance/ingress/visibility.go @@ -65,7 +65,7 @@ func TestVisibility(t *testing.T) { // Ensure the service is not publicly accessible for _, privateHostName := range privateHostNames { - RuntimeRequestWithExpectations(ctx, t, client, "http://"+privateHostName, []ResponseExpectation{StatusCodeExpectation(sets.New(http.StatusNotFound))}, true) + RuntimeRequestWithExpectations(ctx, t, client, "http://"+privateHostName, []ResponseExpectation{StatusCodeExpectation(sets.NewInt(http.StatusNotFound))}, true) } for name := range privateHostNames { @@ -165,7 +165,7 @@ func TestVisibilitySplit(t *testing.T) { }) // Ensure we can't connect to the private resources - RuntimeRequestWithExpectations(ctx, t, client, "http://"+privateHostName, []ResponseExpectation{StatusCodeExpectation(sets.New(http.StatusNotFound))}, true) + RuntimeRequestWithExpectations(ctx, t, client, "http://"+privateHostName, []ResponseExpectation{StatusCodeExpectation(sets.NewInt(http.StatusNotFound))}, true) loadbalancerAddress := localIngress.Status.PrivateLoadBalancer.Ingress[0].DomainInternal proxyName, proxyPort, _ := CreateProxyService(ctx, t, clients, privateHostName, loadbalancerAddress) @@ -328,7 +328,7 @@ func TestVisibilityPath(t *testing.T) { // Ensure we can't connect to the private resources for _, path := range []string{"", "/foo", "/bar", "/baz"} { - RuntimeRequestWithExpectations(ctx, t, client, "http://"+privateHostName+path, []ResponseExpectation{StatusCodeExpectation(sets.New(http.StatusNotFound))}, true) + RuntimeRequestWithExpectations(ctx, t, client, "http://"+privateHostName+path, []ResponseExpectation{StatusCodeExpectation(sets.NewInt(http.StatusNotFound))}, true) } loadbalancerAddress := localIngress.Status.PrivateLoadBalancer.Ingress[0].DomainInternal diff --git a/vendor/knative.dev/networking/test/conformance/ingress/websocket.go b/vendor/knative.dev/networking/test/conformance/ingress/websocket.go index 6d1c10660d..648dfa85a8 100644 --- a/vendor/knative.dev/networking/test/conformance/ingress/websocket.go +++ b/vendor/knative.dev/networking/test/conformance/ingress/websocket.go @@ -93,7 +93,7 @@ func TestWebsocketSplit(t *testing.T) { greenName, greenPort, _ := CreateWebsocketService(ctx, t, clients, suffixGreen) // The suffixes we expect to see. - want := sets.New(suffixBlue, suffixGreen) + want := sets.NewString(suffixBlue, suffixGreen) // Create a simple Ingress over the Service. name := test.ObjectNameForTest(t) @@ -132,7 +132,7 @@ func TestWebsocketSplit(t *testing.T) { u := url.URL{Scheme: "ws", Host: domain, Path: "/"} const maxRequests = 100 - got := sets.New[string]() + got := sets.NewString() for i := 0; i < maxRequests; i++ { conn, _, err := dialer.Dial(u.String(), http.Header{"Host": {domain}}) if err != nil { @@ -157,7 +157,7 @@ func TestWebsocketSplit(t *testing.T) { } // Us getting here means we haven't seen splits. - t.Errorf("(over %d requests) (-want, +got) = %s", maxRequests, cmp.Diff(sets.List(want), sets.List(got))) + t.Errorf("(over %d requests) (-want, +got) = %s", maxRequests, cmp.Diff(want.List(), got.List())) } func findWebsocketSuffix(t *testing.T, conn *websocket.Conn) string { diff --git a/vendor/modules.txt b/vendor/modules.txt index 704e80972f..a2fff5eed4 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -919,7 +919,7 @@ k8s.io/utils/trace # knative.dev/hack v0.0.0-20240108153050-3ea694d6dad7 ## explicit; go 1.18 knative.dev/hack -# knative.dev/networking v0.0.0-20240108134621-7cca4b010b25 => github.com/ReToCode/networking v0.0.0-20240109073627-bc010699726a +# knative.dev/networking v0.0.0-20240108134621-7cca4b010b25 ## explicit; go 1.18 knative.dev/networking/config knative.dev/networking/pkg @@ -1071,4 +1071,3 @@ sigs.k8s.io/yaml/goyaml.v2 # k8s.io/client-go => k8s.io/client-go v0.27.6 # k8s.io/kube-openapi => k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f # sigs.k8s.io/structured-merge-diff/v4 => sigs.k8s.io/structured-merge-diff/v4 v4.2.3 -# knative.dev/networking => github.com/ReToCode/networking v0.0.0-20240109073627-bc010699726a