From dde74487b2cfa2ed5ca7efa1b73569d92791e1ef Mon Sep 17 00:00:00 2001 From: Shriram Sharma Date: Wed, 17 Aug 2022 15:53:54 -0700 Subject: [PATCH 1/7] Upgraded the dependent go modules (#232) Signed-off-by: Anubhav Aeron --- .circleci/config.yml | 4 +- .../pkg/apis/admiral/routes/handler_test.go | 14 +- admiral/pkg/apis/admiral/routes/handlers.go | 6 +- .../apis/admiral/v1/zz_generated.deepcopy.go | 1 + .../client/clientset/versioned/clientset.go | 41 +- .../versioned/fake/clientset_generated.go | 5 +- .../clientset/versioned/fake/register.go | 2 +- .../typed/admiral/v1/admiral_client.go | 20 +- .../versioned/typed/admiral/v1/dependency.go | 72 +- .../typed/admiral/v1/fake/fake_dependency.go | 24 +- .../v1/fake/fake_globaltrafficpolicy.go | 24 +- .../admiral/v1/fake/fake_routingpolicy.go | 24 +- .../typed/admiral/v1/globaltrafficpolicy.go | 72 +- .../typed/admiral/v1/routingpolicy.go | 82 +- .../externalversions/admiral/v1/dependency.go | 5 +- .../admiral/v1/globaltrafficpolicy.go | 5 +- .../admiral/v1/routingpolicy.go | 5 +- .../client/listers/admiral/v1/dependency.go | 5 + .../listers/admiral/v1/globaltrafficpolicy.go | 5 + .../listers/admiral/v1/routingpolicy.go | 5 + admiral/pkg/clusters/envoyfilter.go | 89 +- admiral/pkg/clusters/envoyfilter_test.go | 62 +- admiral/pkg/clusters/handler.go | 135 +- admiral/pkg/clusters/handler_test.go | 144 +- admiral/pkg/clusters/registry.go | 15 +- admiral/pkg/clusters/registry_test.go | 33 +- admiral/pkg/clusters/serviceentry.go | 128 +- admiral/pkg/clusters/serviceentry_test.go | 103 +- admiral/pkg/clusters/types.go | 146 +- admiral/pkg/clusters/types_test.go | 110 +- admiral/pkg/controller/admiral/configmap.go | 36 +- .../pkg/controller/admiral/configmap_test.go | 12 +- admiral/pkg/controller/admiral/controller.go | 32 +- .../pkg/controller/admiral/controller_test.go | 16 +- admiral/pkg/controller/admiral/dependency.go | 28 +- .../pkg/controller/admiral/dependency_test.go | 14 +- admiral/pkg/controller/admiral/deployment.go | 41 +- .../pkg/controller/admiral/deployment_test.go | 33 +- .../pkg/controller/admiral/globaltraffic.go | 28 +- .../controller/admiral/globaltraffic_test.go | 27 +- admiral/pkg/controller/admiral/node.go | 10 +- admiral/pkg/controller/admiral/node_test.go | 12 +- admiral/pkg/controller/admiral/rollouts.go | 35 +- .../pkg/controller/admiral/rollouts_test.go | 44 +- .../pkg/controller/admiral/routingpolicy.go | 40 +- .../controller/admiral/routingpolicy_test.go | 21 +- admiral/pkg/controller/admiral/service.go | 35 +- .../pkg/controller/admiral/service_test.go | 10 +- .../pkg/controller/istio/destinationrule.go | 19 +- .../controller/istio/destinationrule_test.go | 18 +- admiral/pkg/controller/istio/serviceentry.go | 7 +- .../pkg/controller/istio/serviceentry_test.go | 19 +- admiral/pkg/controller/istio/sidecar.go | 21 +- admiral/pkg/controller/istio/sidecar_test.go | 19 +- .../pkg/controller/istio/virtualservice.go | 21 +- .../controller/istio/virtualservice_test.go | 19 +- .../pkg/controller/secret/secretcontroller.go | 10 +- .../secret/secretcontroller_test.go | 26 +- admiral/pkg/test/mock.go | 58 +- .../resources/admins@fake-cluster.k8s.local | 2 +- admiral/pkg/test/types.go | 6 +- go.mod | 175 +-- go.sum | 1179 ++++++++--------- hack/update-codegen.sh | 2 +- 64 files changed, 1809 insertions(+), 1652 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1c70eccd..354e8a0a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,7 +7,7 @@ jobs: build: working_directory: /go/pkg/mod/github.com/admiral docker: - - image: circleci/golang:1.16 + - image: circleci/golang:1.17 steps: - checkout - run: @@ -107,7 +107,7 @@ jobs: ./run.sh "1.20.14" "1.12.2" "../out" publish-github-release: docker: - - image: circleci/golang:1.16 + - image: circleci/golang:1.17 working_directory: /go/pkg/mod/github.com/admiral steps: - attach_workspace: diff --git a/admiral/pkg/apis/admiral/routes/handler_test.go b/admiral/pkg/apis/admiral/routes/handler_test.go index 22ee6247..bce660fe 100644 --- a/admiral/pkg/apis/admiral/routes/handler_test.go +++ b/admiral/pkg/apis/admiral/routes/handler_test.go @@ -2,19 +2,22 @@ package routes import ( "bytes" + "context" "encoding/json" + "io/ioutil" + "net/http/httptest" + "strings" + "testing" + "github.com/gorilla/mux" "github.com/istio-ecosystem/admiral/admiral/pkg/clusters" "github.com/istio-ecosystem/admiral/admiral/pkg/controller/common" "github.com/istio-ecosystem/admiral/admiral/pkg/controller/istio" "github.com/istio-ecosystem/admiral/admiral/pkg/controller/secret" "github.com/stretchr/testify/assert" - "io/ioutil" "istio.io/client-go/pkg/apis/networking/v1alpha3" istiofake "istio.io/client-go/pkg/clientset/versioned/fake" - "net/http/httptest" - "strings" - "testing" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) func TestReturnSuccessGET(t *testing.T) { @@ -93,6 +96,7 @@ func TestGetClusters(t *testing.T) { } func TestGetServiceEntriesByCluster(t *testing.T) { + ctx := context.Background() url := "https://admiral.com/cluster/cluster1/serviceentries" opts := RouteOpts{ RemoteRegistry: clusters.NewRemoteRegistry(nil, common.AdmiralParams{}), @@ -158,7 +162,7 @@ func TestGetServiceEntriesByCluster(t *testing.T) { } opts.RemoteRegistry = rr if c.name == "success with service entry for cluster" { - fakeIstioClient.NetworkingV1alpha3().ServiceEntries("admiral-sync").Create(&v1alpha3.ServiceEntry{}) + fakeIstioClient.NetworkingV1alpha3().ServiceEntries("admiral-sync").Create(ctx, &v1alpha3.ServiceEntry{}, v1.CreateOptions{}) } opts.GetServiceEntriesByCluster(w, r) resp := w.Result() diff --git a/admiral/pkg/apis/admiral/routes/handlers.go b/admiral/pkg/apis/admiral/routes/handlers.go index ffff3311..79267333 100644 --- a/admiral/pkg/apis/admiral/routes/handlers.go +++ b/admiral/pkg/apis/admiral/routes/handlers.go @@ -103,11 +103,13 @@ func (opts *RouteOpts) GetServiceEntriesByCluster(w http.ResponseWriter, r *http params := mux.Vars(r) clusterName := strings.Trim(params["clustername"], " ") - var response []v1alpha3.ServiceEntry + var response []*v1alpha3.ServiceEntry + + ctx := r.Context() if clusterName != "" { - serviceEntriesByCluster, err := clusters.GetServiceEntriesByCluster(clusterName, opts.RemoteRegistry) + serviceEntriesByCluster, err := clusters.GetServiceEntriesByCluster(ctx, clusterName, opts.RemoteRegistry) if err != nil { log.Printf("API call get service entry by cluster failed for clustername %v with Error: %v", clusterName, err.Error()) diff --git a/admiral/pkg/apis/admiral/v1/zz_generated.deepcopy.go b/admiral/pkg/apis/admiral/v1/zz_generated.deepcopy.go index 034807e9..df3933f2 100644 --- a/admiral/pkg/apis/admiral/v1/zz_generated.deepcopy.go +++ b/admiral/pkg/apis/admiral/v1/zz_generated.deepcopy.go @@ -1,3 +1,4 @@ +//go:build !ignore_autogenerated // +build !ignore_autogenerated /* diff --git a/admiral/pkg/client/clientset/versioned/clientset.go b/admiral/pkg/client/clientset/versioned/clientset.go index 81473073..e41fbf87 100644 --- a/admiral/pkg/client/clientset/versioned/clientset.go +++ b/admiral/pkg/client/clientset/versioned/clientset.go @@ -20,6 +20,8 @@ package versioned import ( "fmt" + "log" + "net/http" admiralv1 "github.com/istio-ecosystem/admiral/admiral/pkg/client/clientset/versioned/typed/admiral/v1" discovery "k8s.io/client-go/discovery" @@ -55,22 +57,45 @@ func (c *Clientset) Discovery() discovery.DiscoveryInterface { // NewForConfig creates a new Clientset for the given config. // If config's RateLimiter is not set and QPS and Burst are acceptable, // NewForConfig will generate a rate-limiter in configShallowCopy. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). func NewForConfig(c *rest.Config) (*Clientset, error) { configShallowCopy := *c + + if configShallowCopy.UserAgent == "" { + configShallowCopy.UserAgent = rest.DefaultKubernetesUserAgent() + } + + // share the transport between all clients + httpClient, err := rest.HTTPClientFor(&configShallowCopy) + if err != nil { + return nil, err + } + + return NewForConfigAndClient(&configShallowCopy, httpClient) +} + +// NewForConfigAndClient creates a new Clientset for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +// If config's RateLimiter is not set and QPS and Burst are acceptable, +// NewForConfigAndClient will generate a rate-limiter in configShallowCopy. +func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, error) { + configShallowCopy := *c if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { if configShallowCopy.Burst <= 0 { - return nil, fmt.Errorf("Burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0") + return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0") } configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) } + var cs Clientset var err error - cs.admiralV1, err = admiralv1.NewForConfig(&configShallowCopy) + cs.admiralV1, err = admiralv1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } - cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } @@ -80,11 +105,11 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { // NewForConfigOrDie creates a new Clientset for the given config and // panics if there is an error in the config. func NewForConfigOrDie(c *rest.Config) *Clientset { - var cs Clientset - cs.admiralV1 = admiralv1.NewForConfigOrDie(c) - - cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) - return &cs + cs, err := NewForConfig(c) + if err != nil { + log.Fatal(err) + } + return cs } // New creates a new Clientset for the given RESTClient. diff --git a/admiral/pkg/client/clientset/versioned/fake/clientset_generated.go b/admiral/pkg/client/clientset/versioned/fake/clientset_generated.go index edab5fa7..728dbc59 100644 --- a/admiral/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/admiral/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -74,7 +74,10 @@ func (c *Clientset) Tracker() testing.ObjectTracker { return c.tracker } -var _ clientset.Interface = &Clientset{} +var ( + _ clientset.Interface = &Clientset{} + _ testing.FakeClient = &Clientset{} +) // AdmiralV1 retrieves the AdmiralV1Client func (c *Clientset) AdmiralV1() admiralv1.AdmiralV1Interface { diff --git a/admiral/pkg/client/clientset/versioned/fake/register.go b/admiral/pkg/client/clientset/versioned/fake/register.go index 5fd36869..c4b33625 100644 --- a/admiral/pkg/client/clientset/versioned/fake/register.go +++ b/admiral/pkg/client/clientset/versioned/fake/register.go @@ -29,7 +29,7 @@ import ( var scheme = runtime.NewScheme() var codecs = serializer.NewCodecFactory(scheme) -var parameterCodec = runtime.NewParameterCodec(scheme) + var localSchemeBuilder = runtime.SchemeBuilder{ admiralv1.AddToScheme, } diff --git a/admiral/pkg/client/clientset/versioned/typed/admiral/v1/admiral_client.go b/admiral/pkg/client/clientset/versioned/typed/admiral/v1/admiral_client.go index a6d89eba..3c6f1dde 100644 --- a/admiral/pkg/client/clientset/versioned/typed/admiral/v1/admiral_client.go +++ b/admiral/pkg/client/clientset/versioned/typed/admiral/v1/admiral_client.go @@ -19,6 +19,8 @@ limitations under the License. package v1 import ( + "net/http" + v1 "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/v1" "github.com/istio-ecosystem/admiral/admiral/pkg/client/clientset/versioned/scheme" rest "k8s.io/client-go/rest" @@ -49,12 +51,28 @@ func (c *AdmiralV1Client) RoutingPolicies(namespace string) RoutingPolicyInterfa } // NewForConfig creates a new AdmiralV1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). func NewForConfig(c *rest.Config) (*AdmiralV1Client, error) { config := *c if err := setConfigDefaults(&config); err != nil { return nil, err } - client, err := rest.RESTClientFor(&config) + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new AdmiralV1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*AdmiralV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) if err != nil { return nil, err } diff --git a/admiral/pkg/client/clientset/versioned/typed/admiral/v1/dependency.go b/admiral/pkg/client/clientset/versioned/typed/admiral/v1/dependency.go index 7433bcce..8b533c0b 100644 --- a/admiral/pkg/client/clientset/versioned/typed/admiral/v1/dependency.go +++ b/admiral/pkg/client/clientset/versioned/typed/admiral/v1/dependency.go @@ -19,6 +19,7 @@ limitations under the License. package v1 import ( + "context" "time" v1 "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/v1" @@ -37,15 +38,15 @@ type DependenciesGetter interface { // DependencyInterface has methods to work with Dependency resources. type DependencyInterface interface { - Create(*v1.Dependency) (*v1.Dependency, error) - Update(*v1.Dependency) (*v1.Dependency, error) - UpdateStatus(*v1.Dependency) (*v1.Dependency, error) - Delete(name string, options *metav1.DeleteOptions) error - DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error - Get(name string, options metav1.GetOptions) (*v1.Dependency, error) - List(opts metav1.ListOptions) (*v1.DependencyList, error) - Watch(opts metav1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Dependency, err error) + Create(ctx context.Context, dependency *v1.Dependency, opts metav1.CreateOptions) (*v1.Dependency, error) + Update(ctx context.Context, dependency *v1.Dependency, opts metav1.UpdateOptions) (*v1.Dependency, error) + UpdateStatus(ctx context.Context, dependency *v1.Dependency, opts metav1.UpdateOptions) (*v1.Dependency, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Dependency, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.DependencyList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Dependency, err error) DependencyExpansion } @@ -64,20 +65,20 @@ func newDependencies(c *AdmiralV1Client, namespace string) *dependencies { } // Get takes name of the dependency, and returns the corresponding dependency object, and an error if there is any. -func (c *dependencies) Get(name string, options metav1.GetOptions) (result *v1.Dependency, err error) { +func (c *dependencies) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Dependency, err error) { result = &v1.Dependency{} err = c.client.Get(). Namespace(c.ns). Resource("dependencies"). Name(name). VersionedParams(&options, scheme.ParameterCodec). - Do(). + Do(ctx). Into(result) return } // List takes label and field selectors, and returns the list of Dependencies that match those selectors. -func (c *dependencies) List(opts metav1.ListOptions) (result *v1.DependencyList, err error) { +func (c *dependencies) List(ctx context.Context, opts metav1.ListOptions) (result *v1.DependencyList, err error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second @@ -88,13 +89,13 @@ func (c *dependencies) List(opts metav1.ListOptions) (result *v1.DependencyList, Resource("dependencies"). VersionedParams(&opts, scheme.ParameterCodec). Timeout(timeout). - Do(). + Do(ctx). Into(result) return } // Watch returns a watch.Interface that watches the requested dependencies. -func (c *dependencies) Watch(opts metav1.ListOptions) (watch.Interface, error) { +func (c *dependencies) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second @@ -105,87 +106,90 @@ func (c *dependencies) Watch(opts metav1.ListOptions) (watch.Interface, error) { Resource("dependencies"). VersionedParams(&opts, scheme.ParameterCodec). Timeout(timeout). - Watch() + Watch(ctx) } // Create takes the representation of a dependency and creates it. Returns the server's representation of the dependency, and an error, if there is any. -func (c *dependencies) Create(dependency *v1.Dependency) (result *v1.Dependency, err error) { +func (c *dependencies) Create(ctx context.Context, dependency *v1.Dependency, opts metav1.CreateOptions) (result *v1.Dependency, err error) { result = &v1.Dependency{} err = c.client.Post(). Namespace(c.ns). Resource("dependencies"). + VersionedParams(&opts, scheme.ParameterCodec). Body(dependency). - Do(). + Do(ctx). Into(result) return } // Update takes the representation of a dependency and updates it. Returns the server's representation of the dependency, and an error, if there is any. -func (c *dependencies) Update(dependency *v1.Dependency) (result *v1.Dependency, err error) { +func (c *dependencies) Update(ctx context.Context, dependency *v1.Dependency, opts metav1.UpdateOptions) (result *v1.Dependency, err error) { result = &v1.Dependency{} err = c.client.Put(). Namespace(c.ns). Resource("dependencies"). Name(dependency.Name). + VersionedParams(&opts, scheme.ParameterCodec). Body(dependency). - Do(). + Do(ctx). Into(result) return } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). - -func (c *dependencies) UpdateStatus(dependency *v1.Dependency) (result *v1.Dependency, err error) { +func (c *dependencies) UpdateStatus(ctx context.Context, dependency *v1.Dependency, opts metav1.UpdateOptions) (result *v1.Dependency, err error) { result = &v1.Dependency{} err = c.client.Put(). Namespace(c.ns). Resource("dependencies"). Name(dependency.Name). SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). Body(dependency). - Do(). + Do(ctx). Into(result) return } // Delete takes name of the dependency and deletes it. Returns an error if one occurs. -func (c *dependencies) Delete(name string, options *metav1.DeleteOptions) error { +func (c *dependencies) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { return c.client.Delete(). Namespace(c.ns). Resource("dependencies"). Name(name). - Body(options). - Do(). + Body(&opts). + Do(ctx). Error() } // DeleteCollection deletes a collection of objects. -func (c *dependencies) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error { +func (c *dependencies) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { var timeout time.Duration - if listOptions.TimeoutSeconds != nil { - timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second } return c.client.Delete(). Namespace(c.ns). Resource("dependencies"). - VersionedParams(&listOptions, scheme.ParameterCodec). + VersionedParams(&listOpts, scheme.ParameterCodec). Timeout(timeout). - Body(options). - Do(). + Body(&opts). + Do(ctx). Error() } // Patch applies the patch and returns the patched dependency. -func (c *dependencies) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Dependency, err error) { +func (c *dependencies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Dependency, err error) { result = &v1.Dependency{} err = c.client.Patch(pt). Namespace(c.ns). Resource("dependencies"). - SubResource(subresources...). Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). Body(data). - Do(). + Do(ctx). Into(result) return } diff --git a/admiral/pkg/client/clientset/versioned/typed/admiral/v1/fake/fake_dependency.go b/admiral/pkg/client/clientset/versioned/typed/admiral/v1/fake/fake_dependency.go index b1da8fc9..3b9391a8 100644 --- a/admiral/pkg/client/clientset/versioned/typed/admiral/v1/fake/fake_dependency.go +++ b/admiral/pkg/client/clientset/versioned/typed/admiral/v1/fake/fake_dependency.go @@ -19,6 +19,8 @@ limitations under the License. package fake import ( + "context" + admiralv1 "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" @@ -39,7 +41,7 @@ var dependenciesResource = schema.GroupVersionResource{Group: "admiral.io", Vers var dependenciesKind = schema.GroupVersionKind{Group: "admiral.io", Version: "v1", Kind: "Dependency"} // Get takes name of the dependency, and returns the corresponding dependency object, and an error if there is any. -func (c *FakeDependencies) Get(name string, options v1.GetOptions) (result *admiralv1.Dependency, err error) { +func (c *FakeDependencies) Get(ctx context.Context, name string, options v1.GetOptions) (result *admiralv1.Dependency, err error) { obj, err := c.Fake. Invokes(testing.NewGetAction(dependenciesResource, c.ns, name), &admiralv1.Dependency{}) @@ -50,7 +52,7 @@ func (c *FakeDependencies) Get(name string, options v1.GetOptions) (result *admi } // List takes label and field selectors, and returns the list of Dependencies that match those selectors. -func (c *FakeDependencies) List(opts v1.ListOptions) (result *admiralv1.DependencyList, err error) { +func (c *FakeDependencies) List(ctx context.Context, opts v1.ListOptions) (result *admiralv1.DependencyList, err error) { obj, err := c.Fake. Invokes(testing.NewListAction(dependenciesResource, dependenciesKind, c.ns, opts), &admiralv1.DependencyList{}) @@ -72,14 +74,14 @@ func (c *FakeDependencies) List(opts v1.ListOptions) (result *admiralv1.Dependen } // Watch returns a watch.Interface that watches the requested dependencies. -func (c *FakeDependencies) Watch(opts v1.ListOptions) (watch.Interface, error) { +func (c *FakeDependencies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. InvokesWatch(testing.NewWatchAction(dependenciesResource, c.ns, opts)) } // Create takes the representation of a dependency and creates it. Returns the server's representation of the dependency, and an error, if there is any. -func (c *FakeDependencies) Create(dependency *admiralv1.Dependency) (result *admiralv1.Dependency, err error) { +func (c *FakeDependencies) Create(ctx context.Context, dependency *admiralv1.Dependency, opts v1.CreateOptions) (result *admiralv1.Dependency, err error) { obj, err := c.Fake. Invokes(testing.NewCreateAction(dependenciesResource, c.ns, dependency), &admiralv1.Dependency{}) @@ -90,7 +92,7 @@ func (c *FakeDependencies) Create(dependency *admiralv1.Dependency) (result *adm } // Update takes the representation of a dependency and updates it. Returns the server's representation of the dependency, and an error, if there is any. -func (c *FakeDependencies) Update(dependency *admiralv1.Dependency) (result *admiralv1.Dependency, err error) { +func (c *FakeDependencies) Update(ctx context.Context, dependency *admiralv1.Dependency, opts v1.UpdateOptions) (result *admiralv1.Dependency, err error) { obj, err := c.Fake. Invokes(testing.NewUpdateAction(dependenciesResource, c.ns, dependency), &admiralv1.Dependency{}) @@ -102,7 +104,7 @@ func (c *FakeDependencies) Update(dependency *admiralv1.Dependency) (result *adm // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeDependencies) UpdateStatus(dependency *admiralv1.Dependency) (*admiralv1.Dependency, error) { +func (c *FakeDependencies) UpdateStatus(ctx context.Context, dependency *admiralv1.Dependency, opts v1.UpdateOptions) (*admiralv1.Dependency, error) { obj, err := c.Fake. Invokes(testing.NewUpdateSubresourceAction(dependenciesResource, "status", c.ns, dependency), &admiralv1.Dependency{}) @@ -113,23 +115,23 @@ func (c *FakeDependencies) UpdateStatus(dependency *admiralv1.Dependency) (*admi } // Delete takes name of the dependency and deletes it. Returns an error if one occurs. -func (c *FakeDependencies) Delete(name string, options *v1.DeleteOptions) error { +func (c *FakeDependencies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteAction(dependenciesResource, c.ns, name), &admiralv1.Dependency{}) + Invokes(testing.NewDeleteActionWithOptions(dependenciesResource, c.ns, name, opts), &admiralv1.Dependency{}) return err } // DeleteCollection deletes a collection of objects. -func (c *FakeDependencies) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(dependenciesResource, c.ns, listOptions) +func (c *FakeDependencies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(dependenciesResource, c.ns, listOpts) _, err := c.Fake.Invokes(action, &admiralv1.DependencyList{}) return err } // Patch applies the patch and returns the patched dependency. -func (c *FakeDependencies) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *admiralv1.Dependency, err error) { +func (c *FakeDependencies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *admiralv1.Dependency, err error) { obj, err := c.Fake. Invokes(testing.NewPatchSubresourceAction(dependenciesResource, c.ns, name, pt, data, subresources...), &admiralv1.Dependency{}) diff --git a/admiral/pkg/client/clientset/versioned/typed/admiral/v1/fake/fake_globaltrafficpolicy.go b/admiral/pkg/client/clientset/versioned/typed/admiral/v1/fake/fake_globaltrafficpolicy.go index f70dd556..1158f48f 100644 --- a/admiral/pkg/client/clientset/versioned/typed/admiral/v1/fake/fake_globaltrafficpolicy.go +++ b/admiral/pkg/client/clientset/versioned/typed/admiral/v1/fake/fake_globaltrafficpolicy.go @@ -19,6 +19,8 @@ limitations under the License. package fake import ( + "context" + admiralv1 "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" @@ -39,7 +41,7 @@ var globaltrafficpoliciesResource = schema.GroupVersionResource{Group: "admiral. var globaltrafficpoliciesKind = schema.GroupVersionKind{Group: "admiral.io", Version: "v1", Kind: "GlobalTrafficPolicy"} // Get takes name of the globalTrafficPolicy, and returns the corresponding globalTrafficPolicy object, and an error if there is any. -func (c *FakeGlobalTrafficPolicies) Get(name string, options v1.GetOptions) (result *admiralv1.GlobalTrafficPolicy, err error) { +func (c *FakeGlobalTrafficPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *admiralv1.GlobalTrafficPolicy, err error) { obj, err := c.Fake. Invokes(testing.NewGetAction(globaltrafficpoliciesResource, c.ns, name), &admiralv1.GlobalTrafficPolicy{}) @@ -50,7 +52,7 @@ func (c *FakeGlobalTrafficPolicies) Get(name string, options v1.GetOptions) (res } // List takes label and field selectors, and returns the list of GlobalTrafficPolicies that match those selectors. -func (c *FakeGlobalTrafficPolicies) List(opts v1.ListOptions) (result *admiralv1.GlobalTrafficPolicyList, err error) { +func (c *FakeGlobalTrafficPolicies) List(ctx context.Context, opts v1.ListOptions) (result *admiralv1.GlobalTrafficPolicyList, err error) { obj, err := c.Fake. Invokes(testing.NewListAction(globaltrafficpoliciesResource, globaltrafficpoliciesKind, c.ns, opts), &admiralv1.GlobalTrafficPolicyList{}) @@ -72,14 +74,14 @@ func (c *FakeGlobalTrafficPolicies) List(opts v1.ListOptions) (result *admiralv1 } // Watch returns a watch.Interface that watches the requested globalTrafficPolicies. -func (c *FakeGlobalTrafficPolicies) Watch(opts v1.ListOptions) (watch.Interface, error) { +func (c *FakeGlobalTrafficPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. InvokesWatch(testing.NewWatchAction(globaltrafficpoliciesResource, c.ns, opts)) } // Create takes the representation of a globalTrafficPolicy and creates it. Returns the server's representation of the globalTrafficPolicy, and an error, if there is any. -func (c *FakeGlobalTrafficPolicies) Create(globalTrafficPolicy *admiralv1.GlobalTrafficPolicy) (result *admiralv1.GlobalTrafficPolicy, err error) { +func (c *FakeGlobalTrafficPolicies) Create(ctx context.Context, globalTrafficPolicy *admiralv1.GlobalTrafficPolicy, opts v1.CreateOptions) (result *admiralv1.GlobalTrafficPolicy, err error) { obj, err := c.Fake. Invokes(testing.NewCreateAction(globaltrafficpoliciesResource, c.ns, globalTrafficPolicy), &admiralv1.GlobalTrafficPolicy{}) @@ -90,7 +92,7 @@ func (c *FakeGlobalTrafficPolicies) Create(globalTrafficPolicy *admiralv1.Global } // Update takes the representation of a globalTrafficPolicy and updates it. Returns the server's representation of the globalTrafficPolicy, and an error, if there is any. -func (c *FakeGlobalTrafficPolicies) Update(globalTrafficPolicy *admiralv1.GlobalTrafficPolicy) (result *admiralv1.GlobalTrafficPolicy, err error) { +func (c *FakeGlobalTrafficPolicies) Update(ctx context.Context, globalTrafficPolicy *admiralv1.GlobalTrafficPolicy, opts v1.UpdateOptions) (result *admiralv1.GlobalTrafficPolicy, err error) { obj, err := c.Fake. Invokes(testing.NewUpdateAction(globaltrafficpoliciesResource, c.ns, globalTrafficPolicy), &admiralv1.GlobalTrafficPolicy{}) @@ -102,7 +104,7 @@ func (c *FakeGlobalTrafficPolicies) Update(globalTrafficPolicy *admiralv1.Global // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeGlobalTrafficPolicies) UpdateStatus(globalTrafficPolicy *admiralv1.GlobalTrafficPolicy) (*admiralv1.GlobalTrafficPolicy, error) { +func (c *FakeGlobalTrafficPolicies) UpdateStatus(ctx context.Context, globalTrafficPolicy *admiralv1.GlobalTrafficPolicy, opts v1.UpdateOptions) (*admiralv1.GlobalTrafficPolicy, error) { obj, err := c.Fake. Invokes(testing.NewUpdateSubresourceAction(globaltrafficpoliciesResource, "status", c.ns, globalTrafficPolicy), &admiralv1.GlobalTrafficPolicy{}) @@ -113,23 +115,23 @@ func (c *FakeGlobalTrafficPolicies) UpdateStatus(globalTrafficPolicy *admiralv1. } // Delete takes name of the globalTrafficPolicy and deletes it. Returns an error if one occurs. -func (c *FakeGlobalTrafficPolicies) Delete(name string, options *v1.DeleteOptions) error { +func (c *FakeGlobalTrafficPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteAction(globaltrafficpoliciesResource, c.ns, name), &admiralv1.GlobalTrafficPolicy{}) + Invokes(testing.NewDeleteActionWithOptions(globaltrafficpoliciesResource, c.ns, name, opts), &admiralv1.GlobalTrafficPolicy{}) return err } // DeleteCollection deletes a collection of objects. -func (c *FakeGlobalTrafficPolicies) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(globaltrafficpoliciesResource, c.ns, listOptions) +func (c *FakeGlobalTrafficPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(globaltrafficpoliciesResource, c.ns, listOpts) _, err := c.Fake.Invokes(action, &admiralv1.GlobalTrafficPolicyList{}) return err } // Patch applies the patch and returns the patched globalTrafficPolicy. -func (c *FakeGlobalTrafficPolicies) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *admiralv1.GlobalTrafficPolicy, err error) { +func (c *FakeGlobalTrafficPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *admiralv1.GlobalTrafficPolicy, err error) { obj, err := c.Fake. Invokes(testing.NewPatchSubresourceAction(globaltrafficpoliciesResource, c.ns, name, pt, data, subresources...), &admiralv1.GlobalTrafficPolicy{}) diff --git a/admiral/pkg/client/clientset/versioned/typed/admiral/v1/fake/fake_routingpolicy.go b/admiral/pkg/client/clientset/versioned/typed/admiral/v1/fake/fake_routingpolicy.go index 8aaa8ad5..e1230875 100644 --- a/admiral/pkg/client/clientset/versioned/typed/admiral/v1/fake/fake_routingpolicy.go +++ b/admiral/pkg/client/clientset/versioned/typed/admiral/v1/fake/fake_routingpolicy.go @@ -19,6 +19,8 @@ limitations under the License. package fake import ( + "context" + admiralv1 "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" @@ -39,7 +41,7 @@ var routingpoliciesResource = schema.GroupVersionResource{Group: "admiral.io", V var routingpoliciesKind = schema.GroupVersionKind{Group: "admiral.io", Version: "v1", Kind: "RoutingPolicy"} // Get takes name of the routingPolicy, and returns the corresponding routingPolicy object, and an error if there is any. -func (c *FakeRoutingPolicies) Get(name string, options v1.GetOptions) (result *admiralv1.RoutingPolicy, err error) { +func (c *FakeRoutingPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *admiralv1.RoutingPolicy, err error) { obj, err := c.Fake. Invokes(testing.NewGetAction(routingpoliciesResource, c.ns, name), &admiralv1.RoutingPolicy{}) @@ -50,7 +52,7 @@ func (c *FakeRoutingPolicies) Get(name string, options v1.GetOptions) (result *a } // List takes label and field selectors, and returns the list of RoutingPolicies that match those selectors. -func (c *FakeRoutingPolicies) List(opts v1.ListOptions) (result *admiralv1.RoutingPolicyList, err error) { +func (c *FakeRoutingPolicies) List(ctx context.Context, opts v1.ListOptions) (result *admiralv1.RoutingPolicyList, err error) { obj, err := c.Fake. Invokes(testing.NewListAction(routingpoliciesResource, routingpoliciesKind, c.ns, opts), &admiralv1.RoutingPolicyList{}) @@ -72,14 +74,14 @@ func (c *FakeRoutingPolicies) List(opts v1.ListOptions) (result *admiralv1.Routi } // Watch returns a watch.Interface that watches the requested routingPolicies. -func (c *FakeRoutingPolicies) Watch(opts v1.ListOptions) (watch.Interface, error) { +func (c *FakeRoutingPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. InvokesWatch(testing.NewWatchAction(routingpoliciesResource, c.ns, opts)) } // Create takes the representation of a routingPolicy and creates it. Returns the server's representation of the routingPolicy, and an error, if there is any. -func (c *FakeRoutingPolicies) Create(routingPolicy *admiralv1.RoutingPolicy) (result *admiralv1.RoutingPolicy, err error) { +func (c *FakeRoutingPolicies) Create(ctx context.Context, routingPolicy *admiralv1.RoutingPolicy, opts v1.CreateOptions) (result *admiralv1.RoutingPolicy, err error) { obj, err := c.Fake. Invokes(testing.NewCreateAction(routingpoliciesResource, c.ns, routingPolicy), &admiralv1.RoutingPolicy{}) @@ -90,7 +92,7 @@ func (c *FakeRoutingPolicies) Create(routingPolicy *admiralv1.RoutingPolicy) (re } // Update takes the representation of a routingPolicy and updates it. Returns the server's representation of the routingPolicy, and an error, if there is any. -func (c *FakeRoutingPolicies) Update(routingPolicy *admiralv1.RoutingPolicy) (result *admiralv1.RoutingPolicy, err error) { +func (c *FakeRoutingPolicies) Update(ctx context.Context, routingPolicy *admiralv1.RoutingPolicy, opts v1.UpdateOptions) (result *admiralv1.RoutingPolicy, err error) { obj, err := c.Fake. Invokes(testing.NewUpdateAction(routingpoliciesResource, c.ns, routingPolicy), &admiralv1.RoutingPolicy{}) @@ -102,7 +104,7 @@ func (c *FakeRoutingPolicies) Update(routingPolicy *admiralv1.RoutingPolicy) (re // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeRoutingPolicies) UpdateStatus(routingPolicy *admiralv1.RoutingPolicy) (*admiralv1.RoutingPolicy, error) { +func (c *FakeRoutingPolicies) UpdateStatus(ctx context.Context, routingPolicy *admiralv1.RoutingPolicy, opts v1.UpdateOptions) (*admiralv1.RoutingPolicy, error) { obj, err := c.Fake. Invokes(testing.NewUpdateSubresourceAction(routingpoliciesResource, "status", c.ns, routingPolicy), &admiralv1.RoutingPolicy{}) @@ -113,23 +115,23 @@ func (c *FakeRoutingPolicies) UpdateStatus(routingPolicy *admiralv1.RoutingPolic } // Delete takes name of the routingPolicy and deletes it. Returns an error if one occurs. -func (c *FakeRoutingPolicies) Delete(name string, options *v1.DeleteOptions) error { +func (c *FakeRoutingPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteAction(routingpoliciesResource, c.ns, name), &admiralv1.RoutingPolicy{}) + Invokes(testing.NewDeleteActionWithOptions(routingpoliciesResource, c.ns, name, opts), &admiralv1.RoutingPolicy{}) return err } // DeleteCollection deletes a collection of objects. -func (c *FakeRoutingPolicies) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(routingpoliciesResource, c.ns, listOptions) +func (c *FakeRoutingPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(routingpoliciesResource, c.ns, listOpts) _, err := c.Fake.Invokes(action, &admiralv1.RoutingPolicyList{}) return err } // Patch applies the patch and returns the patched routingPolicy. -func (c *FakeRoutingPolicies) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *admiralv1.RoutingPolicy, err error) { +func (c *FakeRoutingPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *admiralv1.RoutingPolicy, err error) { obj, err := c.Fake. Invokes(testing.NewPatchSubresourceAction(routingpoliciesResource, c.ns, name, pt, data, subresources...), &admiralv1.RoutingPolicy{}) diff --git a/admiral/pkg/client/clientset/versioned/typed/admiral/v1/globaltrafficpolicy.go b/admiral/pkg/client/clientset/versioned/typed/admiral/v1/globaltrafficpolicy.go index 2357a231..b3f430a9 100644 --- a/admiral/pkg/client/clientset/versioned/typed/admiral/v1/globaltrafficpolicy.go +++ b/admiral/pkg/client/clientset/versioned/typed/admiral/v1/globaltrafficpolicy.go @@ -19,6 +19,7 @@ limitations under the License. package v1 import ( + "context" "time" v1 "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/v1" @@ -37,15 +38,15 @@ type GlobalTrafficPoliciesGetter interface { // GlobalTrafficPolicyInterface has methods to work with GlobalTrafficPolicy resources. type GlobalTrafficPolicyInterface interface { - Create(*v1.GlobalTrafficPolicy) (*v1.GlobalTrafficPolicy, error) - Update(*v1.GlobalTrafficPolicy) (*v1.GlobalTrafficPolicy, error) - UpdateStatus(*v1.GlobalTrafficPolicy) (*v1.GlobalTrafficPolicy, error) - Delete(name string, options *metav1.DeleteOptions) error - DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error - Get(name string, options metav1.GetOptions) (*v1.GlobalTrafficPolicy, error) - List(opts metav1.ListOptions) (*v1.GlobalTrafficPolicyList, error) - Watch(opts metav1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.GlobalTrafficPolicy, err error) + Create(ctx context.Context, globalTrafficPolicy *v1.GlobalTrafficPolicy, opts metav1.CreateOptions) (*v1.GlobalTrafficPolicy, error) + Update(ctx context.Context, globalTrafficPolicy *v1.GlobalTrafficPolicy, opts metav1.UpdateOptions) (*v1.GlobalTrafficPolicy, error) + UpdateStatus(ctx context.Context, globalTrafficPolicy *v1.GlobalTrafficPolicy, opts metav1.UpdateOptions) (*v1.GlobalTrafficPolicy, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.GlobalTrafficPolicy, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.GlobalTrafficPolicyList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.GlobalTrafficPolicy, err error) GlobalTrafficPolicyExpansion } @@ -64,20 +65,20 @@ func newGlobalTrafficPolicies(c *AdmiralV1Client, namespace string) *globalTraff } // Get takes name of the globalTrafficPolicy, and returns the corresponding globalTrafficPolicy object, and an error if there is any. -func (c *globalTrafficPolicies) Get(name string, options metav1.GetOptions) (result *v1.GlobalTrafficPolicy, err error) { +func (c *globalTrafficPolicies) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.GlobalTrafficPolicy, err error) { result = &v1.GlobalTrafficPolicy{} err = c.client.Get(). Namespace(c.ns). Resource("globaltrafficpolicies"). Name(name). VersionedParams(&options, scheme.ParameterCodec). - Do(). + Do(ctx). Into(result) return } // List takes label and field selectors, and returns the list of GlobalTrafficPolicies that match those selectors. -func (c *globalTrafficPolicies) List(opts metav1.ListOptions) (result *v1.GlobalTrafficPolicyList, err error) { +func (c *globalTrafficPolicies) List(ctx context.Context, opts metav1.ListOptions) (result *v1.GlobalTrafficPolicyList, err error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second @@ -88,13 +89,13 @@ func (c *globalTrafficPolicies) List(opts metav1.ListOptions) (result *v1.Global Resource("globaltrafficpolicies"). VersionedParams(&opts, scheme.ParameterCodec). Timeout(timeout). - Do(). + Do(ctx). Into(result) return } // Watch returns a watch.Interface that watches the requested globalTrafficPolicies. -func (c *globalTrafficPolicies) Watch(opts metav1.ListOptions) (watch.Interface, error) { +func (c *globalTrafficPolicies) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second @@ -105,87 +106,90 @@ func (c *globalTrafficPolicies) Watch(opts metav1.ListOptions) (watch.Interface, Resource("globaltrafficpolicies"). VersionedParams(&opts, scheme.ParameterCodec). Timeout(timeout). - Watch() + Watch(ctx) } // Create takes the representation of a globalTrafficPolicy and creates it. Returns the server's representation of the globalTrafficPolicy, and an error, if there is any. -func (c *globalTrafficPolicies) Create(globalTrafficPolicy *v1.GlobalTrafficPolicy) (result *v1.GlobalTrafficPolicy, err error) { +func (c *globalTrafficPolicies) Create(ctx context.Context, globalTrafficPolicy *v1.GlobalTrafficPolicy, opts metav1.CreateOptions) (result *v1.GlobalTrafficPolicy, err error) { result = &v1.GlobalTrafficPolicy{} err = c.client.Post(). Namespace(c.ns). Resource("globaltrafficpolicies"). + VersionedParams(&opts, scheme.ParameterCodec). Body(globalTrafficPolicy). - Do(). + Do(ctx). Into(result) return } // Update takes the representation of a globalTrafficPolicy and updates it. Returns the server's representation of the globalTrafficPolicy, and an error, if there is any. -func (c *globalTrafficPolicies) Update(globalTrafficPolicy *v1.GlobalTrafficPolicy) (result *v1.GlobalTrafficPolicy, err error) { +func (c *globalTrafficPolicies) Update(ctx context.Context, globalTrafficPolicy *v1.GlobalTrafficPolicy, opts metav1.UpdateOptions) (result *v1.GlobalTrafficPolicy, err error) { result = &v1.GlobalTrafficPolicy{} err = c.client.Put(). Namespace(c.ns). Resource("globaltrafficpolicies"). Name(globalTrafficPolicy.Name). + VersionedParams(&opts, scheme.ParameterCodec). Body(globalTrafficPolicy). - Do(). + Do(ctx). Into(result) return } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). - -func (c *globalTrafficPolicies) UpdateStatus(globalTrafficPolicy *v1.GlobalTrafficPolicy) (result *v1.GlobalTrafficPolicy, err error) { +func (c *globalTrafficPolicies) UpdateStatus(ctx context.Context, globalTrafficPolicy *v1.GlobalTrafficPolicy, opts metav1.UpdateOptions) (result *v1.GlobalTrafficPolicy, err error) { result = &v1.GlobalTrafficPolicy{} err = c.client.Put(). Namespace(c.ns). Resource("globaltrafficpolicies"). Name(globalTrafficPolicy.Name). SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). Body(globalTrafficPolicy). - Do(). + Do(ctx). Into(result) return } // Delete takes name of the globalTrafficPolicy and deletes it. Returns an error if one occurs. -func (c *globalTrafficPolicies) Delete(name string, options *metav1.DeleteOptions) error { +func (c *globalTrafficPolicies) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { return c.client.Delete(). Namespace(c.ns). Resource("globaltrafficpolicies"). Name(name). - Body(options). - Do(). + Body(&opts). + Do(ctx). Error() } // DeleteCollection deletes a collection of objects. -func (c *globalTrafficPolicies) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error { +func (c *globalTrafficPolicies) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { var timeout time.Duration - if listOptions.TimeoutSeconds != nil { - timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second } return c.client.Delete(). Namespace(c.ns). Resource("globaltrafficpolicies"). - VersionedParams(&listOptions, scheme.ParameterCodec). + VersionedParams(&listOpts, scheme.ParameterCodec). Timeout(timeout). - Body(options). - Do(). + Body(&opts). + Do(ctx). Error() } // Patch applies the patch and returns the patched globalTrafficPolicy. -func (c *globalTrafficPolicies) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.GlobalTrafficPolicy, err error) { +func (c *globalTrafficPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.GlobalTrafficPolicy, err error) { result = &v1.GlobalTrafficPolicy{} err = c.client.Patch(pt). Namespace(c.ns). Resource("globaltrafficpolicies"). - SubResource(subresources...). Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). Body(data). - Do(). + Do(ctx). Into(result) return } diff --git a/admiral/pkg/client/clientset/versioned/typed/admiral/v1/routingpolicy.go b/admiral/pkg/client/clientset/versioned/typed/admiral/v1/routingpolicy.go index 1db4ef8b..a84c923e 100644 --- a/admiral/pkg/client/clientset/versioned/typed/admiral/v1/routingpolicy.go +++ b/admiral/pkg/client/clientset/versioned/typed/admiral/v1/routingpolicy.go @@ -19,6 +19,7 @@ limitations under the License. package v1 import ( + "context" "time" v1 "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/v1" @@ -37,15 +38,15 @@ type RoutingPoliciesGetter interface { // RoutingPolicyInterface has methods to work with RoutingPolicy resources. type RoutingPolicyInterface interface { - Create(*v1.RoutingPolicy) (*v1.RoutingPolicy, error) - Update(*v1.RoutingPolicy) (*v1.RoutingPolicy, error) - UpdateStatus(*v1.RoutingPolicy) (*v1.RoutingPolicy, error) - Delete(name string, options *metav1.DeleteOptions) error - DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error - Get(name string, options metav1.GetOptions) (*v1.RoutingPolicy, error) - List(opts metav1.ListOptions) (*v1.RoutingPolicyList, error) - Watch(opts metav1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.RoutingPolicy, err error) + Create(ctx context.Context, routingPolicy *v1.RoutingPolicy, opts metav1.CreateOptions) (*v1.RoutingPolicy, error) + Update(ctx context.Context, routingPolicy *v1.RoutingPolicy, opts metav1.UpdateOptions) (*v1.RoutingPolicy, error) + UpdateStatus(ctx context.Context, routingPolicy *v1.RoutingPolicy, opts metav1.UpdateOptions) (*v1.RoutingPolicy, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.RoutingPolicy, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.RoutingPolicyList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.RoutingPolicy, err error) RoutingPolicyExpansion } @@ -64,20 +65,20 @@ func newRoutingPolicies(c *AdmiralV1Client, namespace string) *routingPolicies { } // Get takes name of the routingPolicy, and returns the corresponding routingPolicy object, and an error if there is any. -func (c *routingPolicies) Get(name string, options metav1.GetOptions) (result *v1.RoutingPolicy, err error) { +func (c *routingPolicies) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.RoutingPolicy, err error) { result = &v1.RoutingPolicy{} err = c.client.Get(). Namespace(c.ns). Resource("routingpolicies"). Name(name). VersionedParams(&options, scheme.ParameterCodec). - Do(). + Do(ctx). Into(result) return } // List takes label and field selectors, and returns the list of RoutingPolicies that match those selectors. -func (c *routingPolicies) List(opts metav1.ListOptions) (result *v1.RoutingPolicyList, err error) { +func (c *routingPolicies) List(ctx context.Context, opts metav1.ListOptions) (result *v1.RoutingPolicyList, err error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second @@ -88,13 +89,13 @@ func (c *routingPolicies) List(opts metav1.ListOptions) (result *v1.RoutingPolic Resource("routingpolicies"). VersionedParams(&opts, scheme.ParameterCodec). Timeout(timeout). - Do(). + Do(ctx). Into(result) - return result, err + return } // Watch returns a watch.Interface that watches the requested routingPolicies. -func (c *routingPolicies) Watch(opts metav1.ListOptions) (watch.Interface, error) { +func (c *routingPolicies) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second @@ -105,87 +106,90 @@ func (c *routingPolicies) Watch(opts metav1.ListOptions) (watch.Interface, error Resource("routingpolicies"). VersionedParams(&opts, scheme.ParameterCodec). Timeout(timeout). - Watch() + Watch(ctx) } // Create takes the representation of a routingPolicy and creates it. Returns the server's representation of the routingPolicy, and an error, if there is any. -func (c *routingPolicies) Create(routingPolicy *v1.RoutingPolicy) (result *v1.RoutingPolicy, err error) { +func (c *routingPolicies) Create(ctx context.Context, routingPolicy *v1.RoutingPolicy, opts metav1.CreateOptions) (result *v1.RoutingPolicy, err error) { result = &v1.RoutingPolicy{} err = c.client.Post(). Namespace(c.ns). Resource("routingpolicies"). + VersionedParams(&opts, scheme.ParameterCodec). Body(routingPolicy). - Do(). + Do(ctx). Into(result) - return result, err + return } // Update takes the representation of a routingPolicy and updates it. Returns the server's representation of the routingPolicy, and an error, if there is any. -func (c *routingPolicies) Update(routingPolicy *v1.RoutingPolicy) (result *v1.RoutingPolicy, err error) { +func (c *routingPolicies) Update(ctx context.Context, routingPolicy *v1.RoutingPolicy, opts metav1.UpdateOptions) (result *v1.RoutingPolicy, err error) { result = &v1.RoutingPolicy{} err = c.client.Put(). Namespace(c.ns). Resource("routingpolicies"). Name(routingPolicy.Name). + VersionedParams(&opts, scheme.ParameterCodec). Body(routingPolicy). - Do(). + Do(ctx). Into(result) - return result, err + return } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). - -func (c *routingPolicies) UpdateStatus(routingPolicy *v1.RoutingPolicy) (result *v1.RoutingPolicy, err error) { +func (c *routingPolicies) UpdateStatus(ctx context.Context, routingPolicy *v1.RoutingPolicy, opts metav1.UpdateOptions) (result *v1.RoutingPolicy, err error) { result = &v1.RoutingPolicy{} err = c.client.Put(). Namespace(c.ns). Resource("routingpolicies"). Name(routingPolicy.Name). SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). Body(routingPolicy). - Do(). + Do(ctx). Into(result) - return result, err + return } // Delete takes name of the routingPolicy and deletes it. Returns an error if one occurs. -func (c *routingPolicies) Delete(name string, options *metav1.DeleteOptions) error { +func (c *routingPolicies) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { return c.client.Delete(). Namespace(c.ns). Resource("routingpolicies"). Name(name). - Body(options). - Do(). + Body(&opts). + Do(ctx). Error() } // DeleteCollection deletes a collection of objects. -func (c *routingPolicies) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error { +func (c *routingPolicies) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { var timeout time.Duration - if listOptions.TimeoutSeconds != nil { - timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second } return c.client.Delete(). Namespace(c.ns). Resource("routingpolicies"). - VersionedParams(&listOptions, scheme.ParameterCodec). + VersionedParams(&listOpts, scheme.ParameterCodec). Timeout(timeout). - Body(options). - Do(). + Body(&opts). + Do(ctx). Error() } // Patch applies the patch and returns the patched routingPolicy. -func (c *routingPolicies) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.RoutingPolicy, err error) { +func (c *routingPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.RoutingPolicy, err error) { result = &v1.RoutingPolicy{} err = c.client.Patch(pt). Namespace(c.ns). Resource("routingpolicies"). - SubResource(subresources...). Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). Body(data). - Do(). + Do(ctx). Into(result) - return result, err + return } diff --git a/admiral/pkg/client/informers/externalversions/admiral/v1/dependency.go b/admiral/pkg/client/informers/externalversions/admiral/v1/dependency.go index fe86c2c7..75a3f41e 100644 --- a/admiral/pkg/client/informers/externalversions/admiral/v1/dependency.go +++ b/admiral/pkg/client/informers/externalversions/admiral/v1/dependency.go @@ -19,6 +19,7 @@ limitations under the License. package v1 import ( + "context" time "time" admiralv1 "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/v1" @@ -61,13 +62,13 @@ func NewFilteredDependencyInformer(client versioned.Interface, namespace string, if tweakListOptions != nil { tweakListOptions(&options) } - return client.AdmiralV1().Dependencies(namespace).List(options) + return client.AdmiralV1().Dependencies(namespace).List(context.TODO(), options) }, WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.AdmiralV1().Dependencies(namespace).Watch(options) + return client.AdmiralV1().Dependencies(namespace).Watch(context.TODO(), options) }, }, &admiralv1.Dependency{}, diff --git a/admiral/pkg/client/informers/externalversions/admiral/v1/globaltrafficpolicy.go b/admiral/pkg/client/informers/externalversions/admiral/v1/globaltrafficpolicy.go index 70334a04..54f8bb6e 100644 --- a/admiral/pkg/client/informers/externalversions/admiral/v1/globaltrafficpolicy.go +++ b/admiral/pkg/client/informers/externalversions/admiral/v1/globaltrafficpolicy.go @@ -19,6 +19,7 @@ limitations under the License. package v1 import ( + "context" time "time" admiralv1 "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/v1" @@ -61,13 +62,13 @@ func NewFilteredGlobalTrafficPolicyInformer(client versioned.Interface, namespac if tweakListOptions != nil { tweakListOptions(&options) } - return client.AdmiralV1().GlobalTrafficPolicies(namespace).List(options) + return client.AdmiralV1().GlobalTrafficPolicies(namespace).List(context.TODO(), options) }, WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.AdmiralV1().GlobalTrafficPolicies(namespace).Watch(options) + return client.AdmiralV1().GlobalTrafficPolicies(namespace).Watch(context.TODO(), options) }, }, &admiralv1.GlobalTrafficPolicy{}, diff --git a/admiral/pkg/client/informers/externalversions/admiral/v1/routingpolicy.go b/admiral/pkg/client/informers/externalversions/admiral/v1/routingpolicy.go index 0d54f5a9..a7f2fb1b 100644 --- a/admiral/pkg/client/informers/externalversions/admiral/v1/routingpolicy.go +++ b/admiral/pkg/client/informers/externalversions/admiral/v1/routingpolicy.go @@ -19,6 +19,7 @@ limitations under the License. package v1 import ( + "context" time "time" admiralv1 "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/v1" @@ -61,13 +62,13 @@ func NewFilteredRoutingPolicyInformer(client versioned.Interface, namespace stri if tweakListOptions != nil { tweakListOptions(&options) } - return client.AdmiralV1().RoutingPolicies(namespace).List(options) + return client.AdmiralV1().RoutingPolicies(namespace).List(context.TODO(), options) }, WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.AdmiralV1().RoutingPolicies(namespace).Watch(options) + return client.AdmiralV1().RoutingPolicies(namespace).Watch(context.TODO(), options) }, }, &admiralv1.RoutingPolicy{}, diff --git a/admiral/pkg/client/listers/admiral/v1/dependency.go b/admiral/pkg/client/listers/admiral/v1/dependency.go index 18ad358d..406d0284 100644 --- a/admiral/pkg/client/listers/admiral/v1/dependency.go +++ b/admiral/pkg/client/listers/admiral/v1/dependency.go @@ -26,8 +26,10 @@ import ( ) // DependencyLister helps list Dependencies. +// All objects returned here must be treated as read-only. type DependencyLister interface { // List lists all Dependencies in the indexer. + // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*v1.Dependency, err error) // Dependencies returns an object that can list and get Dependencies. Dependencies(namespace string) DependencyNamespaceLister @@ -58,10 +60,13 @@ func (s *dependencyLister) Dependencies(namespace string) DependencyNamespaceLis } // DependencyNamespaceLister helps list and get Dependencies. +// All objects returned here must be treated as read-only. type DependencyNamespaceLister interface { // List lists all Dependencies in the indexer for a given namespace. + // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*v1.Dependency, err error) // Get retrieves the Dependency from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. Get(name string) (*v1.Dependency, error) DependencyNamespaceListerExpansion } diff --git a/admiral/pkg/client/listers/admiral/v1/globaltrafficpolicy.go b/admiral/pkg/client/listers/admiral/v1/globaltrafficpolicy.go index 8c4060ba..d982afe4 100644 --- a/admiral/pkg/client/listers/admiral/v1/globaltrafficpolicy.go +++ b/admiral/pkg/client/listers/admiral/v1/globaltrafficpolicy.go @@ -26,8 +26,10 @@ import ( ) // GlobalTrafficPolicyLister helps list GlobalTrafficPolicies. +// All objects returned here must be treated as read-only. type GlobalTrafficPolicyLister interface { // List lists all GlobalTrafficPolicies in the indexer. + // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*v1.GlobalTrafficPolicy, err error) // GlobalTrafficPolicies returns an object that can list and get GlobalTrafficPolicies. GlobalTrafficPolicies(namespace string) GlobalTrafficPolicyNamespaceLister @@ -58,10 +60,13 @@ func (s *globalTrafficPolicyLister) GlobalTrafficPolicies(namespace string) Glob } // GlobalTrafficPolicyNamespaceLister helps list and get GlobalTrafficPolicies. +// All objects returned here must be treated as read-only. type GlobalTrafficPolicyNamespaceLister interface { // List lists all GlobalTrafficPolicies in the indexer for a given namespace. + // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*v1.GlobalTrafficPolicy, err error) // Get retrieves the GlobalTrafficPolicy from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. Get(name string) (*v1.GlobalTrafficPolicy, error) GlobalTrafficPolicyNamespaceListerExpansion } diff --git a/admiral/pkg/client/listers/admiral/v1/routingpolicy.go b/admiral/pkg/client/listers/admiral/v1/routingpolicy.go index a986b99e..33a066af 100644 --- a/admiral/pkg/client/listers/admiral/v1/routingpolicy.go +++ b/admiral/pkg/client/listers/admiral/v1/routingpolicy.go @@ -26,8 +26,10 @@ import ( ) // RoutingPolicyLister helps list RoutingPolicies. +// All objects returned here must be treated as read-only. type RoutingPolicyLister interface { // List lists all RoutingPolicies in the indexer. + // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*v1.RoutingPolicy, err error) // RoutingPolicies returns an object that can list and get RoutingPolicies. RoutingPolicies(namespace string) RoutingPolicyNamespaceLister @@ -58,10 +60,13 @@ func (s *routingPolicyLister) RoutingPolicies(namespace string) RoutingPolicyNam } // RoutingPolicyNamespaceLister helps list and get RoutingPolicies. +// All objects returned here must be treated as read-only. type RoutingPolicyNamespaceLister interface { // List lists all RoutingPolicies in the indexer for a given namespace. + // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*v1.RoutingPolicy, err error) // Get retrieves the RoutingPolicy from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. Get(name string) (*v1.RoutingPolicy, error) RoutingPolicyNamespaceListerExpansion } diff --git a/admiral/pkg/clusters/envoyfilter.go b/admiral/pkg/clusters/envoyfilter.go index 186748ed..d3b5f2c2 100644 --- a/admiral/pkg/clusters/envoyfilter.go +++ b/admiral/pkg/clusters/envoyfilter.go @@ -1,9 +1,12 @@ package clusters import ( + "context" "errors" "fmt" - "github.com/gogo/protobuf/types" + "strings" + + structpb "github.com/golang/protobuf/ptypes/struct" v1 "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/v1" "github.com/istio-ecosystem/admiral/admiral/pkg/controller/admiral" "github.com/istio-ecosystem/admiral/admiral/pkg/controller/common" @@ -11,19 +14,19 @@ import ( "istio.io/api/networking/v1alpha3" networking "istio.io/client-go/pkg/apis/networking/v1alpha3" metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "strings" ) var ( getSha1 = common.GetSha1 ) + const hostsKey = "hosts: " -func createOrUpdateEnvoyFilter( rc *RemoteController, routingPolicy *v1.RoutingPolicy, eventType admiral.EventType, workloadIdentityKey string, admiralCache *AdmiralCache, workloadSelectorMap map[string]string) (*networking.EnvoyFilter, error) { +func createOrUpdateEnvoyFilter(ctx context.Context, rc *RemoteController, routingPolicy *v1.RoutingPolicy, eventType admiral.EventType, workloadIdentityKey string, admiralCache *AdmiralCache, workloadSelectorMap map[string]string) (*networking.EnvoyFilter, error) { envoyfilterSpec := constructEnvoyFilterStruct(routingPolicy, workloadSelectorMap) - selectorLabelsSha, err := getSha1(workloadIdentityKey+common.GetRoutingPolicyEnv(routingPolicy)) + selectorLabelsSha, err := getSha1(workloadIdentityKey + common.GetRoutingPolicyEnv(routingPolicy)) if err != nil { log.Error("error ocurred while computing workload labels sha1") return nil, err @@ -42,6 +45,7 @@ func createOrUpdateEnvoyFilter( rc *RemoteController, routingPolicy *v1.RoutingP Name: envoyFilterName, Namespace: common.NamespaceIstioSystem, }, + //nolint Spec: *envoyfilterSpec, } @@ -50,21 +54,23 @@ func createOrUpdateEnvoyFilter( rc *RemoteController, routingPolicy *v1.RoutingP //get the envoyfilter if it exists. If it exists, update it. Otherwise create it. if eventType == admiral.Add || eventType == admiral.Update { // We query the API server instead of getting it from cache because there could be potential condition where the filter exists in the cache but not on the cluster. - filter, err = rc.RoutingPolicyController.IstioClient.NetworkingV1alpha3().EnvoyFilters(common.NamespaceIstioSystem).Get(envoyFilterName, metaV1.GetOptions{}) + filter, err = rc.RoutingPolicyController.IstioClient.NetworkingV1alpha3(). + EnvoyFilters(common.NamespaceIstioSystem).Get(ctx, envoyFilterName, metaV1.GetOptions{}) if err != nil { log.Infof("msg=%s filtername=%s clustername=%s", "creating the envoy filter", envoyFilterName, rc.ClusterID) - filter, err = rc.RoutingPolicyController.IstioClient.NetworkingV1alpha3().EnvoyFilters(common.NamespaceIstioSystem).Create(envoyfilter) + filter, err = rc.RoutingPolicyController.IstioClient.NetworkingV1alpha3(). + EnvoyFilters(common.NamespaceIstioSystem).Create(ctx, envoyfilter, metaV1.CreateOptions{}) if err != nil { log.Infof("error creating filter: %v", err) } } else { log.Infof("msg=%s filtername=%s clustername=%s", "updating existing envoy filter", envoyFilterName, rc.ClusterID) envoyfilter.ResourceVersion = filter.ResourceVersion - filter, err = rc.RoutingPolicyController.IstioClient.NetworkingV1alpha3().EnvoyFilters(common.NamespaceIstioSystem).Update(envoyfilter) + filter, err = rc.RoutingPolicyController.IstioClient.NetworkingV1alpha3(). + EnvoyFilters(common.NamespaceIstioSystem).Update(ctx, envoyfilter, metaV1.UpdateOptions{}) } } - return filter, err } @@ -78,38 +84,37 @@ func constructEnvoyFilterStruct(routingPolicy *v1.RoutingPolicy, workloadSelecto } envoyFilterStringConfig += fmt.Sprintf("%s: %s\n", key, val) } - if len(common.GetEnvoyFilterAdditionalConfig()) !=0 { - envoyFilterStringConfig += common.GetEnvoyFilterAdditionalConfig()+"\n" + if len(common.GetEnvoyFilterAdditionalConfig()) != 0 { + envoyFilterStringConfig += common.GetEnvoyFilterAdditionalConfig() + "\n" } envoyFilterStringConfig += getHosts(routingPolicy) - configuration := types.Struct{ - Fields: map[string]*types.Value{ - "@type": {Kind: &types.Value_StringValue{StringValue: "type.googleapis.com/google.protobuf.StringValue"}}, - "value": {Kind: &types.Value_StringValue{StringValue: envoyFilterStringConfig}}, + configuration := structpb.Struct{ + Fields: map[string]*structpb.Value{ + "@type": {Kind: &structpb.Value_StringValue{StringValue: "type.googleapis.com/google.protobuf.StringValue"}}, + "value": {Kind: &structpb.Value_StringValue{StringValue: envoyFilterStringConfig}}, }, } - - vmConfig := types.Struct{ - Fields: map[string]*types.Value{ - "runtime": {Kind: &types.Value_StringValue{StringValue: "envoy.wasm.runtime.v8"}}, - "code": {Kind: &types.Value_StructValue{StructValue: &types.Struct{Fields: map[string]*types.Value{ - "local": {Kind: &types.Value_StructValue{StructValue: &types.Struct{Fields: map[string]*types.Value{ - "filename": {Kind: &types.Value_StringValue{StringValue: wasmPath}}, + vmConfig := structpb.Struct{ + Fields: map[string]*structpb.Value{ + "runtime": {Kind: &structpb.Value_StringValue{StringValue: "envoy.wasm.runtime.v8"}}, + "code": {Kind: &structpb.Value_StructValue{StructValue: &structpb.Struct{Fields: map[string]*structpb.Value{ + "local": {Kind: &structpb.Value_StructValue{StructValue: &structpb.Struct{Fields: map[string]*structpb.Value{ + "filename": {Kind: &structpb.Value_StringValue{StringValue: wasmPath}}, }}}}, }}}}, }, } - typedConfigValue := types.Struct{ - Fields: map[string]*types.Value{ + typedConfigValue := structpb.Struct{ + Fields: map[string]*structpb.Value{ "config": { - Kind: &types.Value_StructValue{ - StructValue: &types.Struct{ - Fields: map[string]*types.Value{ - "configuration": {Kind: &types.Value_StructValue{StructValue: &configuration}}, - "vm_config": {Kind: &types.Value_StructValue{StructValue: &vmConfig}}, + Kind: &structpb.Value_StructValue{ + StructValue: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "configuration": {Kind: &structpb.Value_StructValue{StructValue: &configuration}}, + "vm_config": {Kind: &structpb.Value_StructValue{StructValue: &vmConfig}}, }, }, }, @@ -117,11 +122,11 @@ func constructEnvoyFilterStruct(routingPolicy *v1.RoutingPolicy, workloadSelecto }, } - typedConfig := types.Struct{ - Fields: map[string]*types.Value{ - "@type": {Kind: &types.Value_StringValue{StringValue: "type.googleapis.com/udpa.type.v1.TypedStruct"}}, - "type_url": {Kind: &types.Value_StringValue{StringValue: "type.googleapis.com/envoy.extensions.filters.http.wasm.v3.Wasm"}}, - "value": {Kind: &types.Value_StructValue{StructValue: &typedConfigValue}}, + typedConfig := &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "@type": {Kind: &structpb.Value_StringValue{StringValue: "type.googleapis.com/udpa.type.v1.TypedStruct"}}, + "type_url": {Kind: &structpb.Value_StringValue{StringValue: "type.googleapis.com/envoy.extensions.filters.http.wasm.v3.Wasm"}}, + "value": {Kind: &structpb.Value_StructValue{StructValue: &typedConfigValue}}, }, } @@ -129,7 +134,7 @@ func constructEnvoyFilterStruct(routingPolicy *v1.RoutingPolicy, workloadSelecto return envoyfilterSpec } -func getEnvoyFilterSpec(workloadSelectorLabels map[string]string, typedConfig types.Struct) *v1alpha3.EnvoyFilter { +func getEnvoyFilterSpec(workloadSelectorLabels map[string]string, typedConfig *structpb.Struct) *v1alpha3.EnvoyFilter { return &v1alpha3.EnvoyFilter{ WorkloadSelector: &v1alpha3.WorkloadSelector{Labels: workloadSelectorLabels}, @@ -139,7 +144,7 @@ func getEnvoyFilterSpec(workloadSelectorLabels map[string]string, typedConfig ty Match: &v1alpha3.EnvoyFilter_EnvoyConfigObjectMatch{ Context: v1alpha3.EnvoyFilter_SIDECAR_OUTBOUND, // TODO: Figure out the possibility of using this for istio version upgrades. Can we add multiple filters with different proxy version Match here? - Proxy: &v1alpha3.EnvoyFilter_ProxyMatch{ProxyVersion: "^"+strings.ReplaceAll(common.GetEnvoyFilterVersion(),".","\\.")+".*"}, + Proxy: &v1alpha3.EnvoyFilter_ProxyMatch{ProxyVersion: "^" + strings.ReplaceAll(common.GetEnvoyFilterVersion(), ".", "\\.") + ".*"}, ObjectTypes: &v1alpha3.EnvoyFilter_EnvoyConfigObjectMatch_Listener{ Listener: &v1alpha3.EnvoyFilter_ListenerMatch{ FilterChain: &v1alpha3.EnvoyFilter_ListenerMatch_FilterChainMatch{ @@ -155,13 +160,12 @@ func getEnvoyFilterSpec(workloadSelectorLabels map[string]string, typedConfig ty }, Patch: &v1alpha3.EnvoyFilter_Patch{ Operation: v1alpha3.EnvoyFilter_Patch_INSERT_BEFORE, - //https://pkg.go.dev/github.com/gogo/protobuf/types#Value - Value: &types.Struct{ - Fields: map[string]*types.Value{ - "name": {Kind: &types.Value_StringValue{StringValue: "dynamicRoutingFilterPatch"}}, + Value: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "name": {Kind: &structpb.Value_StringValue{StringValue: "dynamicRoutingFilterPatch"}}, "typed_config": { - Kind: &types.Value_StructValue{ - StructValue: &typedConfig, + Kind: &structpb.Value_StructValue{ + StructValue: typedConfig, }, }, }, @@ -177,7 +181,6 @@ func getHosts(routingPolicy *v1.RoutingPolicy) string { for _, host := range routingPolicy.Spec.Hosts { hosts += host + "," } - hosts = strings.TrimSuffix(hosts,",") + hosts = strings.TrimSuffix(hosts, ",") return hostsKey + hosts } - diff --git a/admiral/pkg/clusters/envoyfilter_test.go b/admiral/pkg/clusters/envoyfilter_test.go index f4a44fa8..4737062a 100644 --- a/admiral/pkg/clusters/envoyfilter_test.go +++ b/admiral/pkg/clusters/envoyfilter_test.go @@ -3,6 +3,10 @@ package clusters import ( "context" "errors" + "sync" + "testing" + "time" + "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/model" v1 "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/v1" "github.com/istio-ecosystem/admiral/admiral/pkg/controller/admiral" @@ -13,9 +17,6 @@ import ( time2 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" testing2 "k8s.io/client-go/testing" - "sync" - "testing" - "time" ) func TestCreateOrUpdateEnvoyFilter(t *testing.T) { @@ -59,88 +60,87 @@ func TestCreateOrUpdateEnvoyFilter(t *testing.T) { registry.AdmiralCache.IdentityDependencyCache.Put("foo", "bar", "bar") registry.AdmiralCache.IdentityClusterCache.Put("bar", remoteController.ClusterID, remoteController.ClusterID) - handler.RemoteRegistry = registry routingPolicyFoo := &v1.RoutingPolicy{ - TypeMeta: time2.TypeMeta{}, + TypeMeta: time2.TypeMeta{}, ObjectMeta: time2.ObjectMeta{ Labels: map[string]string{ - "identity": "foo", + "identity": "foo", "admiral.io/env": "stage", }, }, - Spec: model.RoutingPolicy{ - Plugin: "test", - Hosts: []string{"e2e.testservice.mesh"}, + Spec: model.RoutingPolicy{ + Plugin: "test", + Hosts: []string{"e2e.testservice.mesh"}, Config: map[string]string{ - "cachePrefix": "cache-v1", - "cachettlSec": "86400", + "cachePrefix": "cache-v1", + "cachettlSec": "86400", "routingServiceUrl": "e2e.test.routing.service.mesh", - "pathPrefix": "/sayhello,/v1/company/{id}/", + "pathPrefix": "/sayhello,/v1/company/{id}/", }, }, - Status: v1.RoutingPolicyStatus{}, + Status: v1.RoutingPolicyStatus{}, } - selectors := map[string]string{"one":"test1", "two":"test2"} + selectors := map[string]string{"one": "test1", "two": "test2"} getSha1 = getSha1Error - envoyfilter, err := createOrUpdateEnvoyFilter(remoteController, routingPolicyFoo, admiral.Add, "barstage", registry.AdmiralCache, selectors) + ctx := context.Background() + + envoyfilter, err := createOrUpdateEnvoyFilter(ctx, remoteController, routingPolicyFoo, admiral.Add, "barstage", registry.AdmiralCache, selectors) assert.NotNil(t, err) assert.Nil(t, envoyfilter) getSha1 = common.GetSha1 - envoyfilter, err = createOrUpdateEnvoyFilter(remoteController, routingPolicyFoo, admiral.Add, "bar", registry.AdmiralCache, selectors) + envoyfilter, err = createOrUpdateEnvoyFilter(ctx, remoteController, routingPolicyFoo, admiral.Add, "bar", registry.AdmiralCache, selectors) assert.Equal(t, "test1", envoyfilter.Spec.WorkloadSelector.GetLabels()["one"]) assert.Equal(t, "test2", envoyfilter.Spec.WorkloadSelector.GetLabels()["two"]) assert.Equal(t, "test-dynamicrouting-d0fdd-1.13", envoyfilter.Name) - envoyfilter, err = createOrUpdateEnvoyFilter(remoteController, routingPolicyFoo, admiral.Update, "bar", registry.AdmiralCache, selectors) + envoyfilter, err = createOrUpdateEnvoyFilter(ctx, remoteController, routingPolicyFoo, admiral.Update, "bar", registry.AdmiralCache, selectors) assert.Nil(t, err) - remoteController.RoutingPolicyController.IstioClient.NetworkingV1alpha3().(*fake.FakeNetworkingV1alpha3).PrependReactor("create", "envoyfilters", func(action testing2.Action) (handled bool, ret runtime.Object, err error) { return true, nil, errors.New("error creating envoyfilter") }, ) - envoyfilter3, err := createOrUpdateEnvoyFilter(remoteController, routingPolicyFoo, admiral.Add, "bar2", registry.AdmiralCache, selectors) + envoyfilter3, err := createOrUpdateEnvoyFilter(ctx, remoteController, routingPolicyFoo, admiral.Add, "bar2", registry.AdmiralCache, selectors) assert.NotNil(t, err) assert.Nil(t, envoyfilter3) - } -func getSha1Error (key interface{}) (string, error) { +func getSha1Error(key interface{}) (string, error) { return "", errors.New("error occured while computing the sha") } func TestGetHosts(t *testing.T) { routingPolicyFoo := &v1.RoutingPolicy{ - TypeMeta: time2.TypeMeta{}, + TypeMeta: time2.TypeMeta{}, ObjectMeta: time2.ObjectMeta{ Labels: map[string]string{ - "identity": "foo", + "identity": "foo", "admiral.io/env": "stage", }, }, - Spec: model.RoutingPolicy{ - Plugin: "test", - Hosts: []string{"e2e.testservice.mesh,e2e2.testservice.mesh"}, + Spec: model.RoutingPolicy{ + Plugin: "test", + Hosts: []string{"e2e.testservice.mesh,e2e2.testservice.mesh"}, Config: map[string]string{ - "cachePrefix": "cache-v1", - "cachettlSec": "86400", + "cachePrefix": "cache-v1", + "cachettlSec": "86400", "routingServiceUrl": "e2e.test.routing.service.mesh", - "pathPrefix": "/sayhello,/v1/company/{id}/", + "pathPrefix": "/sayhello,/v1/company/{id}/", }, }, - Status: v1.RoutingPolicyStatus{}, + Status: v1.RoutingPolicyStatus{}, } hosts := getHosts(routingPolicyFoo) - assert.Equal(t, "hosts: e2e.testservice.mesh,e2e2.testservice.mesh",hosts) + assert.Equal(t, "hosts: e2e.testservice.mesh,e2e2.testservice.mesh", hosts) } diff --git a/admiral/pkg/clusters/handler.go b/admiral/pkg/clusters/handler.go index d6ba9b8f..6bdea47d 100644 --- a/admiral/pkg/clusters/handler.go +++ b/admiral/pkg/clusters/handler.go @@ -2,20 +2,23 @@ package clusters import ( "bytes" + "context" "fmt" "net" - "reflect" "strings" "time" argo "github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1" - "github.com/gogo/protobuf/types" + "github.com/golang/protobuf/ptypes/duration" + "github.com/golang/protobuf/ptypes/wrappers" + "github.com/google/go-cmp/cmp" "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/model" v1 "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/v1" "github.com/istio-ecosystem/admiral/admiral/pkg/controller/admiral" "github.com/istio-ecosystem/admiral/admiral/pkg/controller/common" "github.com/istio-ecosystem/admiral/admiral/pkg/controller/util" log "github.com/sirupsen/logrus" + "google.golang.org/protobuf/testing/protocmp" v1alpha32 "istio.io/api/networking/v1alpha3" "istio.io/client-go/pkg/apis/networking/v1alpha3" k8sAppsV1 "k8s.io/api/apps/v1" @@ -55,7 +58,7 @@ type WeightedService struct { } func updateIdentityDependencyCache(sourceIdentity string, identityDependencyCache *common.MapOfMaps, dr *v1.Dependency) { - for _, dIdentity := range dr.Spec.Destinations { + for _, dIdentity := range dr.Spec.Destinations { identityDependencyCache.Put(dIdentity, sourceIdentity, sourceIdentity) } log.Infof(LogFormat, "Update", "dependency-cache", dr.Name, "", "Updated=true namespace="+dr.Namespace) @@ -68,7 +71,7 @@ func getIstioResourceName(host string, suffix string) string { func getDestinationRule(se *v1alpha32.ServiceEntry, locality string, gtpTrafficPolicy *model.TrafficPolicy) *v1alpha32.DestinationRule { var dr = &v1alpha32.DestinationRule{} dr.Host = se.Hosts[0] - dr.TrafficPolicy = &v1alpha32.TrafficPolicy{Tls: &v1alpha32.TLSSettings{Mode: v1alpha32.TLSSettings_ISTIO_MUTUAL}} + dr.TrafficPolicy = &v1alpha32.TrafficPolicy{Tls: &v1alpha32.ClientTLSSettings{Mode: v1alpha32.ClientTLSSettings_ISTIO_MUTUAL}} processGtp := true if len(locality) == 0 { log.Warnf(LogErrFormat, "Process", "GlobalTrafficPolicy", dr.Host, "", "Skipping gtp processing, locality of the cluster nodes cannot be determined. Is this minikube?") @@ -109,24 +112,24 @@ func getDestinationRule(se *v1alpha32.ServiceEntry, locality string, gtpTrafficP func getOutlierDetection(se *v1alpha32.ServiceEntry, locality string, gtpTrafficPolicy *model.TrafficPolicy) *v1alpha32.OutlierDetection { outlierDetection := &v1alpha32.OutlierDetection{ - BaseEjectionTime: &types.Duration{Seconds: DefaultBaseEjectionTime}, - ConsecutiveGatewayErrors: &types.UInt32Value{Value: DefaultConsecutiveGatewayErrors}, - Interval: &types.Duration{Seconds: DefaultInterval}, + BaseEjectionTime: &duration.Duration{Seconds: DefaultBaseEjectionTime}, + ConsecutiveGatewayErrors: &wrappers.UInt32Value{Value: DefaultConsecutiveGatewayErrors}, + Interval: &duration.Duration{Seconds: DefaultInterval}, } if gtpTrafficPolicy != nil && gtpTrafficPolicy.OutlierDetection != nil { if gtpTrafficPolicy.OutlierDetection.BaseEjectionTime > 0 { - outlierDetection.BaseEjectionTime = &types.Duration{ + outlierDetection.BaseEjectionTime = &duration.Duration{ Seconds: gtpTrafficPolicy.OutlierDetection.BaseEjectionTime, } } if gtpTrafficPolicy.OutlierDetection.ConsecutiveGatewayErrors > 0 { - outlierDetection.ConsecutiveGatewayErrors = &types.UInt32Value{ + outlierDetection.ConsecutiveGatewayErrors = &wrappers.UInt32Value{ Value: gtpTrafficPolicy.OutlierDetection.ConsecutiveGatewayErrors, } } if gtpTrafficPolicy.OutlierDetection.Interval > 0 { - outlierDetection.Interval = &types.Duration{ + outlierDetection.Interval = &duration.Duration{ Seconds: gtpTrafficPolicy.OutlierDetection.Interval, } } @@ -180,7 +183,7 @@ func (se *ServiceEntryHandler) Deleted(obj *v1alpha3.ServiceEntry) { } } -func (dh *DestinationRuleHandler) Added(obj *v1alpha3.DestinationRule) { +func (dh *DestinationRuleHandler) Added(ctx context.Context, obj *v1alpha3.DestinationRule) { if CurrentAdmiralState.ReadOnly { log.Infof(LogFormat, "Add", "DestinationRule", obj.Name, dh.ClusterID, "Admiral is in read-only mode. Skipping resource from namespace="+obj.Namespace) return @@ -189,10 +192,10 @@ func (dh *DestinationRuleHandler) Added(obj *v1alpha3.DestinationRule) { log.Infof(LogFormat, "Add", "DestinationRule", obj.Name, dh.ClusterID, "Skipping resource from namespace="+obj.Namespace) return } - handleDestinationRuleEvent(obj, dh, common.Add, common.DestinationRule) + handleDestinationRuleEvent(ctx, obj, dh, common.Add, common.DestinationRule) } -func (dh *DestinationRuleHandler) Updated(obj *v1alpha3.DestinationRule) { +func (dh *DestinationRuleHandler) Updated(ctx context.Context, obj *v1alpha3.DestinationRule) { if CurrentAdmiralState.ReadOnly { log.Infof(LogFormat, "Update", "DestinationRule", obj.Name, dh.ClusterID, "Admiral is in read-only mode. Skipping resource from namespace="+obj.Namespace) return @@ -201,10 +204,10 @@ func (dh *DestinationRuleHandler) Updated(obj *v1alpha3.DestinationRule) { log.Infof(LogFormat, "Update", "DestinationRule", obj.Name, dh.ClusterID, "Skipping resource from namespace="+obj.Namespace) return } - handleDestinationRuleEvent(obj, dh, common.Update, common.DestinationRule) + handleDestinationRuleEvent(ctx, obj, dh, common.Update, common.DestinationRule) } -func (dh *DestinationRuleHandler) Deleted(obj *v1alpha3.DestinationRule) { +func (dh *DestinationRuleHandler) Deleted(ctx context.Context, obj *v1alpha3.DestinationRule) { if CurrentAdmiralState.ReadOnly { log.Infof(LogFormat, "Delete", "DestinationRule", obj.Name, dh.ClusterID, "Admiral is in read-only mode. Skipping resource from namespace="+obj.Namespace) return @@ -213,10 +216,10 @@ func (dh *DestinationRuleHandler) Deleted(obj *v1alpha3.DestinationRule) { log.Infof(LogFormat, "Delete", "DestinationRule", obj.Name, dh.ClusterID, "Skipping resource from namespace="+obj.Namespace) return } - handleDestinationRuleEvent(obj, dh, common.Delete, common.DestinationRule) + handleDestinationRuleEvent(ctx, obj, dh, common.Delete, common.DestinationRule) } -func (vh *VirtualServiceHandler) Added(obj *v1alpha3.VirtualService) { +func (vh *VirtualServiceHandler) Added(ctx context.Context, obj *v1alpha3.VirtualService) { if CurrentAdmiralState.ReadOnly { log.Infof(LogFormat, "Add", "VirtualService", obj.Name, vh.ClusterID, "Admiral is in read-only mode. Skipping resource from namespace="+obj.Namespace) return @@ -225,13 +228,13 @@ func (vh *VirtualServiceHandler) Added(obj *v1alpha3.VirtualService) { log.Infof(LogFormat, "Add", "VirtualService", obj.Name, vh.ClusterID, "Skipping resource from namespace="+obj.Namespace) return } - err := handleVirtualServiceEvent(obj, vh, common.Add, common.VirtualService) + err := handleVirtualServiceEvent(ctx, obj, vh, common.Add, common.VirtualService) if err != nil { log.Error(err) } } -func (vh *VirtualServiceHandler) Updated(obj *v1alpha3.VirtualService) { +func (vh *VirtualServiceHandler) Updated(ctx context.Context, obj *v1alpha3.VirtualService) { if CurrentAdmiralState.ReadOnly { log.Infof(LogFormat, "Update", "VirtualService", obj.Name, vh.ClusterID, "Admiral is in read-only mode. Skipping resource from namespace="+obj.Namespace) return @@ -240,13 +243,13 @@ func (vh *VirtualServiceHandler) Updated(obj *v1alpha3.VirtualService) { log.Infof(LogFormat, "Update", "VirtualService", obj.Name, vh.ClusterID, "Skipping resource from namespace="+obj.Namespace) return } - err := handleVirtualServiceEvent(obj, vh, common.Update, common.VirtualService) + err := handleVirtualServiceEvent(ctx, obj, vh, common.Update, common.VirtualService) if err != nil { log.Error(err) } } -func (vh *VirtualServiceHandler) Deleted(obj *v1alpha3.VirtualService) { +func (vh *VirtualServiceHandler) Deleted(ctx context.Context, obj *v1alpha3.VirtualService) { if CurrentAdmiralState.ReadOnly { log.Infof(LogFormat, "Delete", "VirtualService", obj.Name, vh.ClusterID, "Admiral is in read-only mode. Skipping resource from namespace="+obj.Namespace) return @@ -255,17 +258,17 @@ func (vh *VirtualServiceHandler) Deleted(obj *v1alpha3.VirtualService) { log.Infof(LogFormat, "Delete", "VirtualService", obj.Name, vh.ClusterID, "Skipping resource from namespace="+obj.Namespace) return } - err := handleVirtualServiceEvent(obj, vh, common.Delete, common.VirtualService) + err := handleVirtualServiceEvent(ctx, obj, vh, common.Delete, common.VirtualService) if err != nil { log.Error(err) } } -func (dh *SidecarHandler) Added(obj *v1alpha3.Sidecar) {} +func (dh *SidecarHandler) Added(ctx context.Context, obj *v1alpha3.Sidecar) {} -func (dh *SidecarHandler) Updated(obj *v1alpha3.Sidecar) {} +func (dh *SidecarHandler) Updated(ctx context.Context, obj *v1alpha3.Sidecar) {} -func (dh *SidecarHandler) Deleted(obj *v1alpha3.Sidecar) {} +func (dh *SidecarHandler) Deleted(ctx context.Context, obj *v1alpha3.Sidecar) {} func IgnoreIstioResource(exportTo []string, annotations map[string]string, namespace string) bool { @@ -289,7 +292,8 @@ func IgnoreIstioResource(exportTo []string, annotations map[string]string, names return true } -func handleDestinationRuleEvent(obj *v1alpha3.DestinationRule, dh *DestinationRuleHandler, event common.Event, resourceType common.ResourceType) { +func handleDestinationRuleEvent(ctx context.Context, obj *v1alpha3.DestinationRule, dh *DestinationRuleHandler, event common.Event, resourceType common.ResourceType) { + //nolint destinationRule := obj.Spec clusterId := dh.ClusterID @@ -316,7 +320,7 @@ func handleDestinationRuleEvent(obj *v1alpha3.DestinationRule, dh *DestinationRu if event == common.Delete { - err := rc.DestinationRuleController.IstioClient.NetworkingV1alpha3().DestinationRules(syncNamespace).Delete(obj.Name, &v12.DeleteOptions{}) + err := rc.DestinationRuleController.IstioClient.NetworkingV1alpha3().DestinationRules(syncNamespace).Delete(ctx, obj.Name, v12.DeleteOptions{}) if err != nil { log.Infof(LogFormat, "Delete", "DestinationRule", obj.Name, clusterId, "success") } else { @@ -325,11 +329,11 @@ func handleDestinationRuleEvent(obj *v1alpha3.DestinationRule, dh *DestinationRu } else { - exist, _ := rc.DestinationRuleController.IstioClient.NetworkingV1alpha3().DestinationRules(syncNamespace).Get(obj.Name, v12.GetOptions{}) + exist, _ := rc.DestinationRuleController.IstioClient.NetworkingV1alpha3().DestinationRules(syncNamespace).Get(ctx, obj.Name, v12.GetOptions{}) //copy destination rule only to other clusters if dependentCluster != clusterId { - addUpdateDestinationRule(obj, exist, syncNamespace, rc) + addUpdateDestinationRule(ctx, obj, exist, syncNamespace, rc) } } } @@ -344,24 +348,25 @@ func handleDestinationRuleEvent(obj *v1alpha3.DestinationRule, dh *DestinationRu if ClusterID != clusterId { rc := r.GetRemoteController(ClusterID) if event == common.Delete { - err := rc.DestinationRuleController.IstioClient.NetworkingV1alpha3().DestinationRules(syncNamespace).Delete(obj.Name, &v12.DeleteOptions{}) + err := rc.DestinationRuleController.IstioClient.NetworkingV1alpha3().DestinationRules(syncNamespace).Delete(ctx, obj.Name, v12.DeleteOptions{}) if err != nil { log.Infof(LogErrFormat, "Delete", "DestinationRule", obj.Name, clusterId, err) } else { log.Infof(LogFormat, "Delete", "DestinationRule", obj.Name, clusterId, "Success") } } else { - exist, _ := rc.DestinationRuleController.IstioClient.NetworkingV1alpha3().DestinationRules(syncNamespace).Get(obj.Name, v12.GetOptions{}) - addUpdateDestinationRule(obj, exist, syncNamespace, rc) + exist, _ := rc.DestinationRuleController.IstioClient.NetworkingV1alpha3().DestinationRules(syncNamespace).Get(ctx, obj.Name, v12.GetOptions{}) + addUpdateDestinationRule(ctx, obj, exist, syncNamespace, rc) } } } } -func handleVirtualServiceEvent(obj *v1alpha3.VirtualService, vh *VirtualServiceHandler, event common.Event, resourceType common.ResourceType) error { +func handleVirtualServiceEvent(ctx context.Context, obj *v1alpha3.VirtualService, vh *VirtualServiceHandler, event common.Event, resourceType common.ResourceType) error { log.Infof(LogFormat, "Event", resourceType, obj.Name, vh.ClusterID, "Received event") + //nolint virtualService := obj.Spec clusterId := vh.ClusterID @@ -377,7 +382,7 @@ func handleVirtualServiceEvent(obj *v1alpha3.VirtualService, vh *VirtualServiceH //check if this virtual service is used by Argo rollouts for canary strategy, if so, update the corresponding SE with appropriate weights if common.GetAdmiralParams().ArgoRolloutsEnabled { - rollouts, err := vh.RemoteRegistry.GetRemoteController(clusterId).RolloutController.RolloutClient.Rollouts(obj.Namespace).List(v12.ListOptions{}) + rollouts, err := vh.RemoteRegistry.GetRemoteController(clusterId).RolloutController.RolloutClient.Rollouts(obj.Namespace).List(ctx, v12.ListOptions{}) if err != nil { log.Errorf(LogErrFormat, "Get", "Rollout", "Error finding rollouts in namespace="+obj.Namespace, clusterId, err) @@ -385,7 +390,7 @@ func handleVirtualServiceEvent(obj *v1alpha3.VirtualService, vh *VirtualServiceH if len(rollouts.Items) > 0 { for _, rollout := range rollouts.Items { if rollout.Spec.Strategy.Canary != nil && rollout.Spec.Strategy.Canary.TrafficRouting != nil && rollout.Spec.Strategy.Canary.TrafficRouting.Istio != nil && rollout.Spec.Strategy.Canary.TrafficRouting.Istio.VirtualService.Name == obj.Name { - HandleEventForRollout(admiral.Update, &rollout, vh.RemoteRegistry, clusterId) + HandleEventForRollout(ctx, admiral.Update, &rollout, vh.RemoteRegistry, clusterId) } } } @@ -406,14 +411,14 @@ func handleVirtualServiceEvent(obj *v1alpha3.VirtualService, vh *VirtualServiceH if event == common.Delete { log.Infof(LogFormat, "Delete", "VirtualService", obj.Name, clusterId, "Success") - err := rc.VirtualServiceController.IstioClient.NetworkingV1alpha3().VirtualServices(syncNamespace).Delete(obj.Name, &v12.DeleteOptions{}) + err := rc.VirtualServiceController.IstioClient.NetworkingV1alpha3().VirtualServices(syncNamespace).Delete(ctx, obj.Name, v12.DeleteOptions{}) if err != nil { return err } } else { - exist, _ := rc.VirtualServiceController.IstioClient.NetworkingV1alpha3().VirtualServices(syncNamespace).Get(obj.Name, v12.GetOptions{}) + exist, _ := rc.VirtualServiceController.IstioClient.NetworkingV1alpha3().VirtualServices(syncNamespace).Get(ctx, obj.Name, v12.GetOptions{}) //change destination host for all http routes .. to same as host on the virtual service for _, httpRoute := range virtualService.Http { @@ -434,7 +439,7 @@ func handleVirtualServiceEvent(obj *v1alpha3.VirtualService, vh *VirtualServiceH } } - addUpdateVirtualService(obj, exist, syncNamespace, rc) + addUpdateVirtualService(ctx, obj, exist, syncNamespace, rc) } } } @@ -450,7 +455,7 @@ func handleVirtualServiceEvent(obj *v1alpha3.VirtualService, vh *VirtualServiceH if ClusterID != clusterId { rc := r.GetRemoteController(ClusterID) if event == common.Delete { - err := rc.VirtualServiceController.IstioClient.NetworkingV1alpha3().VirtualServices(syncNamespace).Delete(obj.Name, &v12.DeleteOptions{}) + err := rc.VirtualServiceController.IstioClient.NetworkingV1alpha3().VirtualServices(syncNamespace).Delete(ctx, obj.Name, v12.DeleteOptions{}) if err != nil { log.Infof(LogErrFormat, "Delete", "VirtualService", obj.Name, clusterId, err) return err @@ -458,15 +463,15 @@ func handleVirtualServiceEvent(obj *v1alpha3.VirtualService, vh *VirtualServiceH log.Infof(LogFormat, "Delete", "VirtualService", obj.Name, clusterId, "Success") } } else { - exist, _ := rc.VirtualServiceController.IstioClient.NetworkingV1alpha3().VirtualServices(syncNamespace).Get(obj.Name, v12.GetOptions{}) - addUpdateVirtualService(obj, exist, syncNamespace, rc) + exist, _ := rc.VirtualServiceController.IstioClient.NetworkingV1alpha3().VirtualServices(syncNamespace).Get(ctx, obj.Name, v12.GetOptions{}) + addUpdateVirtualService(ctx, obj, exist, syncNamespace, rc) } } } return nil } -func addUpdateVirtualService(obj *v1alpha3.VirtualService, exist *v1alpha3.VirtualService, namespace string, rc *RemoteController) { +func addUpdateVirtualService(ctx context.Context, obj *v1alpha3.VirtualService, exist *v1alpha3.VirtualService, namespace string, rc *RemoteController) { var err error var op string if obj.Annotations == nil { @@ -476,14 +481,15 @@ func addUpdateVirtualService(obj *v1alpha3.VirtualService, exist *v1alpha3.Virtu if exist == nil || len(exist.Spec.Hosts) == 0 { obj.Namespace = namespace obj.ResourceVersion = "" - _, err = rc.VirtualServiceController.IstioClient.NetworkingV1alpha3().VirtualServices(namespace).Create(obj) + _, err = rc.VirtualServiceController.IstioClient.NetworkingV1alpha3().VirtualServices(namespace).Create(ctx, obj, v12.CreateOptions{}) op = "Add" } else { exist.Labels = obj.Labels exist.Annotations = obj.Annotations + //nolint exist.Spec = obj.Spec op = "Update" - _, err = rc.VirtualServiceController.IstioClient.NetworkingV1alpha3().VirtualServices(namespace).Update(exist) + _, err = rc.VirtualServiceController.IstioClient.NetworkingV1alpha3().VirtualServices(namespace).Update(ctx, exist, v12.UpdateOptions{}) } if err != nil { @@ -493,7 +499,7 @@ func addUpdateVirtualService(obj *v1alpha3.VirtualService, exist *v1alpha3.Virtu } } -func addUpdateServiceEntry(obj *v1alpha3.ServiceEntry, exist *v1alpha3.ServiceEntry, namespace string, rc *RemoteController) { +func addUpdateServiceEntry(ctx context.Context, obj *v1alpha3.ServiceEntry, exist *v1alpha3.ServiceEntry, namespace string, rc *RemoteController) { var err error var op, diff string var skipUpdate bool @@ -504,7 +510,7 @@ func addUpdateServiceEntry(obj *v1alpha3.ServiceEntry, exist *v1alpha3.ServiceEn if exist == nil || exist.Spec.Hosts == nil { obj.Namespace = namespace obj.ResourceVersion = "" - _, err = rc.ServiceEntryController.IstioClient.NetworkingV1alpha3().ServiceEntries(namespace).Create(obj) + _, err = rc.ServiceEntryController.IstioClient.NetworkingV1alpha3().ServiceEntries(namespace).Create(ctx, obj, v12.CreateOptions{}) op = "Add" log.Infof(LogFormat+" SE=%s", op, "ServiceEntry", obj.Name, rc.ClusterID, "New SE", obj.Spec.String()) } else { @@ -519,8 +525,9 @@ func addUpdateServiceEntry(obj *v1alpha3.ServiceEntry, exist *v1alpha3.ServiceEn log.Infof(LogFormat, op, "ServiceEntry", obj.Name, rc.ClusterID, "Update skipped as it was destructive during Admiral's bootup phase") return } else { + //nolint exist.Spec = obj.Spec - _, err = rc.ServiceEntryController.IstioClient.NetworkingV1alpha3().ServiceEntries(namespace).Update(exist) + _, err = rc.ServiceEntryController.IstioClient.NetworkingV1alpha3().ServiceEntries(namespace).Update(ctx, exist, v12.UpdateOptions{}) } } @@ -553,10 +560,12 @@ func getServiceEntryDiff(new *v1alpha3.ServiceEntry, old *v1alpha3.ServiceEntry) destructive = false format := "%s %s before: %v, after: %v;" var buffer bytes.Buffer + //nolint seNew := new.Spec + //nolint seOld := old.Spec - oldEndpointMap := make(map[string]*v1alpha32.ServiceEntry_Endpoint) + oldEndpointMap := make(map[string]*v1alpha32.WorkloadEntry) found := make(map[string]string) for _, oEndpoint := range seOld.Endpoints { oldEndpointMap[oEndpoint.Address] = oEndpoint @@ -564,7 +573,7 @@ func getServiceEntryDiff(new *v1alpha3.ServiceEntry, old *v1alpha3.ServiceEntry) for _, nEndpoint := range seNew.Endpoints { if val, ok := oldEndpointMap[nEndpoint.Address]; ok { found[nEndpoint.Address] = "1" - if !reflect.DeepEqual(val, nEndpoint) { + if !cmp.Equal(val, nEndpoint, protocmp.Transform()) { destructive = true buffer.WriteString(fmt.Sprintf(format, "endpoint", "Update", val.String(), nEndpoint.String())) } @@ -584,9 +593,9 @@ func getServiceEntryDiff(new *v1alpha3.ServiceEntry, old *v1alpha3.ServiceEntry) return destructive, diff } -func deleteServiceEntry(exist *v1alpha3.ServiceEntry, namespace string, rc *RemoteController) { +func deleteServiceEntry(ctx context.Context, exist *v1alpha3.ServiceEntry, namespace string, rc *RemoteController) { if exist != nil { - err := rc.ServiceEntryController.IstioClient.NetworkingV1alpha3().ServiceEntries(namespace).Delete(exist.Name, &v12.DeleteOptions{}) + err := rc.ServiceEntryController.IstioClient.NetworkingV1alpha3().ServiceEntries(namespace).Delete(ctx, exist.Name, v12.DeleteOptions{}) if err != nil { log.Errorf(LogErrFormat, "Delete", "ServiceEntry", exist.Name, rc.ClusterID, err) } else { @@ -595,7 +604,7 @@ func deleteServiceEntry(exist *v1alpha3.ServiceEntry, namespace string, rc *Remo } } -func addUpdateDestinationRule(obj *v1alpha3.DestinationRule, exist *v1alpha3.DestinationRule, namespace string, rc *RemoteController) { +func addUpdateDestinationRule(ctx context.Context, obj *v1alpha3.DestinationRule, exist *v1alpha3.DestinationRule, namespace string, rc *RemoteController) { var err error var op string if obj.Annotations == nil { @@ -605,14 +614,15 @@ func addUpdateDestinationRule(obj *v1alpha3.DestinationRule, exist *v1alpha3.Des if exist == nil || exist.Name == "" || exist.Spec.Host == "" { obj.Namespace = namespace obj.ResourceVersion = "" - _, err = rc.DestinationRuleController.IstioClient.NetworkingV1alpha3().DestinationRules(namespace).Create(obj) + _, err = rc.DestinationRuleController.IstioClient.NetworkingV1alpha3().DestinationRules(namespace).Create(ctx, obj, v12.CreateOptions{}) op = "Add" } else { exist.Labels = obj.Labels exist.Annotations = obj.Annotations + //nolint exist.Spec = obj.Spec op = "Update" - _, err = rc.DestinationRuleController.IstioClient.NetworkingV1alpha3().DestinationRules(namespace).Update(exist) + _, err = rc.DestinationRuleController.IstioClient.NetworkingV1alpha3().DestinationRules(namespace).Update(ctx, exist, v12.UpdateOptions{}) } if err != nil { @@ -622,9 +632,9 @@ func addUpdateDestinationRule(obj *v1alpha3.DestinationRule, exist *v1alpha3.Des } } -func deleteDestinationRule(exist *v1alpha3.DestinationRule, namespace string, rc *RemoteController) { +func deleteDestinationRule(ctx context.Context, exist *v1alpha3.DestinationRule, namespace string, rc *RemoteController) { if exist != nil { - err := rc.DestinationRuleController.IstioClient.NetworkingV1alpha3().DestinationRules(namespace).Delete(exist.Name, &v12.DeleteOptions{}) + err := rc.DestinationRuleController.IstioClient.NetworkingV1alpha3().DestinationRules(namespace).Delete(ctx, exist.Name, v12.DeleteOptions{}) if err != nil { log.Errorf(LogErrFormat, "Delete", "DestinationRule", exist.Name, rc.ClusterID, err) } else { @@ -632,14 +642,18 @@ func deleteDestinationRule(exist *v1alpha3.DestinationRule, namespace string, rc } } } + +//nolint func createServiceEntrySkeletion(se v1alpha32.ServiceEntry, name string, namespace string) *v1alpha3.ServiceEntry { return &v1alpha3.ServiceEntry{Spec: se, ObjectMeta: v12.ObjectMeta{Name: name, Namespace: namespace}} } +//nolint func createSidecarSkeletion(sidecar v1alpha32.Sidecar, name string, namespace string) *v1alpha3.Sidecar { return &v1alpha3.Sidecar{Spec: sidecar, ObjectMeta: v12.ObjectMeta{Name: name, Namespace: namespace}} } +//nolint func createDestinationRuleSkeletion(dr v1alpha32.DestinationRule, name string, namespace string) *v1alpha3.DestinationRule { return &v1alpha3.DestinationRule{Spec: dr, ObjectMeta: v12.ObjectMeta{Name: name, Namespace: namespace}} } @@ -692,18 +706,18 @@ func getDependentClusters(dependents map[string]string, identityClusterCache *co return dependentClusters } -func copyEndpoint(e *v1alpha32.ServiceEntry_Endpoint) *v1alpha32.ServiceEntry_Endpoint { +func copyEndpoint(e *v1alpha32.WorkloadEntry) *v1alpha32.WorkloadEntry { labels := make(map[string]string) util.MapCopy(labels, e.Labels) ports := make(map[string]uint32) util.MapCopy(ports, e.Ports) - return &v1alpha32.ServiceEntry_Endpoint{Address: e.Address, Ports: ports, Locality: e.Locality, Labels: labels} + return &v1alpha32.WorkloadEntry{Address: e.Address, Ports: ports, Locality: e.Locality, Labels: labels} } // A rollout can use one of 2 stratergies :- // 1. Canary strategy - which can use a virtual service to manage the weights associated with a stable and canary service. Admiral created endpoints in service entries will use the weights assigned in the Virtual Service // 2. Blue green strategy- this contains 2 service instances in a namespace, an active service and a preview service. Admiral will use repective service to create active and preview endpoints -func getServiceForRollout(rc *RemoteController, rollout *argo.Rollout) map[string]*WeightedService { +func getServiceForRollout(ctx context.Context, rc *RemoteController, rollout *argo.Rollout) map[string]*WeightedService { if rollout == nil { return nil @@ -756,7 +770,7 @@ func getServiceForRollout(rc *RemoteController, rollout *argo.Rollout) map[strin } virtualServiceName := rolloutStrategy.Canary.TrafficRouting.Istio.VirtualService.Name - virtualService, err := rc.VirtualServiceController.IstioClient.NetworkingV1alpha3().VirtualServices(rollout.Namespace).Get(virtualServiceName, v12.GetOptions{}) + virtualService, err := rc.VirtualServiceController.IstioClient.NetworkingV1alpha3().VirtualServices(rollout.Namespace).Get(ctx, virtualServiceName, v12.GetOptions{}) if err != nil { log.Warnf("Error fetching VirtualService referenced in rollout canary for rollout with name=%s in namespace=%s and cluster=%s err=%v", rollout.Name, rollout.Namespace, rc.ClusterID, err) @@ -767,6 +781,7 @@ func getServiceForRollout(rc *RemoteController, rollout *argo.Rollout) map[strin } if virtualService != nil { + //nolint var vs = virtualService.Spec if len(vs.Http) > 0 { var httpRoute *v1alpha32.HTTPRoute diff --git a/admiral/pkg/clusters/handler_test.go b/admiral/pkg/clusters/handler_test.go index 3ad4065c..60999a8e 100644 --- a/admiral/pkg/clusters/handler_test.go +++ b/admiral/pkg/clusters/handler_test.go @@ -1,13 +1,15 @@ package clusters import ( + "context" "reflect" "strings" "testing" "time" argo "github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1" - "github.com/gogo/protobuf/types" + "github.com/golang/protobuf/ptypes/duration" + "github.com/golang/protobuf/ptypes/wrappers" "github.com/google/go-cmp/cmp" "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/model" "github.com/istio-ecosystem/admiral/admiral/pkg/controller/admiral" @@ -15,6 +17,7 @@ import ( "github.com/istio-ecosystem/admiral/admiral/pkg/controller/istio" "github.com/istio-ecosystem/admiral/admiral/pkg/test" "github.com/stretchr/testify/assert" + "google.golang.org/protobuf/testing/protocmp" "istio.io/api/networking/v1alpha3" v1alpha32 "istio.io/client-go/pkg/apis/networking/v1alpha3" istiofake "istio.io/client-go/pkg/clientset/versioned/fake" @@ -175,14 +178,14 @@ func TestIgnoreIstioResource(t *testing.T) { func TestGetDestinationRule(t *testing.T) { //Do setup here outlierDetection := &v1alpha3.OutlierDetection{ - BaseEjectionTime: &types.Duration{Seconds: 300}, - ConsecutiveGatewayErrors: &types.UInt32Value{Value: 50}, - Interval: &types.Duration{Seconds: 60}, + BaseEjectionTime: &duration.Duration{Seconds: 300}, + ConsecutiveGatewayErrors: &wrappers.UInt32Value{Value: 50}, + Interval: &duration.Duration{Seconds: 60}, MaxEjectionPercent: 100, } - mTLS := &v1alpha3.TrafficPolicy{Tls: &v1alpha3.TLSSettings{Mode: v1alpha3.TLSSettings_ISTIO_MUTUAL}, OutlierDetection: outlierDetection} + mTLS := &v1alpha3.TrafficPolicy{Tls: &v1alpha3.ClientTLSSettings{Mode: v1alpha3.ClientTLSSettings_ISTIO_MUTUAL}, OutlierDetection: outlierDetection} - se := &v1alpha3.ServiceEntry{Hosts: []string{"qa.myservice.global"}, Endpoints: []*v1alpha3.ServiceEntry_Endpoint{ + se := &v1alpha3.ServiceEntry{Hosts: []string{"qa.myservice.global"}, Endpoints: []*v1alpha3.WorkloadEntry{ {Address: "east.com", Locality: "us-east-2"}, {Address: "west.com", Locality: "us-west-2"}, }} noGtpDr := v1alpha3.DestinationRule{ @@ -193,7 +196,7 @@ func TestGetDestinationRule(t *testing.T) { basicGtpDr := v1alpha3.DestinationRule{ Host: "qa.myservice.global", TrafficPolicy: &v1alpha3.TrafficPolicy{ - Tls: &v1alpha3.TLSSettings{Mode: v1alpha3.TLSSettings_ISTIO_MUTUAL}, + Tls: &v1alpha3.ClientTLSSettings{Mode: v1alpha3.ClientTLSSettings_ISTIO_MUTUAL}, LoadBalancer: &v1alpha3.LoadBalancerSettings{ LbPolicy: &v1alpha3.LoadBalancerSettings_Simple{Simple: v1alpha3.LoadBalancerSettings_ROUND_ROBIN}, LocalityLbSetting: &v1alpha3.LocalityLoadBalancerSetting{}, @@ -205,7 +208,7 @@ func TestGetDestinationRule(t *testing.T) { failoverGtpDr := v1alpha3.DestinationRule{ Host: "qa.myservice.global", TrafficPolicy: &v1alpha3.TrafficPolicy{ - Tls: &v1alpha3.TLSSettings{Mode: v1alpha3.TLSSettings_ISTIO_MUTUAL}, + Tls: &v1alpha3.ClientTLSSettings{Mode: v1alpha3.ClientTLSSettings_ISTIO_MUTUAL}, LoadBalancer: &v1alpha3.LoadBalancerSettings{ LbPolicy: &v1alpha3.LoadBalancerSettings_Simple{Simple: v1alpha3.LoadBalancerSettings_ROUND_ROBIN}, LocalityLbSetting: &v1alpha3.LocalityLoadBalancerSetting{ @@ -287,7 +290,7 @@ func TestGetDestinationRule(t *testing.T) { for _, c := range testCases { t.Run(c.name, func(t *testing.T) { result := getDestinationRule(c.se, c.locality, c.gtpPolicy) - if !cmp.Equal(result, c.destinationRule) { + if !cmp.Equal(result, c.destinationRule, protocmp.Transform()) { t.Fatalf("DestinationRule Mismatch. Diff: %v", cmp.Diff(result, c.destinationRule)) } }) @@ -297,16 +300,16 @@ func TestGetDestinationRule(t *testing.T) { func TestGetOutlierDetection(t *testing.T) { //Do setup here outlierDetection := &v1alpha3.OutlierDetection{ - BaseEjectionTime: &types.Duration{Seconds: DefaultBaseEjectionTime}, - ConsecutiveGatewayErrors: &types.UInt32Value{Value: DefaultConsecutiveGatewayErrors}, - Interval: &types.Duration{Seconds: DefaultInterval}, + BaseEjectionTime: &duration.Duration{Seconds: DefaultBaseEjectionTime}, + ConsecutiveGatewayErrors: &wrappers.UInt32Value{Value: DefaultConsecutiveGatewayErrors}, + Interval: &duration.Duration{Seconds: DefaultInterval}, MaxEjectionPercent: 100, } outlierDetectionOneHostRemote := &v1alpha3.OutlierDetection{ - BaseEjectionTime: &types.Duration{Seconds: DefaultBaseEjectionTime}, - ConsecutiveGatewayErrors: &types.UInt32Value{Value: DefaultConsecutiveGatewayErrors}, - Interval: &types.Duration{Seconds: DefaultInterval}, + BaseEjectionTime: &duration.Duration{Seconds: DefaultBaseEjectionTime}, + ConsecutiveGatewayErrors: &wrappers.UInt32Value{Value: DefaultConsecutiveGatewayErrors}, + Interval: &duration.Duration{Seconds: DefaultInterval}, MaxEjectionPercent: 34, } @@ -320,19 +323,19 @@ func TestGetOutlierDetection(t *testing.T) { }, } - se := &v1alpha3.ServiceEntry{Hosts: []string{"qa.myservice.global"}, Endpoints: []*v1alpha3.ServiceEntry_Endpoint{ + se := &v1alpha3.ServiceEntry{Hosts: []string{"qa.myservice.global"}, Endpoints: []*v1alpha3.WorkloadEntry{ {Address: "east.com", Locality: "us-east-2"}, {Address: "west.com", Locality: "us-west-2"}, }} - seOneHostRemote := &v1alpha3.ServiceEntry{Hosts: []string{"qa.myservice.global"}, Endpoints: []*v1alpha3.ServiceEntry_Endpoint{ + seOneHostRemote := &v1alpha3.ServiceEntry{Hosts: []string{"qa.myservice.global"}, Endpoints: []*v1alpha3.WorkloadEntry{ {Address: "east.com", Locality: "us-east-2"}, }} - seOneHostLocal := &v1alpha3.ServiceEntry{Hosts: []string{"qa.myservice.global"}, Endpoints: []*v1alpha3.ServiceEntry_Endpoint{ + seOneHostLocal := &v1alpha3.ServiceEntry{Hosts: []string{"qa.myservice.global"}, Endpoints: []*v1alpha3.WorkloadEntry{ {Address: "hello.ns.svc.cluster.local", Locality: "us-east-2"}, }} - seOneHostRemoteIp := &v1alpha3.ServiceEntry{Hosts: []string{"qa.myservice.global"}, Endpoints: []*v1alpha3.ServiceEntry_Endpoint{ + seOneHostRemoteIp := &v1alpha3.ServiceEntry{Hosts: []string{"qa.myservice.global"}, Endpoints: []*v1alpha3.WorkloadEntry{ {Address: "95.45.25.34", Locality: "us-east-2"}, }} @@ -405,9 +408,9 @@ func TestGetOutlierDetection(t *testing.T) { }, }, outlierDetection: &v1alpha3.OutlierDetection{ - BaseEjectionTime: &types.Duration{Seconds: DefaultBaseEjectionTime}, - ConsecutiveGatewayErrors: &types.UInt32Value{Value: 10}, - Interval: &types.Duration{Seconds: 60}, + BaseEjectionTime: &duration.Duration{Seconds: DefaultBaseEjectionTime}, + ConsecutiveGatewayErrors: &wrappers.UInt32Value{Value: 10}, + Interval: &duration.Duration{Seconds: 60}, MaxEjectionPercent: 100, }, }, @@ -429,9 +432,9 @@ func TestGetOutlierDetection(t *testing.T) { }, }, outlierDetection: &v1alpha3.OutlierDetection{ - BaseEjectionTime: &types.Duration{Seconds: 600}, - ConsecutiveGatewayErrors: &types.UInt32Value{Value: DefaultConsecutiveGatewayErrors}, - Interval: &types.Duration{Seconds: 60}, + BaseEjectionTime: &duration.Duration{Seconds: 600}, + ConsecutiveGatewayErrors: &wrappers.UInt32Value{Value: DefaultConsecutiveGatewayErrors}, + Interval: &duration.Duration{Seconds: 60}, MaxEjectionPercent: 100, }, }, @@ -453,9 +456,9 @@ func TestGetOutlierDetection(t *testing.T) { }, }, outlierDetection: &v1alpha3.OutlierDetection{ - BaseEjectionTime: &types.Duration{Seconds: 600}, - ConsecutiveGatewayErrors: &types.UInt32Value{Value: 50}, - Interval: &types.Duration{Seconds: DefaultInterval}, + BaseEjectionTime: &duration.Duration{Seconds: 600}, + ConsecutiveGatewayErrors: &wrappers.UInt32Value{Value: 50}, + Interval: &duration.Duration{Seconds: DefaultInterval}, MaxEjectionPercent: 100, }, }, @@ -478,9 +481,9 @@ func TestGetOutlierDetection(t *testing.T) { }, }, outlierDetection: &v1alpha3.OutlierDetection{ - BaseEjectionTime: &types.Duration{Seconds: 600}, - ConsecutiveGatewayErrors: &types.UInt32Value{Value: 10}, - Interval: &types.Duration{Seconds: 60}, + BaseEjectionTime: &duration.Duration{Seconds: 600}, + ConsecutiveGatewayErrors: &wrappers.UInt32Value{Value: 10}, + Interval: &duration.Duration{Seconds: 60}, MaxEjectionPercent: 100, }, }, @@ -490,7 +493,7 @@ func TestGetOutlierDetection(t *testing.T) { for _, c := range testCases { t.Run(c.name, func(t *testing.T) { result := getOutlierDetection(c.se, c.locality, c.gtpPolicy) - if !cmp.Equal(result, c.outlierDetection) { + if !cmp.Equal(result, c.outlierDetection, protocmp.Transform()) { t.Fatalf("OutlierDetection Mismatch. Diff: %v", cmp.Diff(result, c.outlierDetection)) } }) @@ -547,16 +550,16 @@ func TestHandleVirtualServiceEvent(t *testing.T) { handlerEmptyClient := VirtualServiceHandler{ RemoteRegistry: rr1, } - + ctx := context.Background() fullFakeIstioClient := istiofake.NewSimpleClientset() - fullFakeIstioClient.NetworkingV1alpha3().VirtualServices("ns").Create(&v1alpha32.VirtualService{ + fullFakeIstioClient.NetworkingV1alpha3().VirtualServices("ns").Create(ctx, &v1alpha32.VirtualService{ ObjectMeta: v12.ObjectMeta{ Name: "vs-name", }, Spec: v1alpha3.VirtualService{ Hosts: []string{"e2e.blah.global"}, }, - }) + }, v12.CreateOptions{}) rr2 := NewRemoteRegistry(nil, common.AdmiralParams{}) rr2.AdmiralCache = &AdmiralCache{ CnameDependentClusterCache: goodCnameCache, @@ -642,7 +645,7 @@ func TestHandleVirtualServiceEvent(t *testing.T) { for _, c := range testCases { t.Run(c.name, func(t *testing.T) { - err := handleVirtualServiceEvent(c.vs, c.handler, c.event, common.VirtualService) + err := handleVirtualServiceEvent(ctx, c.vs, c.handler, c.event, common.VirtualService) if err != c.expectedError { t.Fatalf("Error mismatch, expected %v but got %v", c.expectedError, err) } @@ -813,10 +816,10 @@ func TestGetServiceForRolloutCanary(t *testing.T) { }}}, }, } - - rcTemp.VirtualServiceController.IstioClient.NetworkingV1alpha3().VirtualServices(Namespace).Create(virtualService) - rcTemp.VirtualServiceController.IstioClient.NetworkingV1alpha3().VirtualServices(Namespace).Create(vsMutipleRoutesWithMatch) - rcTemp.VirtualServiceController.IstioClient.NetworkingV1alpha3().VirtualServices(Namespace).Create(vsMutipleRoutesWithZeroWeight) + ctx := context.Background() + rcTemp.VirtualServiceController.IstioClient.NetworkingV1alpha3().VirtualServices(Namespace).Create(ctx, virtualService, v12.CreateOptions{}) + rcTemp.VirtualServiceController.IstioClient.NetworkingV1alpha3().VirtualServices(Namespace).Create(ctx, vsMutipleRoutesWithMatch, v12.CreateOptions{}) + rcTemp.VirtualServiceController.IstioClient.NetworkingV1alpha3().VirtualServices(Namespace).Create(ctx, vsMutipleRoutesWithZeroWeight, v12.CreateOptions{}) canaryRollout := argo.Rollout{ Spec: argo.RolloutSpec{Template: coreV1.PodTemplateSpec{ @@ -880,7 +883,7 @@ func TestGetServiceForRolloutCanary(t *testing.T) { CanaryService: CanaryServiceName, TrafficRouting: &argo.RolloutTrafficRouting{ Istio: &argo.IstioTrafficRouting{ - VirtualService: argo.IstioVirtualService{Name: VS_NAME_1}, + VirtualService: &argo.IstioVirtualService{Name: VS_NAME_1}, }, }, }, @@ -899,7 +902,7 @@ func TestGetServiceForRolloutCanary(t *testing.T) { CanaryService: CanaryServiceName, TrafficRouting: &argo.RolloutTrafficRouting{ Istio: &argo.IstioTrafficRouting{ - VirtualService: argo.IstioVirtualService{Name: VS_NAME_2, Routes: []string{VS_ROUTE_PRIMARY}}, + VirtualService: &argo.IstioVirtualService{Name: VS_NAME_2, Routes: []string{VS_ROUTE_PRIMARY}}, }, }, }, @@ -918,7 +921,7 @@ func TestGetServiceForRolloutCanary(t *testing.T) { CanaryService: CanaryServiceName, TrafficRouting: &argo.RolloutTrafficRouting{ Istio: &argo.IstioTrafficRouting{ - VirtualService: argo.IstioVirtualService{Name: VS_NAME_2, Routes: []string{"random"}}, + VirtualService: &argo.IstioVirtualService{Name: VS_NAME_2, Routes: []string{"random"}}, }, }, }, @@ -937,7 +940,7 @@ func TestGetServiceForRolloutCanary(t *testing.T) { CanaryService: CanaryServiceName, TrafficRouting: &argo.RolloutTrafficRouting{ Istio: &argo.IstioTrafficRouting{ - VirtualService: argo.IstioVirtualService{Name: VS_NAME_4}, + VirtualService: &argo.IstioVirtualService{Name: VS_NAME_4}, }, }, }, @@ -970,7 +973,7 @@ func TestGetServiceForRolloutCanary(t *testing.T) { CanaryService: CanaryServiceName, TrafficRouting: &argo.RolloutTrafficRouting{ Istio: &argo.IstioTrafficRouting{ - VirtualService: argo.IstioVirtualService{Name: "random"}, + VirtualService: &argo.IstioVirtualService{Name: "random"}, }, }, }, @@ -1067,7 +1070,7 @@ func TestGetServiceForRolloutCanary(t *testing.T) { //Run the test for every provided case for _, c := range testCases { t.Run(c.name, func(t *testing.T) { - result := getServiceForRollout(c.rc, c.rollout) + result := getServiceForRollout(ctx, c.rc, c.rollout) if len(c.result) == 0 { if result != nil && len(result) != 0 { t.Fatalf("Service expected to be nil") @@ -1329,10 +1332,12 @@ func TestGetServiceForRolloutBlueGreen(t *testing.T) { }, } + ctx := context.Background() + //Run the test for every provided case for _, c := range testCases { t.Run(c.name, func(t *testing.T) { - result := getServiceForRollout(c.rc, c.rollout) + result := getServiceForRollout(ctx, c.rc, c.rollout) if len(c.result) == 0 { if result != nil && len(result) > 0 { t.Fatalf("Service expected to be nil") @@ -1362,7 +1367,7 @@ func TestSkipDestructiveUpdate(t *testing.T) { Location: v1alpha3.ServiceEntry_MESH_INTERNAL, Resolution: v1alpha3.ServiceEntry_DNS, SubjectAltNames: []string{"spiffe://prefix/my-first-service"}, - Endpoints: []*v1alpha3.ServiceEntry_Endpoint{ + Endpoints: []*v1alpha3.WorkloadEntry{ {Address: "dummy.admiral.global-west", Ports: map[string]uint32{"http": 0}, Locality: "us-west-2"}, {Address: "dummy.admiral.global-east", Ports: map[string]uint32{"http": 0}, Locality: "us-east-2"}, }, @@ -1376,7 +1381,7 @@ func TestSkipDestructiveUpdate(t *testing.T) { Location: v1alpha3.ServiceEntry_MESH_INTERNAL, Resolution: v1alpha3.ServiceEntry_DNS, SubjectAltNames: []string{"spiffe://prefix/my-first-service"}, - Endpoints: []*v1alpha3.ServiceEntry_Endpoint{ + Endpoints: []*v1alpha3.WorkloadEntry{ {Address: "dummy.admiral.global-west", Ports: map[string]uint32{"http": 90}, Locality: "us-west-2"}, {Address: "dummy.admiral.global-east", Ports: map[string]uint32{"http": 0}, Locality: "us-east-2"}, }, @@ -1390,34 +1395,39 @@ func TestSkipDestructiveUpdate(t *testing.T) { Location: v1alpha3.ServiceEntry_MESH_INTERNAL, Resolution: v1alpha3.ServiceEntry_DNS, SubjectAltNames: []string{"spiffe://prefix/my-first-service"}, - Endpoints: []*v1alpha3.ServiceEntry_Endpoint{ + Endpoints: []*v1alpha3.WorkloadEntry{ {Address: "dummy.admiral.global-west", Ports: map[string]uint32{"http": 0}, Locality: "us-west-2"}, }, } newSeTwoEndpoints := &v1alpha32.ServiceEntry{ ObjectMeta: v12.ObjectMeta{Name: "se1", Namespace: "random"}, - Spec: twoEndpointSe, + //nolint + Spec: twoEndpointSe, } newSeTwoEndpointsUpdated := &v1alpha32.ServiceEntry{ ObjectMeta: v12.ObjectMeta{Name: "se1", Namespace: "random"}, - Spec: twoEndpointSeUpdated, + //nolint + Spec: twoEndpointSeUpdated, } newSeOneEndpoint := &v1alpha32.ServiceEntry{ ObjectMeta: v12.ObjectMeta{Name: "se1", Namespace: "random"}, - Spec: oneEndpointSe, + //nolint + Spec: oneEndpointSe, } oldSeTwoEndpoints := &v1alpha32.ServiceEntry{ ObjectMeta: v12.ObjectMeta{Name: "se1", Namespace: "random"}, - Spec: twoEndpointSe, + //nolint + Spec: twoEndpointSe, } oldSeOneEndpoint := &v1alpha32.ServiceEntry{ ObjectMeta: v12.ObjectMeta{Name: "se1", Namespace: "random"}, - Spec: oneEndpointSe, + //nolint + Spec: oneEndpointSe, } rcWarmupPhase := &RemoteController{ @@ -1507,6 +1517,8 @@ func TestSkipDestructiveUpdate(t *testing.T) { func TestAddUpdateServiceEntry(t *testing.T) { + ctx := context.Background() + fakeIstioClient := istiofake.NewSimpleClientset() seCtrl := &istio.ServiceEntryController{ @@ -1521,7 +1533,7 @@ func TestAddUpdateServiceEntry(t *testing.T) { Location: v1alpha3.ServiceEntry_MESH_INTERNAL, Resolution: v1alpha3.ServiceEntry_DNS, SubjectAltNames: []string{"spiffe://prefix/my-first-service"}, - Endpoints: []*v1alpha3.ServiceEntry_Endpoint{ + Endpoints: []*v1alpha3.WorkloadEntry{ {Address: "dummy.admiral.global-west", Ports: map[string]uint32{"http": 0}, Locality: "us-west-2"}, {Address: "dummy.admiral.global-east", Ports: map[string]uint32{"http": 0}, Locality: "us-east-2"}, }, @@ -1535,22 +1547,27 @@ func TestAddUpdateServiceEntry(t *testing.T) { Location: v1alpha3.ServiceEntry_MESH_INTERNAL, Resolution: v1alpha3.ServiceEntry_DNS, SubjectAltNames: []string{"spiffe://prefix/my-first-service"}, - Endpoints: []*v1alpha3.ServiceEntry_Endpoint{ + Endpoints: []*v1alpha3.WorkloadEntry{ {Address: "dummy.admiral.global-west", Ports: map[string]uint32{"http": 0}, Locality: "us-west-2"}, }, } newSeOneEndpoint := &v1alpha32.ServiceEntry{ ObjectMeta: v12.ObjectMeta{Name: "se1", Namespace: "namespace"}, - Spec: oneEndpointSe, + //nolint + Spec: oneEndpointSe, } oldSeTwoEndpoints := &v1alpha32.ServiceEntry{ ObjectMeta: v12.ObjectMeta{Name: "se2", Namespace: "namespace"}, - Spec: twoEndpointSe, + //nolint + Spec: twoEndpointSe, } - seCtrl.IstioClient.NetworkingV1alpha3().ServiceEntries("namespace").Create(oldSeTwoEndpoints) + _, err := seCtrl.IstioClient.NetworkingV1alpha3().ServiceEntries("namespace").Create(ctx, oldSeTwoEndpoints, v12.CreateOptions{}) + if err != nil { + t.Error(err) + } rcWarmupPhase := &RemoteController{ ServiceEntryController: seCtrl, @@ -1596,10 +1613,13 @@ func TestAddUpdateServiceEntry(t *testing.T) { //Run the test for every provided case for _, c := range testCases { t.Run(c.name, func(t *testing.T) { - addUpdateServiceEntry(c.newSe, c.oldSe, "namespace", c.rc) + addUpdateServiceEntry(ctx, c.newSe, c.oldSe, "namespace", c.rc) if c.skipDestructive { //verify the update did not go through - se, _ := c.rc.ServiceEntryController.IstioClient.NetworkingV1alpha3().ServiceEntries("namespace").Get(c.oldSe.Name, v12.GetOptions{}) + se, err := c.rc.ServiceEntryController.IstioClient.NetworkingV1alpha3().ServiceEntries("namespace").Get(ctx, c.oldSe.Name, v12.GetOptions{}) + if err != nil { + t.Error(err) + } _, diff := getServiceEntryDiff(c.oldSe, se) if diff != "" { t.Errorf("Failed. Got %v, expected %v", se.Spec.String(), c.oldSe.Spec.String()) diff --git a/admiral/pkg/clusters/registry.go b/admiral/pkg/clusters/registry.go index e3453d01..4cbe79b5 100644 --- a/admiral/pkg/clusters/registry.go +++ b/admiral/pkg/clusters/registry.go @@ -3,11 +3,12 @@ package clusters import ( "context" "fmt" - "github.com/istio-ecosystem/admiral/admiral/pkg/controller/istio" - "k8s.io/client-go/rest" "os" "time" + "github.com/istio-ecosystem/admiral/admiral/pkg/controller/istio" + "k8s.io/client-go/rest" + "github.com/istio-ecosystem/admiral/admiral/pkg/controller/admiral" "github.com/istio-ecosystem/admiral/admiral/pkg/controller/common" "github.com/istio-ecosystem/admiral/admiral/pkg/controller/secret" @@ -50,7 +51,7 @@ func InitAdmiral(ctx context.Context, params common.AdmiralParams) (*RemoteRegis return nil, fmt.Errorf("error with configmap controller init: %v", err) } w.AdmiralCache.ConfigMapController = configMapController - loadServiceEntryCacheData(w.AdmiralCache.ConfigMapController, w.AdmiralCache) + loadServiceEntryCacheData(ctx, w.AdmiralCache.ConfigMapController, w.AdmiralCache) err = createSecretController(ctx, w) if err != nil { @@ -90,12 +91,12 @@ func createSecretController(ctx context.Context, w *RemoteRegistry) error { return fmt.Errorf("could not create K8s client: %v", err) } - controller, err = secret.StartSecretController(w.secretClient, + controller, err = secret.StartSecretController(ctx, w.secretClient, w.createCacheController, w.updateCacheController, w.deleteCacheController, common.GetClusterRegistriesNamespace(), - ctx, common.GetSecretResolver()) + common.GetSecretResolver()) if err != nil { return fmt.Errorf("could not start secret controller: %v", err) @@ -185,9 +186,9 @@ func (r *RemoteRegistry) createCacheController(clientConfig *rest.Config, cluste return fmt.Errorf("error with Rollout controller init: %v", err) } } - + log.Infof("starting Routing Policies controller for custerID: %v", clusterID) - rc.RoutingPolicyController, err = admiral.NewRoutingPoliciesController(stop, &RoutingPolicyHandler{RemoteRegistry: r, ClusterID: clusterID}, clientConfig, 1 * time.Minute) + rc.RoutingPolicyController, err = admiral.NewRoutingPoliciesController(stop, &RoutingPolicyHandler{RemoteRegistry: r, ClusterID: clusterID}, clientConfig, 1*time.Minute) if err != nil { return fmt.Errorf("error with virtualServiceController init: %v", err) diff --git a/admiral/pkg/clusters/registry_test.go b/admiral/pkg/clusters/registry_test.go index d51a5f5a..fa7c662b 100644 --- a/admiral/pkg/clusters/registry_test.go +++ b/admiral/pkg/clusters/registry_test.go @@ -2,9 +2,13 @@ package clusters import ( "context" + "strings" + "testing" + "time" + "github.com/google/go-cmp/cmp" depModel "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/model" - "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/v1" + v1 "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/v1" "github.com/istio-ecosystem/admiral/admiral/pkg/controller/admiral" "github.com/istio-ecosystem/admiral/admiral/pkg/controller/common" "github.com/istio-ecosystem/admiral/admiral/pkg/test" @@ -17,9 +21,6 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/rest" "k8s.io/client-go/tools/clientcmd" - "strings" - "testing" - "time" ) func init() { @@ -102,7 +103,7 @@ func TestCopyServiceEntry(t *testing.T) { func TestCopyEndpoint(t *testing.T) { - se := networking.ServiceEntry_Endpoint{ + se := networking.WorkloadEntry{ Address: "127.0.0.1", } @@ -121,6 +122,7 @@ func TestCopySidecar(t *testing.T) { }, } + //nolint sidecar := v1alpha3.Sidecar{Spec: spec} newSidecar := copySidecar(&sidecar) @@ -172,7 +174,8 @@ func createMockRemoteController(f func(interface{})) (*RemoteController, error) }, }, } - d.Added(&deployment) + ctx := context.Background() + d.Added(ctx, &deployment) service := k8sCoreV1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "test", @@ -185,14 +188,14 @@ func createMockRemoteController(f func(interface{})) (*RemoteController, error) }, }, } - s.Added(&service) + s.Added(ctx, &service) rc := RemoteController{ - DeploymentController: d, - ServiceController: s, - NodeController: n, - ClusterID: "test.cluster", - RolloutController: r, + DeploymentController: d, + ServiceController: s, + NodeController: n, + ClusterID: "test.cluster", + RolloutController: r, RoutingPolicyController: rpc, } return &rc, nil @@ -241,7 +244,7 @@ func TestInitAdmiral(t *testing.T) { } func TestAdded(t *testing.T) { - + ctx := context.Background() p := common.AdmiralParams{ KubeconfigPath: "testdata/fake.config", } @@ -270,8 +273,8 @@ func TestAdded(t *testing.T) { }, } - dh.Added(&depData) - dh.Deleted(&depData) + dh.Added(ctx, &depData) + dh.Deleted(ctx, &depData) } diff --git a/admiral/pkg/clusters/serviceentry.go b/admiral/pkg/clusters/serviceentry.go index 48fd32b6..327e8394 100644 --- a/admiral/pkg/clusters/serviceentry.go +++ b/admiral/pkg/clusters/serviceentry.go @@ -1,6 +1,7 @@ package clusters import ( + "context" "errors" "fmt" "math" @@ -12,10 +13,10 @@ import ( "time" v1 "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/v1" + "gopkg.in/yaml.v2" argo "github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1" log "github.com/sirupsen/logrus" - "gopkg.in/yaml.v2" networking "istio.io/api/networking/v1alpha3" "istio.io/client-go/pkg/apis/networking/v1alpha3" k8sAppsV1 "k8s.io/api/apps/v1" @@ -34,7 +35,7 @@ type SeDrTuple struct { DestinationRule *networking.DestinationRule } -func createServiceEntry(event admiral.EventType, rc *RemoteController, admiralCache *AdmiralCache, +func createServiceEntry(ctx context.Context, event admiral.EventType, rc *RemoteController, admiralCache *AdmiralCache, meshPorts map[string]uint32, destDeployment *k8sAppsV1.Deployment, serviceEntries map[string]*networking.ServiceEntry) *networking.ServiceEntry { workloadIdentityKey := common.GetWorkloadIdentifier() @@ -42,7 +43,7 @@ func createServiceEntry(event admiral.EventType, rc *RemoteController, admiralCa //Handling retries for getting/putting service entries from/in cache - address := getUniqueAddress(admiralCache, globalFqdn) + address := getUniqueAddress(ctx, admiralCache, globalFqdn) if len(globalFqdn) == 0 || len(address) == 0 { return nil @@ -54,7 +55,7 @@ func createServiceEntry(event admiral.EventType, rc *RemoteController, admiralCa return tmpSe } -func modifyServiceEntryForNewServiceOrPod(event admiral.EventType, env string, sourceIdentity string, remoteRegistry *RemoteRegistry) map[string]*networking.ServiceEntry { +func modifyServiceEntryForNewServiceOrPod(ctx context.Context, event admiral.EventType, env string, sourceIdentity string, remoteRegistry *RemoteRegistry) map[string]*networking.ServiceEntry { defer util.LogElapsedTime("modifyServiceEntryForNewServiceOrPod", sourceIdentity, env, "")() @@ -119,10 +120,11 @@ func modifyServiceEntryForNewServiceOrPod(event admiral.EventType, env string, s cname = common.GetCname(deployment, common.GetWorkloadIdentifier(), common.GetHostnameSuffix()) sourceDeployments[rc.ClusterID] = deployment - createServiceEntry(event, rc, remoteRegistry.AdmiralCache, localMeshPorts, deployment, serviceEntries) + createServiceEntry(ctx, event, rc, remoteRegistry.AdmiralCache, localMeshPorts, deployment, serviceEntries) } else if rollout != nil { remoteRegistry.AdmiralCache.IdentityClusterCache.Put(sourceIdentity, rc.ClusterID, rc.ClusterID) - weightedServices = getServiceForRollout(rc, rollout) + weightedServices = getServiceForRollout(ctx, rc, rollout) + if len(weightedServices) == 0 { continue } @@ -138,7 +140,8 @@ func modifyServiceEntryForNewServiceOrPod(event admiral.EventType, env string, s cname = common.GetCnameForRollout(rollout, common.GetWorkloadIdentifier(), common.GetHostnameSuffix()) cnames[cname] = "1" sourceRollouts[rc.ClusterID] = rollout - createServiceEntryForRollout(event, rc, remoteRegistry.AdmiralCache, localMeshPorts, rollout, serviceEntries) + createServiceEntryForRollout(ctx, event, rc, remoteRegistry.AdmiralCache, localMeshPorts, rollout, serviceEntries) + } else { continue } @@ -152,7 +155,7 @@ func modifyServiceEntryForNewServiceOrPod(event admiral.EventType, env string, s } else { log.Debugf("No GTPs found for identity=%s in env=%s namespace=%s with key=%s", sourceIdentity, env, namespace, gtpKey) } - + remoteRegistry.AdmiralCache.IdentityClusterCache.Put(sourceIdentity, rc.ClusterID, rc.ClusterID) // workload selector cache is needed for routingPolicy's envoyFilter to match the dependency and apply to the right POD // using service labels @@ -192,7 +195,8 @@ func modifyServiceEntryForNewServiceOrPod(event admiral.EventType, env string, s for key, serviceEntry := range serviceEntries { if len(serviceEntry.Endpoints) == 0 { - AddServiceEntriesWithDr(remoteRegistry, map[string]string{sourceCluster: sourceCluster}, + AddServiceEntriesWithDr(ctx, remoteRegistry, map[string]string{sourceCluster: sourceCluster}, + map[string]*networking.ServiceEntry{key: serviceEntry}) } clusterIngress, _ := rc.ServiceController.Cache.GetLoadBalancer(common.GetAdmiralParams().LabelSet.GatewayApp, common.NamespaceIstioSystem) @@ -204,7 +208,8 @@ func modifyServiceEntryForNewServiceOrPod(event admiral.EventType, env string, s oldPorts := ep.Ports updateEndpointsForBlueGreen(sourceRollouts[sourceCluster], sourceWeightedServices[sourceCluster], cnames, ep, sourceCluster, key) - AddServiceEntriesWithDr(remoteRegistry, map[string]string{sourceCluster: sourceCluster}, + AddServiceEntriesWithDr(ctx, remoteRegistry, map[string]string{sourceCluster: sourceCluster}, + map[string]*networking.ServiceEntry{key: serviceEntry}) //swap it back to use for next iteration ep.Address = clusterIngress @@ -214,13 +219,15 @@ func modifyServiceEntryForNewServiceOrPod(event admiral.EventType, env string, s //add one endpoint per each service, may be modify var se = copyServiceEntry(serviceEntry) updateEndpointsForWeightedServices(se, sourceWeightedServices[sourceCluster], clusterIngress, meshPorts) - AddServiceEntriesWithDr(remoteRegistry, map[string]string{sourceCluster: sourceCluster}, + AddServiceEntriesWithDr(ctx, remoteRegistry, map[string]string{sourceCluster: sourceCluster}, + map[string]*networking.ServiceEntry{key: se}) } else { ep.Address = localFqdn oldPorts := ep.Ports ep.Ports = meshPorts - AddServiceEntriesWithDr(remoteRegistry, map[string]string{sourceCluster: sourceCluster}, + AddServiceEntriesWithDr(ctx, remoteRegistry, map[string]string{sourceCluster: sourceCluster}, + map[string]*networking.ServiceEntry{key: serviceEntry}) //swap it back to use for next iteration ep.Address = clusterIngress @@ -231,7 +238,7 @@ func modifyServiceEntryForNewServiceOrPod(event admiral.EventType, env string, s } if common.GetWorkloadSidecarUpdate() == "enabled" { - modifySidecarForLocalClusterCommunication(serviceInstance.Namespace, remoteRegistry.AdmiralCache.DependencyNamespaceCache.Get(sourceIdentity), rc) + modifySidecarForLocalClusterCommunication(ctx, serviceInstance.Namespace, remoteRegistry.AdmiralCache.DependencyNamespaceCache.Get(sourceIdentity), rc) } for _, val := range dependents { @@ -253,7 +260,7 @@ func modifyServiceEntryForNewServiceOrPod(event admiral.EventType, env string, s remoteRegistry.AdmiralCache.CnameDependentClusterCache.Put(cname, clusterId, clusterId) } - AddServiceEntriesWithDr(remoteRegistry, dependentClusters, serviceEntries) + AddServiceEntriesWithDr(ctx, remoteRegistry, dependentClusters, serviceEntries) util.LogElapsedTimeSince("WriteServiceEntryToDependentClusters", sourceIdentity, env, "", start) @@ -315,7 +322,7 @@ func getGtpPriority(gtp *v1.GlobalTrafficPolicy) int { return 0 } func updateEndpointsForBlueGreen(rollout *argo.Rollout, weightedServices map[string]*WeightedService, cnames map[string]string, - ep *networking.ServiceEntry_Endpoint, sourceCluster string, meshHost string) { + ep *networking.WorkloadEntry, sourceCluster string, meshHost string) { activeServiceName := rollout.Spec.Strategy.BlueGreen.ActiveService previewServiceName := rollout.Spec.Strategy.BlueGreen.PreviewService @@ -336,8 +343,8 @@ func updateEndpointsForBlueGreen(rollout *argo.Rollout, weightedServices map[str //update endpoints for Argo rollouts specific Service Entries to account for traffic splitting (Canary strategy) func updateEndpointsForWeightedServices(serviceEntry *networking.ServiceEntry, weightedServices map[string]*WeightedService, clusterIngress string, meshPorts map[string]uint32) { - var endpoints = make([]*networking.ServiceEntry_Endpoint, 0) - var endpointToReplace *networking.ServiceEntry_Endpoint + var endpoints = make([]*networking.WorkloadEntry, 0) + var endpointToReplace *networking.WorkloadEntry //collect all endpoints except the one to replace for _, ep := range serviceEntry.Endpoints { @@ -367,7 +374,7 @@ func updateEndpointsForWeightedServices(serviceEntry *networking.ServiceEntry, w serviceEntry.Endpoints = endpoints } -func modifySidecarForLocalClusterCommunication(sidecarNamespace string, sidecarEgressMap map[string]common.SidecarEgress, rc *RemoteController) { +func modifySidecarForLocalClusterCommunication(ctx context.Context, sidecarNamespace string, sidecarEgressMap map[string]common.SidecarEgress, rc *RemoteController) { //get existing sidecar from the cluster sidecarConfig := rc.SidecarController @@ -376,7 +383,7 @@ func modifySidecarForLocalClusterCommunication(sidecarNamespace string, sidecarE return } - sidecar, _ := sidecarConfig.IstioClient.NetworkingV1alpha3().Sidecars(sidecarNamespace).Get(common.GetWorkloadSidecarName(), v12.GetOptions{}) + sidecar, _ := sidecarConfig.IstioClient.NetworkingV1alpha3().Sidecars(sidecarNamespace).Get(ctx, common.GetWorkloadSidecarName(), v12.GetOptions{}) if sidecar == nil || (sidecar.Spec.Egress == nil) { return @@ -402,20 +409,18 @@ func modifySidecarForLocalClusterCommunication(sidecarNamespace string, sidecarE } } + //nolint newSidecarConfig := createSidecarSkeletion(newSidecar.Spec, common.GetWorkloadSidecarName(), sidecarNamespace) //insert into cluster if newSidecarConfig != nil { - addUpdateSidecar(newSidecarConfig, sidecar, sidecarNamespace, rc) + addUpdateSidecar(ctx, newSidecarConfig, sidecar, sidecarNamespace, rc) } } -func addUpdateSidecar(obj *v1alpha3.Sidecar, exist *v1alpha3.Sidecar, namespace string, rc *RemoteController) { +func addUpdateSidecar(ctx context.Context, obj *v1alpha3.Sidecar, exist *v1alpha3.Sidecar, namespace string, rc *RemoteController) { var err error - exist.Labels = obj.Labels - exist.Annotations = obj.Annotations - exist.Spec = obj.Spec - _, err = rc.SidecarController.IstioClient.NetworkingV1alpha3().Sidecars(namespace).Update(exist) + _, err = rc.SidecarController.IstioClient.NetworkingV1alpha3().Sidecars(namespace).Update(ctx, obj, v12.UpdateOptions{}) if err != nil { log.Infof(LogErrFormat, "Update", "Sidecar", obj.Name, rc.ClusterID, err) @@ -432,8 +437,8 @@ func copySidecar(sidecar *v1alpha3.Sidecar) *v1alpha3.Sidecar { return newSidecarObj } -//This will create the default service entries and also additional ones specified in GTP -func AddServiceEntriesWithDr(rr *RemoteRegistry, sourceClusters map[string]string, serviceEntries map[string]*networking.ServiceEntry) { +//AddServiceEntriesWithDr will create the default service entries and also additional ones specified in GTP +func AddServiceEntriesWithDr(ctx context.Context, rr *RemoteRegistry, sourceClusters map[string]string, serviceEntries map[string]*networking.ServiceEntry) { cache := rr.AdmiralCache @@ -460,16 +465,16 @@ func AddServiceEntriesWithDr(rr *RemoteRegistry, sourceClusters map[string]strin } //check if there is a gtp and add additional hosts/destination rules - var seDrSet = createSeAndDrSetFromGtp(env, rc.NodeController.Locality.Region, se, globalTrafficPolicy, cache) + var seDrSet = createSeAndDrSetFromGtp(ctx, env, rc.NodeController.Locality.Region, se, globalTrafficPolicy, cache) for _, seDr := range seDrSet { - oldServiceEntry, err := rc.ServiceEntryController.IstioClient.NetworkingV1alpha3().ServiceEntries(syncNamespace).Get(seDr.SeName, v12.GetOptions{}) + oldServiceEntry, err := rc.ServiceEntryController.IstioClient.NetworkingV1alpha3().ServiceEntries(syncNamespace).Get(ctx, seDr.SeName, v12.GetOptions{}) // if old service entry not find, just create a new service entry instead if err != nil { log.Infof(LogFormat, "Get (error)", "old ServiceEntry", seDr.SeName, sourceCluster, err) oldServiceEntry = nil } - oldDestinationRule, err := rc.DestinationRuleController.IstioClient.NetworkingV1alpha3().DestinationRules(syncNamespace).Get(seDr.DrName, v12.GetOptions{}) + oldDestinationRule, err := rc.DestinationRuleController.IstioClient.NetworkingV1alpha3().DestinationRules(syncNamespace).Get(ctx, seDr.DrName, v12.GetOptions{}) if err != nil { log.Infof(LogFormat, "Get (error)", "old DestinationRule", seDr.DrName, sourceCluster, err) @@ -477,29 +482,31 @@ func AddServiceEntriesWithDr(rr *RemoteRegistry, sourceClusters map[string]strin } if len(seDr.ServiceEntry.Endpoints) == 0 { - deleteServiceEntry(oldServiceEntry, syncNamespace, rc) + deleteServiceEntry(ctx, oldServiceEntry, syncNamespace, rc) cache.SeClusterCache.Delete(seDr.ServiceEntry.Hosts[0]) // after deleting the service entry, destination rule also need to be deleted if the service entry host no longer exists - deleteDestinationRule(oldDestinationRule, syncNamespace, rc) + deleteDestinationRule(ctx, oldDestinationRule, syncNamespace, rc) } else { + //nolint newServiceEntry := createServiceEntrySkeletion(*seDr.ServiceEntry, seDr.SeName, syncNamespace) if newServiceEntry != nil { newServiceEntry.Labels = map[string]string{common.GetWorkloadIdentifier(): fmt.Sprintf("%v", identityId)} - addUpdateServiceEntry(newServiceEntry, oldServiceEntry, syncNamespace, rc) + addUpdateServiceEntry(ctx, newServiceEntry, oldServiceEntry, syncNamespace, rc) cache.SeClusterCache.Put(newServiceEntry.Spec.Hosts[0], rc.ClusterID, rc.ClusterID) } + //nolint newDestinationRule := createDestinationRuleSkeletion(*seDr.DestinationRule, seDr.DrName, syncNamespace) // if event was deletion when this function was called, then GlobalTrafficCache should already deleted the cache globalTrafficPolicy is an empty shell object - addUpdateDestinationRule(newDestinationRule, oldDestinationRule, syncNamespace, rc) + addUpdateDestinationRule(ctx, newDestinationRule, oldDestinationRule, syncNamespace, rc) } } } } } -func createSeAndDrSetFromGtp(env, region string, se *networking.ServiceEntry, globalTrafficPolicy *v1.GlobalTrafficPolicy, +func createSeAndDrSetFromGtp(ctx context.Context, env, region string, se *networking.ServiceEntry, globalTrafficPolicy *v1.GlobalTrafficPolicy, cache *AdmiralCache) map[string]*SeDrTuple { var defaultDrName = getIstioResourceName(se.Hosts[0], "-default-dr") var defaultSeName = getIstioResourceName(se.Hosts[0], "-se") @@ -519,7 +526,7 @@ func createSeAndDrSetFromGtp(env, region string, se *networking.ServiceEntry, gl drName, seName = getIstioResourceName(host, "-dr"), getIstioResourceName(host, "-se") modifiedSe = copyServiceEntry(se) modifiedSe.Hosts[0] = host - modifiedSe.Addresses[0] = getUniqueAddress(cache, host) + modifiedSe.Addresses[0] = getUniqueAddress(ctx, cache, host) } var seDr = &SeDrTuple{ DrName: drName, @@ -543,8 +550,8 @@ func createSeAndDrSetFromGtp(env, region string, se *networking.ServiceEntry, gl return seDrSet } -func makeRemoteEndpointForServiceEntry(address string, locality string, portName string, portNumber int) *networking.ServiceEntry_Endpoint { - return &networking.ServiceEntry_Endpoint{Address: address, +func makeRemoteEndpointForServiceEntry(address string, locality string, portName string, portNumber int) *networking.WorkloadEntry { + return &networking.WorkloadEntry{Address: address, Locality: locality, Ports: map[string]uint32{portName: uint32(portNumber)}} // } @@ -555,8 +562,8 @@ func copyServiceEntry(se *networking.ServiceEntry) *networking.ServiceEntry { return newSe } -func loadServiceEntryCacheData(c admiral.ConfigMapControllerInterface, admiralCache *AdmiralCache) { - configmap, err := c.GetConfigMap() +func loadServiceEntryCacheData(ctx context.Context, c admiral.ConfigMapControllerInterface, admiralCache *AdmiralCache) { + configmap, err := c.GetConfigMap(ctx) if err != nil { log.Warnf("Failed to refresh configmap state Error: %v", err) return //No need to invalidate the cache @@ -571,21 +578,22 @@ func loadServiceEntryCacheData(c admiral.ConfigMapControllerInterface, admiralCa } -//Gets a guarenteed unique local address for a serviceentry. Returns the address, True iff the configmap was updated false otherwise, and an error if any +//GetLocalAddressForSe gets a guarenteed unique local address for a serviceentry. Returns the address, True iff the configmap was updated false otherwise, and an error if any //Any error coupled with an empty string address means the method should be retried -func GetLocalAddressForSe(seName string, seAddressCache *ServiceEntryAddressStore, configMapController admiral.ConfigMapControllerInterface) (string, bool, error) { +func GetLocalAddressForSe(ctx context.Context, seName string, seAddressCache *ServiceEntryAddressStore, configMapController admiral.ConfigMapControllerInterface) (string, bool, error) { var address = seAddressCache.EntryAddresses[seName] if len(address) == 0 { - address, err := GenerateNewAddressAndAddToConfigMap(seName, configMapController) + address, err := GenerateNewAddressAndAddToConfigMap(ctx, seName, configMapController) return address, true, err } return address, false, nil } -func GetServiceEntriesByCluster(clusterID string, remoteRegistry *RemoteRegistry) ([]v1alpha3.ServiceEntry, error) { +func GetServiceEntriesByCluster(ctx context.Context, clusterID string, remoteRegistry *RemoteRegistry) ([]*v1alpha3.ServiceEntry, error) { remoteController := remoteRegistry.GetRemoteController(clusterID) + if remoteController != nil { - serviceEnteries, err := remoteController.ServiceEntryController.IstioClient.NetworkingV1alpha3().ServiceEntries(common.GetSyncNamespace()).List(v12.ListOptions{}) + serviceEnteries, err := remoteController.ServiceEntryController.IstioClient.NetworkingV1alpha3().ServiceEntries(common.GetSyncNamespace()).List(ctx, v12.ListOptions{}) if err != nil { log.Errorf(LogFormat, "Get", "ServiceEntries", "", clusterID, err) @@ -599,10 +607,10 @@ func GetServiceEntriesByCluster(clusterID string, remoteRegistry *RemoteRegistry } } -//an atomic fetch and update operation against the configmap (using K8s built in optimistic consistency mechanism via resource version) -func GenerateNewAddressAndAddToConfigMap(seName string, configMapController admiral.ConfigMapControllerInterface) (string, error) { +//GenerateNewAddressAndAddToConfigMap an atomic fetch and update operation against the configmap (using K8s built in optimistic consistency mechanism via resource version) +func GenerateNewAddressAndAddToConfigMap(ctx context.Context, seName string, configMapController admiral.ConfigMapControllerInterface) (string, error) { //1. get cm, see if there. 2. gen new uq address. 3. put configmap. RETURN SUCCESSFULLY IFF CONFIGMAP PUT SUCCEEDS - cm, err := configMapController.GetConfigMap() + cm, err := configMapController.GetConfigMap(ctx) if err != nil { return "", err } @@ -633,7 +641,7 @@ func GenerateNewAddressAndAddToConfigMap(seName string, configMapController admi newAddressState.Addresses = append(newAddressState.Addresses, address) newAddressState.EntryAddresses[seName] = address - err = putServiceEntryStateFromConfigmap(configMapController, cm, newAddressState) + err = putServiceEntryStateFromConfigmap(ctx, configMapController, cm, newAddressState) if err != nil { return "", err @@ -642,7 +650,7 @@ func GenerateNewAddressAndAddToConfigMap(seName string, configMapController admi } //puts new data into an existing configmap. Providing the original is necessary to prevent fetch and update race conditions -func putServiceEntryStateFromConfigmap(c admiral.ConfigMapControllerInterface, originalConfigmap *k8sV1.ConfigMap, data *ServiceEntryAddressStore) error { +func putServiceEntryStateFromConfigmap(ctx context.Context, c admiral.ConfigMapControllerInterface, originalConfigmap *k8sV1.ConfigMap, data *ServiceEntryAddressStore) error { if originalConfigmap == nil { return errors.New("configmap must not be nil") } @@ -666,10 +674,10 @@ func putServiceEntryStateFromConfigmap(c admiral.ConfigMapControllerInterface, o return err } - return c.PutConfigMap(originalConfigmap) + return c.PutConfigMap(ctx, originalConfigmap) } -func createServiceEntryForRollout(event admiral.EventType, rc *RemoteController, admiralCache *AdmiralCache, +func createServiceEntryForRollout(ctx context.Context, event admiral.EventType, rc *RemoteController, admiralCache *AdmiralCache, meshPorts map[string]uint32, destRollout *argo.Rollout, serviceEntries map[string]*networking.ServiceEntry) *networking.ServiceEntry { workloadIdentityKey := common.GetWorkloadIdentifier() @@ -677,7 +685,7 @@ func createServiceEntryForRollout(event admiral.EventType, rc *RemoteController, //Handling retries for getting/putting service entries from/in cache - address := getUniqueAddress(admiralCache, globalFqdn) + address := getUniqueAddress(ctx, admiralCache, globalFqdn) if len(globalFqdn) == 0 || len(address) == 0 { return nil @@ -686,10 +694,10 @@ func createServiceEntryForRollout(event admiral.EventType, rc *RemoteController, san := getSanForRollout(destRollout, workloadIdentityKey) if destRollout.Spec.Strategy.BlueGreen != nil && destRollout.Spec.Strategy.BlueGreen.PreviewService != "" { - rolloutServices := getServiceForRollout(rc, destRollout) + rolloutServices := getServiceForRollout(ctx, rc, destRollout) if _, ok := rolloutServices[destRollout.Spec.Strategy.BlueGreen.PreviewService]; ok { previewGlobalFqdn := common.BlueGreenRolloutPreviewPrefix + common.Sep + common.GetCnameForRollout(destRollout, workloadIdentityKey, common.GetHostnameSuffix()) - previewAddress := getUniqueAddress(admiralCache, previewGlobalFqdn) + previewAddress := getUniqueAddress(ctx, admiralCache, previewGlobalFqdn) if len(previewGlobalFqdn) != 0 && len(previewAddress) != 0 { generateServiceEntry(event, admiralCache, meshPorts, previewGlobalFqdn, rc, serviceEntries, previewAddress, san) } @@ -722,7 +730,7 @@ func getSanForRollout(destRollout *argo.Rollout, workloadIdentityKey string) (sa } -func getUniqueAddress(admiralCache *AdmiralCache, globalFqdn string) (address string) { +func getUniqueAddress(ctx context.Context, admiralCache *AdmiralCache, globalFqdn string) (address string) { //initializations var err error = nil @@ -732,7 +740,7 @@ func getUniqueAddress(admiralCache *AdmiralCache, globalFqdn string) (address st needsCacheUpdate := false for err == nil && counter < maxRetries { - address, needsCacheUpdate, err = GetLocalAddressForSe(getIstioResourceName(globalFqdn, "-se"), admiralCache.ServiceEntryAddressStore, admiralCache.ConfigMapController) + address, needsCacheUpdate, err = GetLocalAddressForSe(ctx, getIstioResourceName(globalFqdn, "-se"), admiralCache.ServiceEntryAddressStore, admiralCache.ConfigMapController) if err != nil { log.Errorf("Error getting local address for Service Entry. Err: %v", err) @@ -752,7 +760,7 @@ func getUniqueAddress(admiralCache *AdmiralCache, globalFqdn string) (address st } if needsCacheUpdate { - loadServiceEntryCacheData(admiralCache.ConfigMapController, admiralCache) + loadServiceEntryCacheData(ctx, admiralCache.ConfigMapController, admiralCache) } return address @@ -783,7 +791,7 @@ func generateServiceEntry(event admiral.EventType, admiralCache *AdmiralCache, m Addresses: []string{address}, //It is possible that the address is an empty string. That is fine as the se creation will fail and log an error SubjectAltNames: san, } - tmpSe.Endpoints = []*networking.ServiceEntry_Endpoint{} + tmpSe.Endpoints = []*networking.WorkloadEntry{} } endpointAddress, port := rc.ServiceController.Cache.GetLoadBalancer(common.GetAdmiralParams().LabelSet.GatewayApp, common.NamespaceIstioSystem) @@ -800,7 +808,7 @@ func generateServiceEntry(event admiral.EventType, admiralCache *AdmiralCache, m tmpSe.Endpoints = append(tmpSe.Endpoints, seEndpoint) } else if event == admiral.Delete { // create a tmp endpoint list to store all the endpoints that we intend to keep - remainEndpoints := []*networking.ServiceEntry_Endpoint{} + remainEndpoints := []*networking.WorkloadEntry{} // if the endpoint is not equal to the endpoint we intend to delete, append it to remainEndpoint list for _, existingEndpoint := range tmpSe.Endpoints { if !reflect.DeepEqual(existingEndpoint, seEndpoint) { diff --git a/admiral/pkg/clusters/serviceentry_test.go b/admiral/pkg/clusters/serviceentry_test.go index ed7f46d4..7558f3c6 100644 --- a/admiral/pkg/clusters/serviceentry_test.go +++ b/admiral/pkg/clusters/serviceentry_test.go @@ -20,6 +20,7 @@ import ( "github.com/istio-ecosystem/admiral/admiral/pkg/controller/istio" "github.com/istio-ecosystem/admiral/admiral/pkg/test" "github.com/stretchr/testify/assert" + "google.golang.org/protobuf/testing/protocmp" "gopkg.in/yaml.v2" istionetworkingv1alpha3 "istio.io/api/networking/v1alpha3" "istio.io/client-go/pkg/apis/networking/v1alpha3" @@ -68,24 +69,27 @@ func TestAddServiceEntriesWithDr(t *testing.T) { se := istionetworkingv1alpha3.ServiceEntry{ Hosts: []string{"dev.bar.global"}, - Endpoints: []*istionetworkingv1alpha3.ServiceEntry_Endpoint{ + Endpoints: []*istionetworkingv1alpha3.WorkloadEntry{ {Address: "127.0.0.1", Ports: map[string]uint32{"https": 80}, Labels: map[string]string{}, Network: "mesh1", Locality: "us-west", Weight: 100}, }, } emptyEndpointSe := istionetworkingv1alpha3.ServiceEntry{ Hosts: []string{"dev.bar.global"}, - Endpoints: []*istionetworkingv1alpha3.ServiceEntry_Endpoint{}, + Endpoints: []*istionetworkingv1alpha3.WorkloadEntry{}, } seConfig := v1alpha3.ServiceEntry{ + //nolint Spec: se, } seConfig.Name = "se1" seConfig.Namespace = "admiral-sync" + ctx := context.Background() + fakeIstioClient := istiofake.NewSimpleClientset() - fakeIstioClient.NetworkingV1alpha3().ServiceEntries("admiral-sync").Create(&seConfig) + fakeIstioClient.NetworkingV1alpha3().ServiceEntries("admiral-sync").Create(ctx, &seConfig, v12.CreateOptions{}) rc := &RemoteController{ ServiceEntryController: &istio.ServiceEntryController{ IstioClient: fakeIstioClient, @@ -102,8 +106,8 @@ func TestAddServiceEntriesWithDr(t *testing.T) { rr := NewRemoteRegistry(nil, common.AdmiralParams{}) rr.PutRemoteController("c1", rc) rr.AdmiralCache = &admiralCache - AddServiceEntriesWithDr(rr, map[string]string{"cl1": "cl1"}, map[string]*istionetworkingv1alpha3.ServiceEntry{"se1": &se}) - AddServiceEntriesWithDr(rr, map[string]string{"cl1": "cl1"}, map[string]*istionetworkingv1alpha3.ServiceEntry{"se1": &emptyEndpointSe}) + AddServiceEntriesWithDr(ctx, rr, map[string]string{"cl1": "cl1"}, map[string]*istionetworkingv1alpha3.ServiceEntry{"se1": &se}) + AddServiceEntriesWithDr(ctx, rr, map[string]string{"cl1": "cl1"}, map[string]*istionetworkingv1alpha3.ServiceEntry{"se1": &emptyEndpointSe}) } func TestCreateSeAndDrSetFromGtp(t *testing.T) { @@ -136,7 +140,7 @@ func TestCreateSeAndDrSetFromGtp(t *testing.T) { se := &istionetworkingv1alpha3.ServiceEntry{ Addresses: []string{"240.10.1.0"}, Hosts: []string{host}, - Endpoints: []*istionetworkingv1alpha3.ServiceEntry_Endpoint{ + Endpoints: []*istionetworkingv1alpha3.WorkloadEntry{ {Address: "127.0.0.1", Ports: map[string]uint32{"https": 80}, Labels: map[string]string{}, Locality: "us-west-2"}, {Address: "240.20.0.1", Ports: map[string]uint32{"https": 80}, Labels: map[string]string{}, Locality: "us-east-2"}, }, @@ -239,11 +243,11 @@ func TestCreateSeAndDrSetFromGtp(t *testing.T) { strings.ToLower(common.GetCnameVal([]string{eastWithCaps, host})): nil}, }, } - + ctx := context.Background() //Run the test for every provided case for _, c := range testCases { t.Run(c.name, func(t *testing.T) { - result := createSeAndDrSetFromGtp(c.env, c.locality, c.se, c.gtp, &admiralCache) + result := createSeAndDrSetFromGtp(ctx, c.env, c.locality, c.se, c.gtp, &admiralCache) generatedHosts := make([]string, 0, len(result)) for generatedHost := range result { generatedHosts = append(generatedHosts, generatedHost) @@ -298,7 +302,7 @@ func TestCreateServiceEntryForNewServiceOrPod(t *testing.T) { } rr.PutRemoteController("test.cluster", rc) - modifyServiceEntryForNewServiceOrPod(admiral.Add, "test", "bar", rr) + modifyServiceEntryForNewServiceOrPod(context.Background(), admiral.Add, "test", "bar", rr) } @@ -417,10 +421,10 @@ func TestGetLocalAddressForSe(t *testing.T) { wantedError: errors.New("BAD THINGS HAPPENED"), }, } - + ctx := context.Background() for _, c := range testCases { t.Run(c.name, func(t *testing.T) { - seAddress, needsCacheUpdate, err := GetLocalAddressForSe(c.seName, &c.seAddressCache, c.cacheController) + seAddress, needsCacheUpdate, err := GetLocalAddressForSe(ctx, c.seName, &c.seAddressCache, c.cacheController) if c.wantAddess != "" { if !reflect.DeepEqual(seAddress, c.wantAddess) { t.Errorf("Wanted se address: %s, got: %s", c.wantAddess, seAddress) @@ -482,10 +486,14 @@ func TestModifyNonExistingSidecarForLocalClusterCommunication(t *testing.T) { sidecarEgressMap := make(map[string]common.SidecarEgress) sidecarEgressMap["test-dependency-namespace"] = common.SidecarEgress{Namespace: "test-dependency-namespace", FQDN: "test-local-fqdn"} + ctx := context.Background() - modifySidecarForLocalClusterCommunication("test-sidecar-namespace", sidecarEgressMap, remoteController) + modifySidecarForLocalClusterCommunication(ctx, "test-sidecar-namespace", sidecarEgressMap, remoteController) - sidecarObj, _ := sidecarController.IstioClient.NetworkingV1alpha3().Sidecars("test-sidecar-namespace").Get(common.GetWorkloadSidecarName(), v12.GetOptions{}) + sidecarObj, err := sidecarController.IstioClient.NetworkingV1alpha3().Sidecars("test-sidecar-namespace").Get(ctx, common.GetWorkloadSidecarName(), v12.GetOptions{}) + if err == nil { + t.Errorf("expected 404 not found error but got nil") + } if sidecarObj != nil { t.Fatalf("Modify non existing resource failed, as no new resource should be created.") @@ -512,15 +520,18 @@ func TestModifyExistingSidecarForLocalClusterCommunication(t *testing.T) { Egress: []*istionetworkingv1alpha3.IstioEgressListener{&istioEgress}, } - createdSidecar, _ := sidecarController.IstioClient.NetworkingV1alpha3().Sidecars("test-sidecar-namespace").Create(existingSidecarObj) - + ctx := context.Background() + createdSidecar, err := sidecarController.IstioClient.NetworkingV1alpha3().Sidecars("test-sidecar-namespace").Create(ctx, existingSidecarObj, v12.CreateOptions{}) + if err != nil { + t.Error(err) + } if createdSidecar != nil { sidecarEgressMap := make(map[string]common.SidecarEgress) sidecarEgressMap["test-dependency-namespace"] = common.SidecarEgress{Namespace: "test-dependency-namespace", FQDN: "test-local-fqdn", CNAMEs: map[string]string{"test.myservice.global": "1"}} - modifySidecarForLocalClusterCommunication("test-sidecar-namespace", sidecarEgressMap, remoteController) + modifySidecarForLocalClusterCommunication(ctx, "test-sidecar-namespace", sidecarEgressMap, remoteController) - updatedSidecar, err := sidecarController.IstioClient.NetworkingV1alpha3().Sidecars("test-sidecar-namespace").Get("default", v12.GetOptions{}) + updatedSidecar, err := sidecarController.IstioClient.NetworkingV1alpha3().Sidecars("test-sidecar-namespace").Get(ctx, "default", v12.GetOptions{}) if err != nil || updatedSidecar == nil { t.Fail() @@ -535,7 +546,7 @@ func TestModifyExistingSidecarForLocalClusterCommunication(t *testing.T) { createdSidecar.Spec.Egress = createdSidecar.Spec.Egress[:0] updatedSidecar.Spec.Egress = updatedSidecar.Spec.Egress[:0] - if !cmp.Equal(updatedSidecar, createdSidecar) { + if !cmp.Equal(updatedSidecar, createdSidecar, protocmp.Transform()) { t.Fatalf("Modify existing sidecar failed as configuration is not same. Details - %v", cmp.Diff(updatedSidecar, createdSidecar)) } var matched *istionetworkingv1alpha3.IstioEgressListener @@ -554,7 +565,7 @@ func TestModifyExistingSidecarForLocalClusterCommunication(t *testing.T) { listener.Hosts = listener.Hosts[:0] matched.Hosts = matched.Hosts[:0] assert.ElementsMatch(t, oldHosts, newHosts, "hosts should match") - if !cmp.Equal(listener, matched) { + if !cmp.Equal(listener, matched, protocmp.Transform()) { t.Fatalf("Listeners do not match. Details - %v", cmp.Diff(listener, matched)) } } else { @@ -637,7 +648,7 @@ func TestCreateServiceEntry(t *testing.T) { Location: istionetworkingv1alpha3.ServiceEntry_MESH_INTERNAL, Resolution: istionetworkingv1alpha3.ServiceEntry_DNS, SubjectAltNames: []string{"spiffe://prefix/my-first-service"}, - Endpoints: []*istionetworkingv1alpha3.ServiceEntry_Endpoint{ + Endpoints: []*istionetworkingv1alpha3.WorkloadEntry{ {Address: "dummy.admiral.global", Ports: map[string]uint32{"http": 0}, Locality: "us-west-2"}, }, } @@ -650,7 +661,7 @@ func TestCreateServiceEntry(t *testing.T) { Location: istionetworkingv1alpha3.ServiceEntry_MESH_INTERNAL, Resolution: istionetworkingv1alpha3.ServiceEntry_DNS, SubjectAltNames: []string{"spiffe://prefix/my-first-service"}, - Endpoints: []*istionetworkingv1alpha3.ServiceEntry_Endpoint{ + Endpoints: []*istionetworkingv1alpha3.WorkloadEntry{ {Address: "dummy.admiral.global", Ports: map[string]uint32{"http": 0}, Locality: "us-west-2"}, }, } @@ -663,7 +674,7 @@ func TestCreateServiceEntry(t *testing.T) { Location: istionetworkingv1alpha3.ServiceEntry_MESH_INTERNAL, Resolution: istionetworkingv1alpha3.ServiceEntry_DNS, SubjectAltNames: []string{"spiffe://prefix/my-first-service"}, - Endpoints: []*istionetworkingv1alpha3.ServiceEntry_Endpoint{ + Endpoints: []*istionetworkingv1alpha3.WorkloadEntry{ {Address: "dummy.admiral.global", Ports: map[string]uint32{"http": 0}, Locality: "us-west-2"}, {Address: "dummy.admiral.global", Ports: map[string]uint32{"http": 0}, Locality: "us-east-2"}, }, @@ -677,7 +688,7 @@ func TestCreateServiceEntry(t *testing.T) { Location: istionetworkingv1alpha3.ServiceEntry_MESH_INTERNAL, Resolution: istionetworkingv1alpha3.ServiceEntry_DNS, SubjectAltNames: []string{"spiffe://prefix/my-first-service"}, - Endpoints: []*istionetworkingv1alpha3.ServiceEntry_Endpoint{ + Endpoints: []*istionetworkingv1alpha3.WorkloadEntry{ {Address: "dummy.admiral.global", Ports: map[string]uint32{"http": 0}, Locality: "us-west-2"}, {Address: "dummy.admiral.global", Ports: map[string]uint32{"http": 0}, Locality: "us-west-2"}, {Address: "dummy.admiral.global", Ports: map[string]uint32{"http": 0}, Locality: "us-east-2"}, @@ -691,7 +702,7 @@ func TestCreateServiceEntry(t *testing.T) { Location: istionetworkingv1alpha3.ServiceEntry_MESH_INTERNAL, Resolution: istionetworkingv1alpha3.ServiceEntry_DNS, SubjectAltNames: []string{"spiffe://prefix/my-first-service"}, - Endpoints: []*istionetworkingv1alpha3.ServiceEntry_Endpoint{ + Endpoints: []*istionetworkingv1alpha3.WorkloadEntry{ {Address: "dummy.admiral.global", Ports: map[string]uint32{"http": 0}, Locality: "us-east-2"}, }, } @@ -704,7 +715,7 @@ func TestCreateServiceEntry(t *testing.T) { Location: istionetworkingv1alpha3.ServiceEntry_MESH_INTERNAL, Resolution: istionetworkingv1alpha3.ServiceEntry_DNS, SubjectAltNames: []string{"spiffe://prefix/my-first-service"}, - Endpoints: []*istionetworkingv1alpha3.ServiceEntry_Endpoint{}, + Endpoints: []*istionetworkingv1alpha3.WorkloadEntry{}, } grpcSe := istionetworkingv1alpha3.ServiceEntry{ @@ -715,7 +726,7 @@ func TestCreateServiceEntry(t *testing.T) { Location: istionetworkingv1alpha3.ServiceEntry_MESH_INTERNAL, Resolution: istionetworkingv1alpha3.ServiceEntry_DNS, SubjectAltNames: []string{"spiffe://prefix/my-first-service"}, - Endpoints: []*istionetworkingv1alpha3.ServiceEntry_Endpoint{ + Endpoints: []*istionetworkingv1alpha3.WorkloadEntry{ {Address: "dummy.admiral.global", Ports: map[string]uint32{"grpc": 0}, Locality: "us-west-2"}, }, } @@ -788,11 +799,13 @@ func TestCreateServiceEntry(t *testing.T) { }, } + ctx := context.Background() + //Run the test for every provided case for _, c := range deploymentSeCreationTestCases { t.Run(c.name, func(t *testing.T) { var createdSE *istionetworkingv1alpha3.ServiceEntry - createdSE = createServiceEntry(c.action, c.rc, &c.admiralCache, c.meshPorts, &c.deployment, c.serviceEntries) + createdSE = createServiceEntry(ctx, c.action, c.rc, &c.admiralCache, c.meshPorts, &c.deployment, c.serviceEntries) if !reflect.DeepEqual(createdSE, c.expectedResult) { t.Errorf("Test %s failed, expected: %v got %v", c.name, c.expectedResult, createdSE) } @@ -832,7 +845,7 @@ func TestCreateServiceEntry(t *testing.T) { //Run the test for every provided case for _, c := range rolloutSeCreationTestCases { t.Run(c.name, func(t *testing.T) { - createdSE := createServiceEntryForRollout(admiral.Add, c.rc, &c.admiralCache, c.meshPorts, &c.rollout, map[string]*istionetworkingv1alpha3.ServiceEntry{}) + createdSE := createServiceEntryForRollout(ctx, admiral.Add, c.rc, &c.admiralCache, c.meshPorts, &c.rollout, map[string]*istionetworkingv1alpha3.ServiceEntry{}) if !reflect.DeepEqual(createdSE, c.expectedResult) { t.Errorf("Test %s failed, expected: %v got %v", c.name, c.expectedResult, createdSE) } @@ -847,6 +860,8 @@ func TestCreateServiceEntryForNewServiceOrPodRolloutsUsecase(t *testing.T) { const SERVICENAME = "serviceNameActive" const ROLLOUT_POD_HASH_LABEL string = "rollouts-pod-template-hash" + ctx := context.Background() + p := common.AdmiralParams{ KubeconfigPath: "testdata/fake.config", } @@ -964,7 +979,7 @@ func TestCreateServiceEntryForNewServiceOrPodRolloutsUsecase(t *testing.T) { activeService.Spec.Ports = ports s.Cache.Put(activeService) - se := modifyServiceEntryForNewServiceOrPod(admiral.Add, "test", "bar", rr) + se := modifyServiceEntryForNewServiceOrPod(ctx, admiral.Add, "test", "bar", rr) if nil == se { t.Fatalf("no service entries found") } @@ -984,6 +999,8 @@ func TestCreateServiceEntryForBlueGreenRolloutsUsecase(t *testing.T) { const PREVIEW_SERVICENAME = "serviceNamePreview" const ROLLOUT_POD_HASH_LABEL string = "rollouts-pod-template-hash" + ctx := context.Background() + p := common.AdmiralParams{ KubeconfigPath: "testdata/fake.config", PreviewHostnamePrefix: "preview", @@ -1114,7 +1131,7 @@ func TestCreateServiceEntryForBlueGreenRolloutsUsecase(t *testing.T) { s.Cache.Put(previewService) - se := modifyServiceEntryForNewServiceOrPod(admiral.Add, "test", "bar", rr) + se := modifyServiceEntryForNewServiceOrPod(ctx, admiral.Add, "test", "bar", rr) if nil == se { t.Fatalf("no service entries found") @@ -1136,7 +1153,7 @@ func TestCreateServiceEntryForBlueGreenRolloutsUsecase(t *testing.T) { BlueGreen: &argo.BlueGreenStrategy{ActiveService: ACTIVE_SERVICENAME}, } - se = modifyServiceEntryForNewServiceOrPod(admiral.Add, "test", "bar", rr) + se = modifyServiceEntryForNewServiceOrPod(ctx, admiral.Add, "test", "bar", rr) if len(se) != 1 { t.Fatalf("Expected 1 service entries to be created but found %d", len(se)) @@ -1156,7 +1173,7 @@ func TestUpdateEndpointsForBlueGreen(t *testing.T) { const ACTIVE_MESH_HOST = "qal.example.mesh" const PREVIEW_MESH_HOST = "preview.qal.example.mesh" - rollout := argo.Rollout{} + rollout := &argo.Rollout{} rollout.Spec.Strategy = argo.RolloutStrategy{ BlueGreen: &argo.BlueGreenStrategy{ ActiveService: ACTIVE_SERVICE, @@ -1166,7 +1183,7 @@ func TestUpdateEndpointsForBlueGreen(t *testing.T) { rollout.Spec.Template.Annotations = map[string]string{} rollout.Spec.Template.Annotations[common.SidecarEnabledPorts] = "8080" - endpoint := istionetworkingv1alpha3.ServiceEntry_Endpoint{ + endpoint := &istionetworkingv1alpha3.WorkloadEntry{ Labels: map[string]string{}, Address: CLUSTER_INGRESS_1, Ports: map[string]uint32{"http": 15443}, } @@ -1177,23 +1194,23 @@ func TestUpdateEndpointsForBlueGreen(t *testing.T) { PREVIEW_SERVICE: {Service: &v1.Service{ObjectMeta: v12.ObjectMeta{Name: PREVIEW_SERVICE, Namespace: NAMESPACE}}}, } - activeWantedEndpoints := istionetworkingv1alpha3.ServiceEntry_Endpoint{ + activeWantedEndpoints := &istionetworkingv1alpha3.WorkloadEntry{ Address: ACTIVE_SERVICE + common.Sep + NAMESPACE + common.DotLocalDomainSuffix, Ports: meshPorts, } - previewWantedEndpoints := istionetworkingv1alpha3.ServiceEntry_Endpoint{ + previewWantedEndpoints := &istionetworkingv1alpha3.WorkloadEntry{ Address: PREVIEW_SERVICE + common.Sep + NAMESPACE + common.DotLocalDomainSuffix, Ports: meshPorts, } testCases := []struct { name string - rollout argo.Rollout - inputEndpoint istionetworkingv1alpha3.ServiceEntry_Endpoint + rollout *argo.Rollout + inputEndpoint *istionetworkingv1alpha3.WorkloadEntry weightedServices map[string]*WeightedService clusterIngress string meshPorts map[string]uint32 meshHost string - wantedEndpoints istionetworkingv1alpha3.ServiceEntry_Endpoint + wantedEndpoints *istionetworkingv1alpha3.WorkloadEntry }{ { name: "should return endpoint with active service address", @@ -1217,7 +1234,7 @@ func TestUpdateEndpointsForBlueGreen(t *testing.T) { for _, c := range testCases { t.Run(c.name, func(t *testing.T) { - updateEndpointsForBlueGreen(&c.rollout, c.weightedServices, map[string]string{}, &c.inputEndpoint, "test", c.meshHost) + updateEndpointsForBlueGreen(c.rollout, c.weightedServices, map[string]string{}, c.inputEndpoint, "test", c.meshHost) if c.inputEndpoint.Address != c.wantedEndpoints.Address { t.Errorf("Wanted %s endpoint, got: %s", c.wantedEndpoints.Address, c.inputEndpoint.Address) } @@ -1235,7 +1252,7 @@ func TestUpdateEndpointsForWeightedServices(t *testing.T) { const NAMESPACE = "namespace" se := &istionetworkingv1alpha3.ServiceEntry{ - Endpoints: []*istionetworkingv1alpha3.ServiceEntry_Endpoint{ + Endpoints: []*istionetworkingv1alpha3.WorkloadEntry{ {Labels: map[string]string{}, Address: CLUSTER_INGRESS_1, Weight: 10, Ports: map[string]uint32{"http": 15443}}, {Labels: map[string]string{}, Address: CLUSTER_INGRESS_2, Weight: 10, Ports: map[string]uint32{"http": 15443}}, }, @@ -1252,13 +1269,13 @@ func TestUpdateEndpointsForWeightedServices(t *testing.T) { STABLE_SERVICE: {Weight: 100, Service: &v1.Service{ObjectMeta: v12.ObjectMeta{Name: STABLE_SERVICE, Namespace: NAMESPACE}}}, } - wantedEndpoints := []*istionetworkingv1alpha3.ServiceEntry_Endpoint{ + wantedEndpoints := []*istionetworkingv1alpha3.WorkloadEntry{ {Address: CLUSTER_INGRESS_2, Weight: 10, Ports: map[string]uint32{"http": 15443}}, {Address: STABLE_SERVICE + common.Sep + NAMESPACE + common.DotLocalDomainSuffix, Weight: 90, Ports: meshPorts}, {Address: CANARY_SERVICE + common.Sep + NAMESPACE + common.DotLocalDomainSuffix, Weight: 10, Ports: meshPorts}, } - wantedEndpointsZeroWeights := []*istionetworkingv1alpha3.ServiceEntry_Endpoint{ + wantedEndpointsZeroWeights := []*istionetworkingv1alpha3.WorkloadEntry{ {Address: CLUSTER_INGRESS_2, Weight: 10, Ports: map[string]uint32{"http": 15443}}, {Address: STABLE_SERVICE + common.Sep + NAMESPACE + common.DotLocalDomainSuffix, Weight: 100, Ports: meshPorts}, } @@ -1269,7 +1286,7 @@ func TestUpdateEndpointsForWeightedServices(t *testing.T) { weightedServices map[string]*WeightedService clusterIngress string meshPorts map[string]uint32 - wantedEndpoints []*istionetworkingv1alpha3.ServiceEntry_Endpoint + wantedEndpoints []*istionetworkingv1alpha3.WorkloadEntry }{ { name: "should return endpoints with assigned weights", diff --git a/admiral/pkg/clusters/types.go b/admiral/pkg/clusters/types.go index 75f2e50b..9ec59299 100644 --- a/admiral/pkg/clusters/types.go +++ b/admiral/pkg/clusters/types.go @@ -4,10 +4,11 @@ import ( "context" "errors" "fmt" - metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sync" "time" + metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1" + argo "github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1" v1 "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/v1" "github.com/istio-ecosystem/admiral/admiral/pkg/controller/admiral" @@ -43,7 +44,7 @@ type AdmiralCache struct { CnameDependentClusterCache *common.MapOfMaps CnameIdentityCache *sync.Map IdentityClusterCache *common.MapOfMaps - WorkloadSelectorCache *common.MapOfMaps + WorkloadSelectorCache *common.MapOfMaps ClusterLocalityCache *common.MapOfMaps IdentityDependencyCache *common.MapOfMaps SubsetServiceEntryIdentityCache *sync.Map @@ -52,9 +53,9 @@ type AdmiralCache struct { GlobalTrafficCache *globalTrafficCache //The cache needs to live in the handler because it needs access to deployments DependencyNamespaceCache *common.SidecarEgressMap SeClusterCache *common.MapOfMaps - RoutingPolicyFilterCache *routingPolicyFilterCache + RoutingPolicyFilterCache *routingPolicyFilterCache RoutingPolicyCache *routingPolicyCache - argoRolloutsEnabled bool + argoRolloutsEnabled bool } type RemoteRegistry struct { @@ -209,17 +210,16 @@ func (g *globalTrafficCache) Delete(identity string, environment string) { type RoutingPolicyHandler struct { RemoteRegistry *RemoteRegistry - ClusterID string + ClusterID string } type routingPolicyCache struct { // map of routing policies key=environment.identity, value: RoutingPolicy object // only one routing policy per identity + env is allowed identityCache map[string]*v1.RoutingPolicy - mutex *sync.Mutex + mutex *sync.Mutex } - func (r *routingPolicyCache) Delete(identity string, environment string) { defer r.mutex.Unlock() r.mutex.Lock() @@ -230,7 +230,7 @@ func (r *routingPolicyCache) Delete(identity string, environment string) { } } -func (r *routingPolicyCache ) GetFromIdentity(identity string, environment string) *v1.RoutingPolicy { +func (r *routingPolicyCache) GetFromIdentity(identity string, environment string) *v1.RoutingPolicy { defer r.mutex.Unlock() r.mutex.Lock() return r.identityCache[common.ConstructRoutingPolicyKey(environment, identity)] @@ -256,11 +256,10 @@ func (r *routingPolicyCache) Put(rp *v1.RoutingPolicy) error { return nil } - type routingPolicyFilterCache struct { // map of envoyFilters key=environment+identity of the routingPolicy, value is a map [clusterId -> map [filterName -> filterName]] filterCache map[string]map[string]map[string]string - mutex *sync.Mutex + mutex *sync.Mutex } func (r *routingPolicyFilterCache) Get(identityEnvKey string) (filters map[string]map[string]string) { @@ -288,14 +287,14 @@ func (r *routingPolicyFilterCache) Delete(identityEnvKey string) { r.mutex.Lock() // delete all envoyFilters for a given identity+env key delete(r.filterCache, identityEnvKey) - }else { + } else { log.Infof(LogFormat, admiral.Delete, "routingpolicy", identityEnvKey, "", "routingpolicy disabled") } } -func (r RoutingPolicyHandler) Added(obj *v1.RoutingPolicy) { +func (r RoutingPolicyHandler) Added(ctx context.Context, obj *v1.RoutingPolicy) { if common.GetEnableRoutingPolicy() { if common.ShouldIgnoreResource(obj.ObjectMeta) { - log.Infof(LogFormat, "success", "routingpolicy", obj.Name, obj.ClusterName, "Ignored the RoutingPolicy because of the annotation") + log.Infof(LogFormat, "success", "routingpolicy", obj.Name, "", "Ignored the RoutingPolicy because of the annotation") return } dependents := getDependents(obj, r) @@ -303,24 +302,24 @@ func (r RoutingPolicyHandler) Added(obj *v1.RoutingPolicy) { log.Info("No dependents found for Routing Policy - ", obj.Name) return } - r.processroutingPolicy(dependents, obj, admiral.Add) + r.processroutingPolicy(ctx, dependents, obj, admiral.Add) - log.Infof(LogFormat, admiral.Add, "routingpolicy", obj.Name, obj.ClusterName, "finished processing routing policy") - }else { - log.Infof(LogFormat, admiral.Add, "routingpolicy", obj.Name, obj.ClusterName, "routingpolicy disabled") + log.Infof(LogFormat, admiral.Add, "routingpolicy", obj.Name, "", "finished processing routing policy") + } else { + log.Infof(LogFormat, admiral.Add, "routingpolicy", obj.Name, "", "routingpolicy disabled") } } -func (r RoutingPolicyHandler) processroutingPolicy(dependents map[string]string, routingPolicy *v1.RoutingPolicy, eventType admiral.EventType ) { +func (r RoutingPolicyHandler) processroutingPolicy(ctx context.Context, dependents map[string]string, routingPolicy *v1.RoutingPolicy, eventType admiral.EventType) { for _, remoteController := range r.RemoteRegistry.remoteControllers { - for _, dependent := range dependents { + for _, dependent := range dependents { // Check if the dependent exists in this remoteCluster. If so, we create an envoyFilter with dependent identity as workload selector if _, ok := r.RemoteRegistry.AdmiralCache.IdentityClusterCache.Get(dependent).Copy()[remoteController.ClusterID]; ok { - selectors := r.RemoteRegistry.AdmiralCache.WorkloadSelectorCache.Get(dependent+remoteController.ClusterID).Copy() + selectors := r.RemoteRegistry.AdmiralCache.WorkloadSelectorCache.Get(dependent + remoteController.ClusterID).Copy() if len(selectors) != 0 { - filter, err := createOrUpdateEnvoyFilter(remoteController, routingPolicy, eventType, dependent, r.RemoteRegistry.AdmiralCache, selectors) + filter, err := createOrUpdateEnvoyFilter(ctx, remoteController, routingPolicy, eventType, dependent, r.RemoteRegistry.AdmiralCache, selectors) if err != nil { // Best effort create log.Errorf(LogErrFormat, eventType, "routingpolicy", routingPolicy.Name, remoteController.ClusterID, err) @@ -334,23 +333,23 @@ func (r RoutingPolicyHandler) processroutingPolicy(dependents map[string]string, } } -func (r RoutingPolicyHandler) Updated(obj *v1.RoutingPolicy) { +func (r RoutingPolicyHandler) Updated(ctx context.Context, obj *v1.RoutingPolicy) { if common.GetEnableRoutingPolicy() { if common.ShouldIgnoreResource(obj.ObjectMeta) { - log.Infof(LogFormat, admiral.Update, "routingpolicy", obj.Name, obj.ClusterName, "Ignored the RoutingPolicy because of the annotation") + log.Infof(LogFormat, admiral.Update, "routingpolicy", obj.Name, "", "Ignored the RoutingPolicy because of the annotation") // We need to process this as a delete event. - r.Deleted(obj) + r.Deleted(ctx, obj) return } dependents := getDependents(obj, r) if len(dependents) == 0 { return } - r.processroutingPolicy(dependents, obj, admiral.Update) + r.processroutingPolicy(ctx, dependents, obj, admiral.Update) - log.Infof(LogFormat, admiral.Update, "routingpolicy", obj.Name, obj.ClusterName, "updated routing policy") - }else { - log.Infof(LogFormat, admiral.Update, "routingpolicy", obj.Name, obj.ClusterName, "routingpolicy disabled") + log.Infof(LogFormat, admiral.Update, "routingpolicy", obj.Name, "", "updated routing policy") + } else { + log.Infof(LogFormat, admiral.Update, "routingpolicy", obj.Name, "", "routingpolicy disabled") } } @@ -368,15 +367,15 @@ func getDependents(obj *v1.RoutingPolicy, r RoutingPolicyHandler) map[string]str return dependents } -func (r RoutingPolicyHandler) Deleted(obj *v1.RoutingPolicy) { +func (r RoutingPolicyHandler) Deleted(ctx context.Context, obj *v1.RoutingPolicy) { dependents := getDependents(obj, r) - if len(dependents) != 0 { - r.deleteEnvoyFilters(dependents, obj, admiral.Delete) - log.Infof(LogFormat, admiral.Delete, "routingpolicy", obj.Name, obj.ClusterName, "deleted envoy filter for routing policy") + if len(dependents) != 0 { + r.deleteEnvoyFilters(ctx, dependents, obj, admiral.Delete) + log.Infof(LogFormat, admiral.Delete, "routingpolicy", obj.Name, "", "deleted envoy filter for routing policy") } } -func (r RoutingPolicyHandler) deleteEnvoyFilters(dependents map[string]string, obj *v1.RoutingPolicy, eventType admiral.EventType) { +func (r RoutingPolicyHandler) deleteEnvoyFilters(ctx context.Context, dependents map[string]string, obj *v1.RoutingPolicy, eventType admiral.EventType) { for _, dependent := range dependents { key := dependent + common.GetRoutingPolicyEnv(obj) clusterIdFilterMap := r.RemoteRegistry.AdmiralCache.RoutingPolicyFilterCache.Get(key) @@ -384,7 +383,7 @@ func (r RoutingPolicyHandler) deleteEnvoyFilters(dependents map[string]string, o if filterMap, ok := clusterIdFilterMap[rc.ClusterID]; ok { for _, filter := range filterMap { log.Infof(LogFormat, eventType, "envoyfilter", filter, rc.ClusterID, "deleting") - err := rc.RoutingPolicyController.IstioClient.NetworkingV1alpha3().EnvoyFilters("istio-system").Delete(filter, &metaV1.DeleteOptions{}) + err := rc.RoutingPolicyController.IstioClient.NetworkingV1alpha3().EnvoyFilters("istio-system").Delete(ctx, filter, metaV1.DeleteOptions{}) if err != nil { // Best effort delete log.Errorf(LogErrFormat, eventType, "envoyfilter", filter, rc.ClusterID, err) @@ -413,31 +412,31 @@ type ServiceHandler struct { ClusterID string } -func (sh *ServiceHandler) Added(obj *k8sV1.Service) { +func (sh *ServiceHandler) Added(ctx context.Context, obj *k8sV1.Service) { log.Infof(LogFormat, "Added", "service", obj.Name, sh.ClusterID, "received") - err := HandleEventForService(obj, sh.RemoteRegistry, sh.ClusterID) + err := HandleEventForService(ctx, obj, sh.RemoteRegistry, sh.ClusterID) if err != nil { log.Errorf(LogErrFormat, "Error", "service", obj.Name, sh.ClusterID, err) } } -func (sh *ServiceHandler) Updated(obj *k8sV1.Service) { +func (sh *ServiceHandler) Updated(ctx context.Context, obj *k8sV1.Service) { log.Infof(LogFormat, "Updated", "service", obj.Name, sh.ClusterID, "received") - err := HandleEventForService(obj, sh.RemoteRegistry, sh.ClusterID) + err := HandleEventForService(ctx, obj, sh.RemoteRegistry, sh.ClusterID) if err != nil { log.Errorf(LogErrFormat, "Error", "service", obj.Name, sh.ClusterID, err) } } -func (sh *ServiceHandler) Deleted(obj *k8sV1.Service) { +func (sh *ServiceHandler) Deleted(ctx context.Context, obj *k8sV1.Service) { log.Infof(LogFormat, "Deleted", "service", obj.Name, sh.ClusterID, "received") - err := HandleEventForService(obj, sh.RemoteRegistry, sh.ClusterID) + err := HandleEventForService(ctx, obj, sh.RemoteRegistry, sh.ClusterID) if err != nil { log.Errorf(LogErrFormat, "Error", "service", obj.Name, sh.ClusterID, err) } } -func HandleEventForService(svc *k8sV1.Service, remoteRegistry *RemoteRegistry, clusterName string) error { +func HandleEventForService(ctx context.Context, svc *k8sV1.Service, remoteRegistry *RemoteRegistry, clusterName string) error { if svc.Spec.Selector == nil { return fmt.Errorf("selector missing on service=%s in namespace=%s cluster=%s", svc.Name, svc.Namespace, clusterName) } @@ -448,45 +447,45 @@ func HandleEventForService(svc *k8sV1.Service, remoteRegistry *RemoteRegistry, c deploymentController := rc.DeploymentController rolloutController := rc.RolloutController if deploymentController != nil { - matchingDeployements := deploymentController.GetDeploymentBySelectorInNamespace(svc.Spec.Selector, svc.Namespace) + matchingDeployements := deploymentController.GetDeploymentBySelectorInNamespace(ctx, svc.Spec.Selector, svc.Namespace) if len(matchingDeployements) > 0 { for _, deployment := range matchingDeployements { - HandleEventForDeployment(admiral.Update, &deployment, remoteRegistry, clusterName) + HandleEventForDeployment(ctx, admiral.Update, &deployment, remoteRegistry, clusterName) } } } if common.GetAdmiralParams().ArgoRolloutsEnabled && rolloutController != nil { - matchingRollouts := rolloutController.GetRolloutBySelectorInNamespace(svc.Spec.Selector, svc.Namespace) + matchingRollouts := rolloutController.GetRolloutBySelectorInNamespace(ctx, svc.Spec.Selector, svc.Namespace) if len(matchingRollouts) > 0 { for _, rollout := range matchingRollouts { - HandleEventForRollout(admiral.Update, &rollout, remoteRegistry, clusterName) + HandleEventForRollout(ctx, admiral.Update, &rollout, remoteRegistry, clusterName) } } } return nil } -func (dh *DependencyHandler) Added(obj *v1.Dependency) { +func (dh *DependencyHandler) Added(ctx context.Context, obj *v1.Dependency) { log.Infof(LogFormat, "Add", "dependency-record", obj.Name, "", "Received=true namespace="+obj.Namespace) - HandleDependencyRecord(obj, dh.RemoteRegistry) + HandleDependencyRecord(ctx, obj, dh.RemoteRegistry) } -func (dh *DependencyHandler) Updated(obj *v1.Dependency) { +func (dh *DependencyHandler) Updated(ctx context.Context, obj *v1.Dependency) { log.Infof(LogFormat, "Update", "dependency-record", obj.Name, "", "Received=true namespace="+obj.Namespace) // need clean up before handle it as added, I need to handle update that delete the dependency, find diff first // this is more complex cos want to make sure no other service depend on the same service (which we just removed the dependancy). // need to make sure nothing depend on that before cleaning up the SE for that service - HandleDependencyRecord(obj, dh.RemoteRegistry) + HandleDependencyRecord(ctx, obj, dh.RemoteRegistry) } -func HandleDependencyRecord(obj *v1.Dependency, remoteRegitry *RemoteRegistry) { +func HandleDependencyRecord(ctx context.Context, obj *v1.Dependency, remoteRegitry *RemoteRegistry) { sourceIdentity := obj.Spec.Source if len(sourceIdentity) == 0 { @@ -496,58 +495,58 @@ func HandleDependencyRecord(obj *v1.Dependency, remoteRegitry *RemoteRegistry) { updateIdentityDependencyCache(sourceIdentity, remoteRegitry.AdmiralCache.IdentityDependencyCache, obj) } -func (dh *DependencyHandler) Deleted(obj *v1.Dependency) { +func (dh *DependencyHandler) Deleted(ctx context.Context, obj *v1.Dependency) { // special case of update, delete the dependency crd file for one service, need to loop through all ones we plan to update // and make sure nobody else is relying on the same SE in same cluster log.Infof(LogFormat, "Deleted", "dependency", obj.Name, "", "Skipping, not implemented") } -func (gtp *GlobalTrafficHandler) Added(obj *v1.GlobalTrafficPolicy) { +func (gtp *GlobalTrafficHandler) Added(ctx context.Context, obj *v1.GlobalTrafficPolicy) { log.Infof(LogFormat, "Added", "globaltrafficpolicy", obj.Name, gtp.ClusterID, "received") - err := HandleEventForGlobalTrafficPolicy(obj, gtp.RemoteRegistry, gtp.ClusterID) + err := HandleEventForGlobalTrafficPolicy(ctx, admiral.Add, obj, gtp.RemoteRegistry, gtp.ClusterID) if err != nil { log.Infof(err.Error()) } } -func (gtp *GlobalTrafficHandler) Updated(obj *v1.GlobalTrafficPolicy) { +func (gtp *GlobalTrafficHandler) Updated(ctx context.Context, obj *v1.GlobalTrafficPolicy) { log.Infof(LogFormat, "Updated", "globaltrafficpolicy", obj.Name, gtp.ClusterID, "received") - err := HandleEventForGlobalTrafficPolicy(obj, gtp.RemoteRegistry, gtp.ClusterID) + err := HandleEventForGlobalTrafficPolicy(ctx, admiral.Update, obj, gtp.RemoteRegistry, gtp.ClusterID) if err != nil { log.Infof(err.Error()) } } -func (gtp *GlobalTrafficHandler) Deleted(obj *v1.GlobalTrafficPolicy) { +func (gtp *GlobalTrafficHandler) Deleted(ctx context.Context, obj *v1.GlobalTrafficPolicy) { log.Infof(LogFormat, "Deleted", "globaltrafficpolicy", obj.Name, gtp.ClusterID, "received") - err := HandleEventForGlobalTrafficPolicy(obj, gtp.RemoteRegistry, gtp.ClusterID) + err := HandleEventForGlobalTrafficPolicy(ctx, admiral.Delete, obj, gtp.RemoteRegistry, gtp.ClusterID) if err != nil { log.Infof(err.Error()) } } -func (pc *DeploymentHandler) Added(obj *k8sAppsV1.Deployment) { - HandleEventForDeployment(admiral.Add, obj, pc.RemoteRegistry, pc.ClusterID) +func (pc *DeploymentHandler) Added(ctx context.Context, obj *k8sAppsV1.Deployment) { + HandleEventForDeployment(ctx, admiral.Add, obj, pc.RemoteRegistry, pc.ClusterID) } -func (pc *DeploymentHandler) Deleted(obj *k8sAppsV1.Deployment) { - HandleEventForDeployment(admiral.Delete, obj, pc.RemoteRegistry, pc.ClusterID) +func (pc *DeploymentHandler) Deleted(ctx context.Context, obj *k8sAppsV1.Deployment) { + HandleEventForDeployment(ctx, admiral.Delete, obj, pc.RemoteRegistry, pc.ClusterID) } -func (rh *RolloutHandler) Added(obj *argo.Rollout) { - HandleEventForRollout(admiral.Add, obj, rh.RemoteRegistry, rh.ClusterID) +func (rh *RolloutHandler) Added(ctx context.Context, obj *argo.Rollout) { + HandleEventForRollout(ctx, admiral.Add, obj, rh.RemoteRegistry, rh.ClusterID) } -func (rh *RolloutHandler) Updated(obj *argo.Rollout) { +func (rh *RolloutHandler) Updated(ctx context.Context, obj *argo.Rollout) { log.Infof(LogFormat, "Updated", "rollout", obj.Name, rh.ClusterID, "received") } -func (rh *RolloutHandler) Deleted(obj *argo.Rollout) { - HandleEventForRollout(admiral.Delete, obj, rh.RemoteRegistry, rh.ClusterID) +func (rh *RolloutHandler) Deleted(ctx context.Context, obj *argo.Rollout) { + HandleEventForRollout(ctx, admiral.Delete, obj, rh.RemoteRegistry, rh.ClusterID) } -// helper function to handle add and delete for RolloutHandler -func HandleEventForRollout(event admiral.EventType, obj *argo.Rollout, remoteRegistry *RemoteRegistry, clusterName string) { +// HandleEventForRollout helper function to handle add and delete for RolloutHandler +func HandleEventForRollout(ctx context.Context, event admiral.EventType, obj *argo.Rollout, remoteRegistry *RemoteRegistry, clusterName string) { log.Infof(LogFormat, event, "rollout", obj.Name, clusterName, "Received") globalIdentifier := common.GetRolloutGlobalIdentifier(obj) @@ -560,11 +559,11 @@ func HandleEventForRollout(event admiral.EventType, obj *argo.Rollout, remoteReg env := common.GetEnvForRollout(obj) // Use the same function as added deployment function to update and put new service entry in place to replace old one - modifyServiceEntryForNewServiceOrPod(event, env, globalIdentifier, remoteRegistry) + modifyServiceEntryForNewServiceOrPod(ctx, event, env, globalIdentifier, remoteRegistry) } // helper function to handle add and delete for DeploymentHandler -func HandleEventForDeployment(event admiral.EventType, obj *k8sAppsV1.Deployment, remoteRegistry *RemoteRegistry, clusterName string) { +func HandleEventForDeployment(ctx context.Context, event admiral.EventType, obj *k8sAppsV1.Deployment, remoteRegistry *RemoteRegistry, clusterName string) { globalIdentifier := common.GetDeploymentGlobalIdentifier(obj) @@ -576,11 +575,12 @@ func HandleEventForDeployment(event admiral.EventType, obj *k8sAppsV1.Deployment env := common.GetEnv(obj) // Use the same function as added deployment function to update and put new service entry in place to replace old one - modifyServiceEntryForNewServiceOrPod(event, env, globalIdentifier, remoteRegistry) + modifyServiceEntryForNewServiceOrPod(ctx, event, env, globalIdentifier, remoteRegistry) } // HandleEventForGlobalTrafficPolicy processes all the events related to GTPs -func HandleEventForGlobalTrafficPolicy(gtp *v1.GlobalTrafficPolicy, remoteRegistry *RemoteRegistry, clusterName string) error { +func HandleEventForGlobalTrafficPolicy(ctx context.Context, event admiral.EventType, gtp *v1.GlobalTrafficPolicy, + remoteRegistry *RemoteRegistry, clusterName string) error { globalIdentifier := common.GetGtpIdentity(gtp) @@ -594,6 +594,6 @@ func HandleEventForGlobalTrafficPolicy(gtp *v1.GlobalTrafficPolicy, remoteRegist // the endpoints from being deleted. // TODO: Need to come up with a way to prevent deleting default endpoints so that this hack can be removed. // Use the same function as added deployment function to update and put new service entry in place to replace old one - modifyServiceEntryForNewServiceOrPod(admiral.Update, env, globalIdentifier, remoteRegistry) + modifyServiceEntryForNewServiceOrPod(ctx, admiral.Update, env, globalIdentifier, remoteRegistry) return nil } diff --git a/admiral/pkg/clusters/types_test.go b/admiral/pkg/clusters/types_test.go index d6ced9e3..85856716 100644 --- a/admiral/pkg/clusters/types_test.go +++ b/admiral/pkg/clusters/types_test.go @@ -3,13 +3,14 @@ package clusters import ( "context" "fmt" - "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/model" - istiofake "istio.io/client-go/pkg/clientset/versioned/fake" "strings" "sync" "testing" "time" + "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/model" + istiofake "istio.io/client-go/pkg/clientset/versioned/fake" + argo "github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1" "github.com/google/go-cmp/cmp/cmpopts" v1 "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/v1" @@ -50,6 +51,8 @@ func init() { func TestDeploymentHandler(t *testing.T) { + ctx := context.Background() + p := common.AdmiralParams{ KubeconfigPath: "testdata/fake.config", } @@ -122,14 +125,16 @@ func TestDeploymentHandler(t *testing.T) { gtpCache.mutex = &sync.Mutex{} handler.RemoteRegistry.AdmiralCache.GlobalTrafficCache = gtpCache - handler.Added(&deployment) - handler.Deleted(&deployment) + handler.Added(ctx, &deployment) + handler.Deleted(ctx, &deployment) }) } } func TestRolloutHandler(t *testing.T) { + ctx := context.Background() + p := common.AdmiralParams{ KubeconfigPath: "testdata/fake.config", } @@ -206,14 +211,16 @@ func TestRolloutHandler(t *testing.T) { gtpCache.identityCache = make(map[string]*v1.GlobalTrafficPolicy) gtpCache.mutex = &sync.Mutex{} handler.RemoteRegistry.AdmiralCache.GlobalTrafficCache = gtpCache - handler.Added(c.addedRolout) - handler.Deleted(c.addedRolout) - handler.Updated(c.addedRolout) + handler.Added(ctx, c.addedRolout) + handler.Deleted(ctx, c.addedRolout) + handler.Updated(ctx, c.addedRolout) }) } } func TestHandleEventForGlobalTrafficPolicy(t *testing.T) { + ctx := context.Background() + event := admiral.EventType("Add") p := common.AdmiralParams{ KubeconfigPath: "testdata/fake.config", } @@ -260,14 +267,13 @@ func TestHandleEventForGlobalTrafficPolicy(t *testing.T) { for _, c := range testcases { t.Run(c.name, func(t *testing.T) { - err := HandleEventForGlobalTrafficPolicy(c.gtp, registry, "testcluster") + err := HandleEventForGlobalTrafficPolicy(ctx, event, c.gtp, registry, "testcluster") assert.Equal(t, err != nil, c.doesError) }) } } - -func TestRoutingPolicyHandler(t *testing.T) { +func TestRoutingPolicyHandler(t *testing.T) { p := common.AdmiralParams{ KubeconfigPath: "testdata/fake.config", LabelSet: &common.LabelSet{}, @@ -295,7 +301,6 @@ func TestRoutingPolicyHandler(t *testing.T) { rpFilterCache.filterCache = make(map[string]map[string]map[string]string) rpFilterCache.mutex = &sync.Mutex{} - routingPolicyController := &admiral.RoutingPolicyController{IstioClient: istiofake.NewSimpleClientset()} remoteController, _ := createMockRemoteController(func(i interface{}) { @@ -309,7 +314,6 @@ func TestRoutingPolicyHandler(t *testing.T) { registry.AdmiralCache.IdentityDependencyCache.Put("foo", "bar", "bar") registry.AdmiralCache.IdentityClusterCache.Put("bar", remoteController.ClusterID, remoteController.ClusterID) - // foo is also dependent upon bar2 but bar2 is in a different cluster, so this cluster should not have the envoyfilter created registry.AdmiralCache.IdentityDependencyCache.Put("foo", "bar2", "bar2") registry.AdmiralCache.IdentityClusterCache.Put("bar2", "differentCluster", "differentCluster") @@ -318,74 +322,72 @@ func TestRoutingPolicyHandler(t *testing.T) { registry.AdmiralCache.IdentityDependencyCache.Put("foo1", "bar1", "bar1") var mp = common.NewMap() - mp.Put("k1","v1") + mp.Put("k1", "v1") registry.AdmiralCache.WorkloadSelectorCache.PutMap("bar"+remoteController.ClusterID, mp) registry.AdmiralCache.WorkloadSelectorCache.PutMap("bar2differentCluster", mp) handler.RemoteRegistry = registry routingPolicyFoo := &v1.RoutingPolicy{ - TypeMeta: time2.TypeMeta{}, + TypeMeta: time2.TypeMeta{}, ObjectMeta: time2.ObjectMeta{ Labels: map[string]string{ - "identity": "foo", + "identity": "foo", "admiral.io/env": "stage", }, }, - Spec: model.RoutingPolicy{ - Plugin: "test", - Hosts: []string{"e2e.testservice.mesh"}, + Spec: model.RoutingPolicy{ + Plugin: "test", + Hosts: []string{"e2e.testservice.mesh"}, Config: map[string]string{ - "cachePrefix": "cache-v1", - "cachettlSec": "86400", + "cachePrefix": "cache-v1", + "cachettlSec": "86400", "routingServiceUrl": "e2e.test.routing.service.mesh", - "pathPrefix": "/sayhello,/v1/company/{id}/", + "pathPrefix": "/sayhello,/v1/company/{id}/", }, }, - Status: v1.RoutingPolicyStatus{}, + Status: v1.RoutingPolicyStatus{}, } - routingPolicyFoo1 := routingPolicyFoo.DeepCopy() routingPolicyFoo1.Labels[common.GetWorkloadIdentifier()] = "foo1" - testCases := []struct { - name string - routingPolicy *v1.RoutingPolicy - expectedFilterCacheKey string - valueExpected bool - - } { + name string + routingPolicy *v1.RoutingPolicy + expectedFilterCacheKey string + valueExpected bool + }{ { - name: "If dependent deployment exists, should fetch filter from cache", - routingPolicy: routingPolicyFoo, - expectedFilterCacheKey: "barstage", - valueExpected: true, + name: "If dependent deployment exists, should fetch filter from cache", + routingPolicy: routingPolicyFoo, + expectedFilterCacheKey: "barstage", + valueExpected: true, }, { - name: "If dependent deployment does not exist, the filter should not be created", - routingPolicy: routingPolicyFoo1, - expectedFilterCacheKey: "bar1stage", - valueExpected: false, + name: "If dependent deployment does not exist, the filter should not be created", + routingPolicy: routingPolicyFoo1, + expectedFilterCacheKey: "bar1stage", + valueExpected: false, }, { - name: "If dependent deployment exists in a different cluster, the filter should not be created", - routingPolicy: routingPolicyFoo, - expectedFilterCacheKey: "bar2stage", - valueExpected: false, + name: "If dependent deployment exists in a different cluster, the filter should not be created", + routingPolicy: routingPolicyFoo, + expectedFilterCacheKey: "bar2stage", + valueExpected: false, }, - } - time.Sleep(time.Second*30) + ctx := context.Background() + + time.Sleep(time.Second * 30) for _, c := range testCases { t.Run(c.name, func(t *testing.T) { - handler.Added(c.routingPolicy) + handler.Added(ctx, c.routingPolicy) if c.valueExpected { filterCacheValue := registry.AdmiralCache.RoutingPolicyFilterCache.Get(c.expectedFilterCacheKey) assert.NotNil(t, filterCacheValue) - selectorLabelsSha, err := common.GetSha1("bar"+common.GetRoutingPolicyEnv(c.routingPolicy)) + selectorLabelsSha, err := common.GetSha1("bar" + common.GetRoutingPolicyEnv(c.routingPolicy)) if err != nil { t.Error("Error ocurred while computing workload Labels sha1") } @@ -395,7 +397,7 @@ func TestRoutingPolicyHandler(t *testing.T) { assert.NotNil(t, filterMap[envoyFilterName]) // once the routing policy is deleted, the corresponding filter should also be deleted - handler.Deleted(c.routingPolicy) + handler.Deleted(ctx, c.routingPolicy) assert.Nil(t, registry.AdmiralCache.RoutingPolicyFilterCache.Get(c.expectedFilterCacheKey)) } else { assert.Nil(t, registry.AdmiralCache.RoutingPolicyFilterCache.Get(c.expectedFilterCacheKey)) @@ -404,15 +406,13 @@ func TestRoutingPolicyHandler(t *testing.T) { }) } - - // Test for multiple filters registry.AdmiralCache.IdentityDependencyCache.Put("foo", "bar3", "bar3") registry.AdmiralCache.IdentityClusterCache.Put("bar3", remoteController.ClusterID, remoteController.ClusterID) registry.AdmiralCache.WorkloadSelectorCache.PutMap("bar3"+remoteController.ClusterID, mp) - handler.Added(routingPolicyFoo) + handler.Added(ctx, routingPolicyFoo) - selectorLabelsShaBar3, err := common.GetSha1("bar3"+common.GetRoutingPolicyEnv(routingPolicyFoo)) + selectorLabelsShaBar3, err := common.GetSha1("bar3" + common.GetRoutingPolicyEnv(routingPolicyFoo)) if err != nil { t.Error("Error ocurred while computing workload Labels sha1") } @@ -424,13 +424,12 @@ func TestRoutingPolicyHandler(t *testing.T) { assert.NotNil(t, filterMap) assert.NotNil(t, filterMap[envoyFilterNameBar3]) - registry.AdmiralCache.IdentityDependencyCache.Put("foo", "bar4", "bar4") registry.AdmiralCache.IdentityClusterCache.Put("bar4", remoteController.ClusterID, remoteController.ClusterID) registry.AdmiralCache.WorkloadSelectorCache.PutMap("bar4"+remoteController.ClusterID, mp) - handler.Updated(routingPolicyFoo) + handler.Updated(ctx, routingPolicyFoo) - selectorLabelsShaBar4, err := common.GetSha1("bar4"+common.GetRoutingPolicyEnv(routingPolicyFoo)) + selectorLabelsShaBar4, err := common.GetSha1("bar4" + common.GetRoutingPolicyEnv(routingPolicyFoo)) if err != nil { t.Error("Error ocurred while computing workload Labels sha1") } @@ -450,9 +449,8 @@ func TestRoutingPolicyHandler(t *testing.T) { annotations[common.AdmiralIgnoreAnnotation] = "true" routingPolicyFoo.SetAnnotations(annotations) - handler.Updated(routingPolicyFoo) + handler.Updated(ctx, routingPolicyFoo) assert.Nil(t, registry.AdmiralCache.RoutingPolicyFilterCache.Get("bar4stage")) assert.Nil(t, registry.AdmiralCache.RoutingPolicyFilterCache.Get("bar3stage")) } - diff --git a/admiral/pkg/controller/admiral/configmap.go b/admiral/pkg/controller/admiral/configmap.go index 7f730c80..8156d9b8 100644 --- a/admiral/pkg/controller/admiral/configmap.go +++ b/admiral/pkg/controller/admiral/configmap.go @@ -1,26 +1,28 @@ package admiral import ( + "context" + "strings" + "github.com/istio-ecosystem/admiral/admiral/pkg/controller/common" - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" "k8s.io/client-go/tools/clientcmd" - "strings" ) const configmapName = "se-address-configmap" type ConfigMapControllerInterface interface { - GetConfigMap() (*v1.ConfigMap, error) - PutConfigMap(newMap *v1.ConfigMap) error - GetIPPrefixForServiceEntries()(seIPPrefix string) + GetConfigMap(ctx context.Context) (*v1.ConfigMap, error) + PutConfigMap(ctx context.Context, newMap *v1.ConfigMap) error + GetIPPrefixForServiceEntries() (seIPPrefix string) } type ConfigMapController struct { - K8sClient kubernetes.Interface - ConfigmapNamespace string + K8sClient kubernetes.Interface + ConfigmapNamespace string ServiceEntryIPPrefix string } @@ -40,8 +42,8 @@ func NewConfigMapController(seIPPrefix string) (*ConfigMapController, error) { return nil, err } controller := ConfigMapController{ - K8sClient: client, - ConfigmapNamespace: namespaceToUse, + K8sClient: client, + ConfigmapNamespace: namespaceToUse, ServiceEntryIPPrefix: seIPPrefix, } return &controller, nil @@ -58,8 +60,8 @@ func NewConfigMapController(seIPPrefix string) (*ConfigMapController, error) { return nil, err } controller := ConfigMapController{ - K8sClient: client, - ConfigmapNamespace: namespaceToUse, + K8sClient: client, + ConfigmapNamespace: namespaceToUse, ServiceEntryIPPrefix: seIPPrefix, } return &controller, nil @@ -67,9 +69,9 @@ func NewConfigMapController(seIPPrefix string) (*ConfigMapController, error) { } -func (c *ConfigMapController) GetConfigMap() (*v1.ConfigMap, error) { +func (c *ConfigMapController) GetConfigMap(ctx context.Context) (*v1.ConfigMap, error) { getOpts := metaV1.GetOptions{} - configMap, err := c.K8sClient.CoreV1().ConfigMaps(c.ConfigmapNamespace).Get(configmapName, getOpts) + configMap, err := c.K8sClient.CoreV1().ConfigMaps(c.ConfigmapNamespace).Get(ctx, configmapName, getOpts) if err == nil { return configMap, err @@ -79,18 +81,18 @@ func (c *ConfigMapController) GetConfigMap() (*v1.ConfigMap, error) { cm := v1.ConfigMap{} cm.Name = configmapName cm.Namespace = c.ConfigmapNamespace - configMap, err = c.K8sClient.CoreV1().ConfigMaps(c.ConfigmapNamespace).Create(&cm) + configMap, err = c.K8sClient.CoreV1().ConfigMaps(c.ConfigmapNamespace).Create(ctx, &cm, metaV1.CreateOptions{}) } return configMap, err } -func (c *ConfigMapController) PutConfigMap(newMap *v1.ConfigMap) error { - _, err := c.K8sClient.CoreV1().ConfigMaps(c.ConfigmapNamespace).Update(newMap) +func (c *ConfigMapController) PutConfigMap(ctx context.Context, newMap *v1.ConfigMap) error { + _, err := c.K8sClient.CoreV1().ConfigMaps(c.ConfigmapNamespace).Update(ctx, newMap, metaV1.UpdateOptions{}) return err } -func (c *ConfigMapController)GetIPPrefixForServiceEntries() (string) { +func (c *ConfigMapController) GetIPPrefixForServiceEntries() string { return c.ServiceEntryIPPrefix } diff --git a/admiral/pkg/controller/admiral/configmap_test.go b/admiral/pkg/controller/admiral/configmap_test.go index c6d37e42..99b684e9 100644 --- a/admiral/pkg/controller/admiral/configmap_test.go +++ b/admiral/pkg/controller/admiral/configmap_test.go @@ -1,6 +1,7 @@ package admiral import ( + "context" "errors" "testing" "time" @@ -10,6 +11,7 @@ import ( _ "github.com/istio-ecosystem/admiral/admiral/pkg/test" log "github.com/sirupsen/logrus" v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes/fake" ) @@ -43,7 +45,8 @@ func TestConfigMapController_GetConfigMap(t *testing.T) { cm.Name = "se-address-configmap" cm.Namespace = "admiral" cm.Labels = map[string]string{"foo": "bar"} //differentiating from a new/empty cm - _, err := client.CoreV1().ConfigMaps("admiral").Create(&cm) + ctx := context.Background() + _, err := client.CoreV1().ConfigMaps("admiral").Create(ctx, &cm, metav1.CreateOptions{}) if err != nil { t.Errorf("%v", err) } @@ -81,7 +84,7 @@ func TestConfigMapController_GetConfigMap(t *testing.T) { for _, c := range testCases { t.Run(c.name, func(t *testing.T) { - cm, err := c.configMapController.GetConfigMap() + cm, err := c.configMapController.GetConfigMap(ctx) if err == nil && c.expectedError == nil { //we're fine } else if c.expectedError == nil && err != nil { @@ -148,7 +151,8 @@ func TestConfigMapController_PutConfigMap(t *testing.T) { cm := v1.ConfigMap{} cm.Name = "se-address-configmap" cm.Namespace = "admiral-remote-ctx" - _, err := client.CoreV1().ConfigMaps("admiral-remote-ctx").Create(&cm) + ctx := context.Background() + _, err := client.CoreV1().ConfigMaps("admiral-remote-ctx").Create(ctx, &cm, metav1.CreateOptions{}) if err != nil { t.Errorf("%v", err) } @@ -156,7 +160,7 @@ func TestConfigMapController_PutConfigMap(t *testing.T) { cm.Data = map[string]string{"Foo": "Bar"} - err = configmapController.PutConfigMap(&cm) + err = configmapController.PutConfigMap(ctx, &cm) if err != nil { t.Errorf("No error expected. Err: %v", err) diff --git a/admiral/pkg/controller/admiral/controller.go b/admiral/pkg/controller/admiral/controller.go index 8457394f..e71f76e5 100644 --- a/admiral/pkg/controller/admiral/controller.go +++ b/admiral/pkg/controller/admiral/controller.go @@ -1,10 +1,12 @@ package admiral import ( + "context" "fmt" + "time" + "github.com/istio-ecosystem/admiral/admiral/pkg/controller/common" log "github.com/sirupsen/logrus" - "time" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/util/wait" @@ -17,11 +19,11 @@ const ( maxRetries = 5 ) -// Handler interface contains the methods that are required +// Delegator interface contains the methods that are required type Delegator interface { - Added(interface{}) - Updated(interface{}, interface{}) - Deleted(interface{}) + Added(context.Context, interface{}) + Updated(context.Context, interface{}, interface{}) + Deleted(context.Context, interface{}) } type EventType string @@ -137,13 +139,13 @@ func (c *Controller) processNextItem() bool { } func (c *Controller) processItem(informerCacheObj InformerCacheObj) error { - + ctx := context.Background() if informerCacheObj.eventType == Delete { - c.delegator.Deleted(informerCacheObj.obj) + c.delegator.Deleted(ctx, informerCacheObj.obj) } else if informerCacheObj.eventType == Update { - c.delegator.Updated(informerCacheObj.obj, informerCacheObj.oldObj) + c.delegator.Updated(ctx, informerCacheObj.obj, informerCacheObj.oldObj) } else if informerCacheObj.eventType == Add { - c.delegator.Added(informerCacheObj.obj) + c.delegator.Added(ctx, informerCacheObj.obj) } return nil } @@ -162,17 +164,17 @@ func NewMonitoredDelegator(d Delegator, clusterID string, objectType string) *Mo } } -func (s *MonitoredDelegator) Added(obj interface{}) { +func (s *MonitoredDelegator) Added(ctx context.Context, obj interface{}) { common.EventsProcessed.With(s.clusterID, s.objectType, common.AddEventLabelValue).Inc() - s.d.Added(obj) + s.d.Added(ctx, obj) } -func (s *MonitoredDelegator) Updated(obj interface{}, oldObj interface{}) { +func (s *MonitoredDelegator) Updated(ctx context.Context, obj interface{}, oldObj interface{}) { common.EventsProcessed.With(s.clusterID, s.objectType, common.UpdateEventLabelValue).Inc() - s.d.Updated(obj, oldObj) + s.d.Updated(ctx, obj, oldObj) } -func (s *MonitoredDelegator) Deleted(obj interface{}) { +func (s *MonitoredDelegator) Deleted(ctx context.Context, obj interface{}) { common.EventsProcessed.With(s.clusterID, s.objectType, common.DeleteEventLabelValue).Inc() - s.d.Deleted(obj) + s.d.Deleted(ctx, obj) } diff --git a/admiral/pkg/controller/admiral/controller_test.go b/admiral/pkg/controller/admiral/controller_test.go index ff0e81ba..53325a34 100644 --- a/admiral/pkg/controller/admiral/controller_test.go +++ b/admiral/pkg/controller/admiral/controller_test.go @@ -1,14 +1,16 @@ package admiral import ( - "github.com/stretchr/testify/assert" + "context" "testing" + + "github.com/stretchr/testify/assert" ) func TestMonitoredDelegator_Added(t *testing.T) { td := &TestDelegator{} d := NewMonitoredDelegator(td, "test", "test") - d.Added(nil) + d.Added(context.Background(), nil) assert.True(t, td.AddedInvoked) assert.False(t, td.DeleteInvoked) @@ -18,7 +20,7 @@ func TestMonitoredDelegator_Added(t *testing.T) { func TestMonitoredDelegator_Deleted(t *testing.T) { td := &TestDelegator{} d := NewMonitoredDelegator(td, "test", "test") - d.Deleted(nil) + d.Deleted(context.Background(), nil) assert.False(t, td.AddedInvoked) assert.True(t, td.DeleteInvoked) @@ -28,7 +30,7 @@ func TestMonitoredDelegator_Deleted(t *testing.T) { func TestMonitoredDelegator_Updated(t *testing.T) { td := &TestDelegator{} d := NewMonitoredDelegator(td, "test", "test") - d.Updated(nil, nil) + d.Updated(context.Background(), nil, nil) assert.False(t, td.AddedInvoked) assert.False(t, td.DeleteInvoked) @@ -41,14 +43,14 @@ type TestDelegator struct { DeleteInvoked bool } -func (t *TestDelegator) Added(obj interface{}) { +func (t *TestDelegator) Added(context.Context, interface{}) { t.AddedInvoked = true } -func (t *TestDelegator) Updated(obj interface{}, oldObj interface{}) { +func (t *TestDelegator) Updated(context.Context, interface{}, interface{}) { t.UpdatedInvoked = true } -func (t *TestDelegator) Deleted(obj interface{}) { +func (t *TestDelegator) Deleted(context.Context, interface{}) { t.DeleteInvoked = true } diff --git a/admiral/pkg/controller/admiral/dependency.go b/admiral/pkg/controller/admiral/dependency.go index 391387e4..45d7a1f9 100644 --- a/admiral/pkg/controller/admiral/dependency.go +++ b/admiral/pkg/controller/admiral/dependency.go @@ -1,22 +1,24 @@ package admiral import ( + "context" "fmt" - "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/v1" - "k8s.io/client-go/kubernetes" - "k8s.io/client-go/tools/cache" "sync" "time" + v1 "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/v1" + "k8s.io/client-go/kubernetes" + "k8s.io/client-go/tools/cache" + clientset "github.com/istio-ecosystem/admiral/admiral/pkg/client/clientset/versioned" informerV1 "github.com/istio-ecosystem/admiral/admiral/pkg/client/informers/externalversions/admiral/v1" ) -// Handler interface contains the methods that are required +// DepHandler interface contains the methods that are required type DepHandler interface { - Added(obj *v1.Dependency) - Updated(obj *v1.Dependency) - Deleted(obj *v1.Dependency) + Added(ctx context.Context, obj *v1.Dependency) + Updated(ctx context.Context, obj *v1.Dependency) + Deleted(ctx context.Context, obj *v1.Dependency) } type DependencyController struct { @@ -92,20 +94,20 @@ func NewDependencyController(stopCh <-chan struct{}, handler DepHandler, configP return &depController, nil } -func (d *DependencyController) Added(ojb interface{}) { +func (d *DependencyController) Added(ctx context.Context, ojb interface{}) { dep := ojb.(*v1.Dependency) d.Cache.Put(dep) - d.DepHandler.Added(dep) + d.DepHandler.Added(ctx, dep) } -func (d *DependencyController) Updated(obj interface{}, oldObj interface{}) { +func (d *DependencyController) Updated(ctx context.Context, obj interface{}, oldObj interface{}) { dep := obj.(*v1.Dependency) d.Cache.Put(dep) - d.DepHandler.Updated(dep) + d.DepHandler.Updated(ctx, dep) } -func (d *DependencyController) Deleted(ojb interface{}) { +func (d *DependencyController) Deleted(ctx context.Context, ojb interface{}) { dep := ojb.(*v1.Dependency) d.Cache.Delete(dep) - d.DepHandler.Deleted(dep) + d.DepHandler.Deleted(ctx, dep) } diff --git a/admiral/pkg/controller/admiral/dependency_test.go b/admiral/pkg/controller/admiral/dependency_test.go index 01da167f..8d1dc6e3 100644 --- a/admiral/pkg/controller/admiral/dependency_test.go +++ b/admiral/pkg/controller/admiral/dependency_test.go @@ -1,13 +1,15 @@ package admiral import ( + "context" + "testing" + "time" + "github.com/google/go-cmp/cmp" "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/model" v1 "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/v1" "github.com/istio-ecosystem/admiral/admiral/pkg/test" v12 "k8s.io/apimachinery/pkg/apis/meta/v1" - "testing" - "time" ) func TestNewDependencyController(t *testing.T) { @@ -39,11 +41,13 @@ func TestDependencyAddUpdateAndDelete(t *testing.T) { t.Errorf("Dependency controller should never be nil without an error thrown") } + ctx := context.Background() + //test add depName := "dep1" dep := model.Dependency{IdentityLabel: "identity", Destinations: []string{"greeting", "payments"}, Source: "webapp"} depObj := makeK8sDependencyObj(depName, "namespace1", dep) - dependencyController.Added(depObj) + dependencyController.Added(ctx, depObj) newDepObj := dependencyController.Cache.Get(depName) @@ -54,7 +58,7 @@ func TestDependencyAddUpdateAndDelete(t *testing.T) { //test update updatedDep := model.Dependency{IdentityLabel: "identity", Destinations: []string{"greeting", "payments", "newservice"}, Source: "webapp"} updatedObj := makeK8sDependencyObj(depName, "namespace1", updatedDep) - dependencyController.Updated(makeK8sDependencyObj(depName, "namespace1", updatedDep), depObj) + dependencyController.Updated(ctx, makeK8sDependencyObj(depName, "namespace1", updatedDep), depObj) updatedDepObj := dependencyController.Cache.Get(depName) @@ -63,7 +67,7 @@ func TestDependencyAddUpdateAndDelete(t *testing.T) { } //test delete - dependencyController.Deleted(updatedDepObj) + dependencyController.Deleted(ctx, updatedDepObj) deletedDepObj := dependencyController.Cache.Get(depName) diff --git a/admiral/pkg/controller/admiral/deployment.go b/admiral/pkg/controller/admiral/deployment.go index 7c666232..2bff3491 100644 --- a/admiral/pkg/controller/admiral/deployment.go +++ b/admiral/pkg/controller/admiral/deployment.go @@ -1,25 +1,28 @@ package admiral import ( + "context" "fmt" + "time" + "github.com/istio-ecosystem/admiral/admiral/pkg/controller/common" - "github.com/sirupsen/logrus" k8sAppsV1 "k8s.io/api/apps/v1" k8sAppsinformers "k8s.io/client-go/informers/apps/v1" "k8s.io/client-go/rest" - "time" + "sync" + + "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus" meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/cache" - "sync" ) -// Handler interface contains the methods that are required +// DeploymentHandler interface contains the methods that are required type DeploymentHandler interface { - Added(obj *k8sAppsV1.Deployment) - Deleted(obj *k8sAppsV1.Deployment) + Added(ctx context.Context, obj *k8sAppsV1.Deployment) + Deleted(ctx context.Context, obj *k8sAppsV1.Deployment) } type DeploymentClusterEntry struct { @@ -118,21 +121,21 @@ func NewDeploymentController(clusterID string, stopCh <-chan struct{}, handler D return &deploymentController, nil } -func (d *DeploymentController) Added(obj interface{}) { - HandleAddUpdateDeployment(obj, d) +func (d *DeploymentController) Added(ctx context.Context, obj interface{}) { + HandleAddUpdateDeployment(ctx, obj, d) } -func (d *DeploymentController) Updated(obj interface{}, oldObj interface{}) { - HandleAddUpdateDeployment(obj, d) +func (d *DeploymentController) Updated(ctx context.Context, obj interface{}, oldObj interface{}) { + HandleAddUpdateDeployment(ctx, obj, d) } -func HandleAddUpdateDeployment(ojb interface{}, d *DeploymentController) { +func HandleAddUpdateDeployment(ctx context.Context, ojb interface{}, d *DeploymentController) { deployment := ojb.(*k8sAppsV1.Deployment) key := d.Cache.getKey(deployment) if len(key) > 0 { - if !d.shouldIgnoreBasedOnLabels(deployment) { + if !d.shouldIgnoreBasedOnLabels(ctx, deployment) { d.Cache.UpdateDeploymentToClusterCache(key, deployment) - d.DeploymentHandler.Added(deployment) + d.DeploymentHandler.Added(ctx, deployment) } else { d.Cache.DeleteFromDeploymentClusterCache(key, deployment) log.Debugf("ignoring deployment %v based on labels", deployment.Name) @@ -140,16 +143,16 @@ func HandleAddUpdateDeployment(ojb interface{}, d *DeploymentController) { } } -func (d *DeploymentController) Deleted(ojb interface{}) { +func (d *DeploymentController) Deleted(ctx context.Context, ojb interface{}) { deployment := ojb.(*k8sAppsV1.Deployment) key := d.Cache.getKey(deployment) - d.DeploymentHandler.Deleted(deployment) + d.DeploymentHandler.Deleted(ctx, deployment) if len(key) > 0 { d.Cache.DeleteFromDeploymentClusterCache(key, deployment) } } -func (d *DeploymentController) shouldIgnoreBasedOnLabels(deployment *k8sAppsV1.Deployment) bool { +func (d *DeploymentController) shouldIgnoreBasedOnLabels(ctx context.Context, deployment *k8sAppsV1.Deployment) bool { if deployment.Spec.Template.Labels[d.labelSet.AdmiralIgnoreLabel] == "true" { //if we should ignore, do that and who cares what else is there return true } @@ -162,7 +165,7 @@ func (d *DeploymentController) shouldIgnoreBasedOnLabels(deployment *k8sAppsV1.D return true } - ns, err := d.K8sClient.CoreV1().Namespaces().Get(deployment.Namespace, meta_v1.GetOptions{}) + ns, err := d.K8sClient.CoreV1().Namespaces().Get(ctx, deployment.Namespace, meta_v1.GetOptions{}) if err != nil { log.Warnf("Failed to get namespace object for deployment with namespace %v, err: %v", deployment.Namespace, err) return false @@ -174,9 +177,9 @@ func (d *DeploymentController) shouldIgnoreBasedOnLabels(deployment *k8sAppsV1.D return false //labels are fine, we should not ignore } -func (d *DeploymentController) GetDeploymentBySelectorInNamespace(serviceSelector map[string]string, namespace string) []k8sAppsV1.Deployment { +func (d *DeploymentController) GetDeploymentBySelectorInNamespace(ctx context.Context, serviceSelector map[string]string, namespace string) []k8sAppsV1.Deployment { - matchedDeployments, err := d.K8sClient.AppsV1().Deployments(namespace).List(meta_v1.ListOptions{}) + matchedDeployments, err := d.K8sClient.AppsV1().Deployments(namespace).List(ctx, meta_v1.ListOptions{}) if err != nil { logrus.Errorf("Failed to list deployments in cluster, error: %v", err) diff --git a/admiral/pkg/controller/admiral/deployment_test.go b/admiral/pkg/controller/admiral/deployment_test.go index 5701caa1..be41257d 100644 --- a/admiral/pkg/controller/admiral/deployment_test.go +++ b/admiral/pkg/controller/admiral/deployment_test.go @@ -1,21 +1,25 @@ package admiral import ( + "context" + "sort" + "sync" + "testing" + "time" + "github.com/google/go-cmp/cmp" "github.com/istio-ecosystem/admiral/admiral/pkg/controller/common" "github.com/istio-ecosystem/admiral/admiral/pkg/test" k8sAppsV1 "k8s.io/api/apps/v1" coreV1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/apis/meta/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes/fake" "k8s.io/client-go/tools/clientcmd" - "sort" - "sync" - "testing" - "time" ) func TestDeploymentController_Added(t *testing.T) { + ctx := context.Background() //Deployments with the correct label are added to the cache mdh := test.MockDeploymentHandler{} cache := deploymentCache{ @@ -98,14 +102,14 @@ func TestDeploymentController_Added(t *testing.T) { ns := coreV1.Namespace{} ns.Name = "test-ns" ns.Annotations = map[string]string{"admiral.io/ignore": "true"} - depController.K8sClient.CoreV1().Namespaces().Create(&ns) + depController.K8sClient.CoreV1().Namespaces().Create(ctx, &ns, metav1.CreateOptions{}) } depController.Cache.cache = map[string]*DeploymentClusterEntry{} if c.name == "Expects ignored deployment identified by label to be removed from the cache" { depController.Cache.UpdateDeploymentToClusterCache("id", &deployment) } - depController.Added(c.deployment) + depController.Added(ctx, c.deployment) if c.expectedDeployment == nil { if len(depController.Cache.cache) != 0 || (depController.Cache.cache["id"] != nil && len(depController.Cache.cache["id"].Deployments) != 0) { @@ -159,6 +163,8 @@ func TestDeploymentController_Deleted(t *testing.T) { }, } + ctx := context.Background() + for _, c := range testCases { t.Run(c.name, func(t *testing.T) { depController.K8sClient = fake.NewSimpleClientset() @@ -171,7 +177,7 @@ func TestDeploymentController_Deleted(t *testing.T) { }, } } - depController.Deleted(c.deployment) + depController.Deleted(ctx, c.deployment) if c.expectedDeployment == nil { if len(depController.Cache.cache) > 0 && len(depController.Cache.cache["id"].Deployments) != 0 { @@ -202,7 +208,7 @@ func TestDeploymentController_GetDeploymentBySelectorInNamespace(t *testing.T) { deployment.Namespace = "namespace" deployment.Name = "fake-app-deployment-qal" deployment.Spec = k8sAppsV1.DeploymentSpec{ - Selector: &v1.LabelSelector{MatchLabels: map[string]string{"identity": "app1"},}, + Selector: &v1.LabelSelector{MatchLabels: map[string]string{"identity": "app1"}}, Template: coreV1.PodTemplateSpec{ ObjectMeta: v1.ObjectMeta{ Labels: map[string]string{"identity": "app1", "env": "qal"}, @@ -214,7 +220,7 @@ func TestDeploymentController_GetDeploymentBySelectorInNamespace(t *testing.T) { deployment2.Namespace = "namespace" deployment2.Name = "fake-app-deployment-e2e" deployment2.Spec = k8sAppsV1.DeploymentSpec{ - Selector: &v1.LabelSelector{MatchLabels: map[string]string{"identity": "app1"},}, + Selector: &v1.LabelSelector{MatchLabels: map[string]string{"identity": "app1"}}, Template: coreV1.PodTemplateSpec{ ObjectMeta: v1.ObjectMeta{ Labels: map[string]string{"identity": "app1", "env": "e2e"}, @@ -227,7 +233,7 @@ func TestDeploymentController_GetDeploymentBySelectorInNamespace(t *testing.T) { deployment3.Name = "fake-app-deployment-prf-1" deployment3.CreationTimestamp = v1.Now() deployment3.Spec = k8sAppsV1.DeploymentSpec{ - Selector: &v1.LabelSelector{MatchLabels: map[string]string{"identity": "app1"},}, + Selector: &v1.LabelSelector{MatchLabels: map[string]string{"identity": "app1"}}, Template: coreV1.PodTemplateSpec{ ObjectMeta: v1.ObjectMeta{ Labels: map[string]string{"identity": "app1", "env": "prf"}, @@ -240,7 +246,7 @@ func TestDeploymentController_GetDeploymentBySelectorInNamespace(t *testing.T) { deployment4.Name = "fake-app-deployment-prf-2" deployment4.CreationTimestamp = v1.Date(2020, 1, 1, 1, 1, 1, 1, time.UTC) deployment4.Spec = k8sAppsV1.DeploymentSpec{ - Selector: &v1.LabelSelector{MatchLabels: map[string]string{"identity": "app2"},}, + Selector: &v1.LabelSelector{MatchLabels: map[string]string{"identity": "app2"}}, Template: coreV1.PodTemplateSpec{ ObjectMeta: v1.ObjectMeta{ Labels: map[string]string{"identity": "app2", "env": "prf"}, @@ -295,11 +301,12 @@ func TestDeploymentController_GetDeploymentBySelectorInNamespace(t *testing.T) { }, } + ctx := context.Background() //Run the test for every provided case for _, c := range testCases { t.Run(c.name, func(t *testing.T) { deploymentController.K8sClient = c.fakeClient - returnedDeployments := deploymentController.GetDeploymentBySelectorInNamespace(c.selector, "namespace") + returnedDeployments := deploymentController.GetDeploymentBySelectorInNamespace(ctx, c.selector, "namespace") sort.Slice(returnedDeployments, func(i, j int) bool { return returnedDeployments[i].Name > returnedDeployments[j].Name diff --git a/admiral/pkg/controller/admiral/globaltraffic.go b/admiral/pkg/controller/admiral/globaltraffic.go index d2b626b1..879c403f 100644 --- a/admiral/pkg/controller/admiral/globaltraffic.go +++ b/admiral/pkg/controller/admiral/globaltraffic.go @@ -1,25 +1,27 @@ package admiral import ( + "context" "fmt" - "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/v1" + "sync" + "time" + + v1 "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/v1" "github.com/istio-ecosystem/admiral/admiral/pkg/controller/common" "github.com/sirupsen/logrus" meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/rest" "k8s.io/client-go/tools/cache" - "sync" - "time" clientset "github.com/istio-ecosystem/admiral/admiral/pkg/client/clientset/versioned" informerV1 "github.com/istio-ecosystem/admiral/admiral/pkg/client/informers/externalversions/admiral/v1" ) -// Handler interface contains the methods that are required +// GlobalTrafficHandler interface contains the methods that are required type GlobalTrafficHandler interface { - Added(obj *v1.GlobalTrafficPolicy) - Updated(obj *v1.GlobalTrafficPolicy) - Deleted(obj *v1.GlobalTrafficPolicy) + Added(ctx context.Context, obj *v1.GlobalTrafficPolicy) + Updated(ctx context.Context, obj *v1.GlobalTrafficPolicy) + Deleted(ctx context.Context, obj *v1.GlobalTrafficPolicy) } type GlobalTrafficController struct { @@ -127,20 +129,20 @@ func NewGlobalTrafficController(clusterID string, stopCh <-chan struct{}, handle return &globalTrafficController, nil } -func (d *GlobalTrafficController) Added(ojb interface{}) { +func (d *GlobalTrafficController) Added(ctx context.Context, ojb interface{}) { gtp := ojb.(*v1.GlobalTrafficPolicy) d.Cache.Put(gtp) - d.GlobalTrafficHandler.Added(gtp) + d.GlobalTrafficHandler.Added(ctx, gtp) } -func (d *GlobalTrafficController) Updated(ojb interface{}, oldObj interface{}) { +func (d *GlobalTrafficController) Updated(ctx context.Context, ojb interface{}, oldObj interface{}) { gtp := ojb.(*v1.GlobalTrafficPolicy) d.Cache.Put(gtp) - d.GlobalTrafficHandler.Updated(gtp) + d.GlobalTrafficHandler.Updated(ctx, gtp) } -func (d *GlobalTrafficController) Deleted(ojb interface{}) { +func (d *GlobalTrafficController) Deleted(ctx context.Context, ojb interface{}) { gtp := ojb.(*v1.GlobalTrafficPolicy) d.Cache.Delete(gtp) - d.GlobalTrafficHandler.Deleted(gtp) + d.GlobalTrafficHandler.Deleted(ctx, gtp) } diff --git a/admiral/pkg/controller/admiral/globaltraffic_test.go b/admiral/pkg/controller/admiral/globaltraffic_test.go index a0892801..dd952e35 100644 --- a/admiral/pkg/controller/admiral/globaltraffic_test.go +++ b/admiral/pkg/controller/admiral/globaltraffic_test.go @@ -1,6 +1,7 @@ package admiral import ( + "context" "reflect" "sort" "sync" @@ -53,10 +54,12 @@ func TestGlobalTrafficAddUpdateDelete(t *testing.T) { t.Errorf("GlobalTraffic controller should never be nil without an error thrown") } + ctx := context.Background() + gtpName := "gtp1" gtp := model.GlobalTrafficPolicy{Selector: map[string]string{"identity": "payments", "env": "e2e"}, Policy: []*model.TrafficPolicy{}} gtpObj := makeK8sGtpObj(gtpName, "namespace1", gtp) - globalTrafficController.Added(gtpObj) + globalTrafficController.Added(ctx, gtpObj) if !cmp.Equal(handler.Obj.Spec, gtpObj.Spec) { t.Errorf("Add should call the handler with the object") @@ -65,13 +68,13 @@ func TestGlobalTrafficAddUpdateDelete(t *testing.T) { updatedGtp := model.GlobalTrafficPolicy{Selector: map[string]string{"identity": "payments", "env": "qa"}, Policy: []*model.TrafficPolicy{}} updatedGtpObj := makeK8sGtpObj(gtpName, "namespace1", updatedGtp) - globalTrafficController.Updated(updatedGtpObj, gtpObj) + globalTrafficController.Updated(ctx, updatedGtpObj, gtpObj) if !cmp.Equal(handler.Obj.Spec, updatedGtpObj.Spec) { t.Errorf("Update should call the handler with the updated object") } - globalTrafficController.Deleted(updatedGtpObj) + globalTrafficController.Deleted(ctx, updatedGtpObj) if handler.Obj != nil { t.Errorf("Delete should delete the gtp") @@ -100,8 +103,10 @@ func TestGlobalTrafficController_Updated(t *testing.T) { gtpUpdatedToIgnore = v1.GlobalTrafficPolicy{ObjectMeta: v12.ObjectMeta{Name: "gtp", Namespace: "namespace1", Labels: map[string]string{"identity": "id", "admiral.io/env": "stage"}, Annotations: map[string]string{"admiral.io/ignore": "true"}}} ) + ctx := context.Background() + //add the base object to cache - gtpController.Added(>p) + gtpController.Added(ctx, >p) testCases := []struct { name string @@ -121,7 +126,7 @@ func TestGlobalTrafficController_Updated(t *testing.T) { } for _, c := range testCases { t.Run(c.name, func(t *testing.T) { - gtpController.Updated(c.gtp, gtp) + gtpController.Updated(ctx, c.gtp, gtp) gtpKey := common.GetGtpKey(c.gtp) matchedGtps := gtpController.Cache.Get(gtpKey, c.gtp.Namespace) if !reflect.DeepEqual(c.expectedGtps, matchedGtps) { @@ -156,9 +161,11 @@ func TestGlobalTrafficController_Deleted(t *testing.T) { }} ) + ctx := context.Background() + //add the base object to cache - gtpController.Added(>p) - gtpController.Added(>p2) + gtpController.Added(ctx, >p) + gtpController.Added(ctx, >p2) testCases := []struct { name string @@ -178,7 +185,7 @@ func TestGlobalTrafficController_Deleted(t *testing.T) { } for _, c := range testCases { t.Run(c.name, func(t *testing.T) { - gtpController.Deleted(c.gtp) + gtpController.Deleted(ctx, c.gtp) gtpKey := common.GetGtpKey(c.gtp) matchedGtps := gtpController.Cache.Get(gtpKey, c.gtp.Namespace) if !reflect.DeepEqual(c.expectedGtps, matchedGtps) { @@ -199,6 +206,8 @@ func TestGlobalTrafficController_Added(t *testing.T) { gtp3 = v1.GlobalTrafficPolicy{ObjectMeta: v12.ObjectMeta{Name: "gtp3", Namespace: "namespace3", Labels: map[string]string{"identity": "id", "admiral.io/env": "stage"}}} ) + ctx := context.Background() + testCases := []struct { name string gtpKey string @@ -245,7 +254,7 @@ func TestGlobalTrafficController_Added(t *testing.T) { }, } for _, g := range c.gtp { - gtpController.Added(g) + gtpController.Added(ctx, g) } matchedGtps := gtpController.Cache.Get(c.gtpKey, c.namespace) sort.Slice(matchedGtps, func(i, j int) bool { diff --git a/admiral/pkg/controller/admiral/node.go b/admiral/pkg/controller/admiral/node.go index 81479785..4e3b8368 100644 --- a/admiral/pkg/controller/admiral/node.go +++ b/admiral/pkg/controller/admiral/node.go @@ -1,7 +1,9 @@ package admiral import ( + "context" "fmt" + "github.com/istio-ecosystem/admiral/admiral/pkg/controller/common" k8sV1Informers "k8s.io/client-go/informers/core/v1" "k8s.io/client-go/rest" @@ -11,7 +13,7 @@ import ( "k8s.io/client-go/tools/cache" ) -// Handler interface contains the methods that are required +// NodeHandler interface contains the methods that are required type NodeHandler interface { } @@ -50,17 +52,17 @@ func NewNodeController(clusterID string, stopCh <-chan struct{}, handler NodeHan return &nodeController, nil } -func (p *NodeController) Added(obj interface{}) { +func (p *NodeController) Added(ctx context.Context, obj interface{}) { node := obj.(*k8sV1.Node) if p.Locality == nil { p.Locality = &Locality{Region: common.GetNodeLocality(node)} } } -func (p *NodeController) Updated(obj interface{}, oldObj interface{}) { +func (p *NodeController) Updated(ctx context.Context, obj interface{}, oldObj interface{}) { //ignore } -func (p *NodeController) Deleted(obj interface{}) { +func (p *NodeController) Deleted(ctx context.Context, obj interface{}) { //ignore } diff --git a/admiral/pkg/controller/admiral/node_test.go b/admiral/pkg/controller/admiral/node_test.go index a1c9fa27..fa63e7d0 100644 --- a/admiral/pkg/controller/admiral/node_test.go +++ b/admiral/pkg/controller/admiral/node_test.go @@ -1,12 +1,14 @@ package admiral import ( + "context" + "testing" + "github.com/istio-ecosystem/admiral/admiral/pkg/controller/common" "github.com/istio-ecosystem/admiral/admiral/pkg/test" k8sV1 "k8s.io/api/core/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/tools/clientcmd" - "testing" ) func TestNewNodeController(t *testing.T) { @@ -48,7 +50,9 @@ func TestNodeAddUpdateDelete(t *testing.T) { region := "us-west-2" nodeObj := &k8sV1.Node{Spec: k8sV1.NodeSpec{}, ObjectMeta: v1.ObjectMeta{Labels: map[string]string{common.NodeRegionLabel: region}}} - nodeController.Added(nodeObj) + ctx := context.Background() + + nodeController.Added(ctx, nodeObj) locality := nodeController.Locality @@ -56,13 +60,13 @@ func TestNodeAddUpdateDelete(t *testing.T) { t.Errorf("region expected %v, got: %v", region, locality.Region) } - nodeController.Updated(nodeObj, nodeObj) + nodeController.Updated(ctx, nodeObj, nodeObj) //update should make no difference if locality.Region != region { t.Errorf("region expected %v, got: %v", region, locality.Region) } - nodeController.Deleted(nodeObj) + nodeController.Deleted(ctx, nodeObj) //delete should make no difference if locality.Region != region { t.Errorf("region expected %v, got: %v", region, locality.Region) diff --git a/admiral/pkg/controller/admiral/rollouts.go b/admiral/pkg/controller/admiral/rollouts.go index 5724cd48..b2b6597b 100644 --- a/admiral/pkg/controller/admiral/rollouts.go +++ b/admiral/pkg/controller/admiral/rollouts.go @@ -1,6 +1,7 @@ package admiral import ( + "context" "fmt" "sync" "time" @@ -10,8 +11,8 @@ import ( argoprojv1alpha1 "github.com/argoproj/argo-rollouts/pkg/client/clientset/versioned/typed/rollouts/v1alpha1" argoinformers "github.com/argoproj/argo-rollouts/pkg/client/informers/externalversions" "github.com/istio-ecosystem/admiral/admiral/pkg/controller/common" - "github.com/prometheus/common/log" "github.com/sirupsen/logrus" + log "github.com/sirupsen/logrus" meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" @@ -20,9 +21,9 @@ import ( // Handler interface contains the methods that are required type RolloutHandler interface { - Added(obj *argo.Rollout) - Updated(obj *argo.Rollout) - Deleted(obj *argo.Rollout) + Added(ctx context.Context, obj *argo.Rollout) + Updated(ctx context.Context, obj *argo.Rollout) + Deleted(ctx context.Context, obj *argo.Rollout) } type RolloutsEntry struct { @@ -109,7 +110,7 @@ func (p *rolloutCache) DeleteFromRolloutToClusterCache(key string, rollout *argo } } -func (d *RolloutController) shouldIgnoreBasedOnLabelsForRollout(rollout *argo.Rollout) bool { +func (d *RolloutController) shouldIgnoreBasedOnLabelsForRollout(ctx context.Context, rollout *argo.Rollout) bool { if rollout.Spec.Template.Labels[d.labelSet.AdmiralIgnoreLabel] == "true" { //if we should ignore, do that and who cares what else is there return true } @@ -122,7 +123,7 @@ func (d *RolloutController) shouldIgnoreBasedOnLabelsForRollout(rollout *argo.Ro return true } - ns, err := d.K8sClient.CoreV1().Namespaces().Get(rollout.Namespace, meta_v1.GetOptions{}) + ns, err := d.K8sClient.CoreV1().Namespaces().Get(ctx, rollout.Namespace, meta_v1.GetOptions{}) if err != nil { log.Warnf("Failed to get namespace object for rollout with namespace %v, err: %v", rollout.Namespace, err) return false @@ -172,21 +173,21 @@ func NewRolloutsController(clusterID string, stopCh <-chan struct{}, handler Rol return &roController, nil } -func (roc *RolloutController) Added(ojb interface{}) { - HandleAddUpdateRollout(ojb, roc) +func (roc *RolloutController) Added(ctx context.Context, ojb interface{}) { + HandleAddUpdateRollout(ctx, ojb, roc) } -func (roc *RolloutController) Updated(ojb interface{}, oldObj interface{}) { - HandleAddUpdateRollout(ojb, roc) +func (roc *RolloutController) Updated(ctx context.Context, ojb interface{}, oldObj interface{}) { + HandleAddUpdateRollout(ctx, ojb, roc) } -func HandleAddUpdateRollout(ojb interface{}, roc *RolloutController) { +func HandleAddUpdateRollout(ctx context.Context, ojb interface{}, roc *RolloutController) { rollout := ojb.(*argo.Rollout) key := roc.Cache.getKey(rollout) if len(key) > 0 { - if !roc.shouldIgnoreBasedOnLabelsForRollout(rollout) { + if !roc.shouldIgnoreBasedOnLabelsForRollout(ctx, rollout) { roc.Cache.UpdateRolloutToClusterCache(key, rollout) - roc.RolloutHandler.Added(rollout) + roc.RolloutHandler.Added(ctx, rollout) } else { roc.Cache.DeleteFromRolloutToClusterCache(key, rollout) log.Debugf("ignoring rollout %v based on labels", rollout.Name) @@ -194,18 +195,18 @@ func HandleAddUpdateRollout(ojb interface{}, roc *RolloutController) { } } -func (roc *RolloutController) Deleted(ojb interface{}) { +func (roc *RolloutController) Deleted(ctx context.Context, ojb interface{}) { rollout := ojb.(*argo.Rollout) key := roc.Cache.getKey(rollout) if len(key) > 0 { roc.Cache.DeleteFromRolloutToClusterCache(key, rollout) } - roc.RolloutHandler.Deleted(rollout) + roc.RolloutHandler.Deleted(ctx, rollout) } -func (d *RolloutController) GetRolloutBySelectorInNamespace(serviceSelector map[string]string, namespace string) []argo.Rollout { +func (d *RolloutController) GetRolloutBySelectorInNamespace(ctx context.Context, serviceSelector map[string]string, namespace string) []argo.Rollout { - matchedRollouts, err := d.RolloutClient.Rollouts(namespace).List(meta_v1.ListOptions{}) + matchedRollouts, err := d.RolloutClient.Rollouts(namespace).List(ctx, meta_v1.ListOptions{}) if err != nil { logrus.Errorf("Failed to list rollouts in cluster, error: %v", err) diff --git a/admiral/pkg/controller/admiral/rollouts_test.go b/admiral/pkg/controller/admiral/rollouts_test.go index a84d76e1..28cccae9 100644 --- a/admiral/pkg/controller/admiral/rollouts_test.go +++ b/admiral/pkg/controller/admiral/rollouts_test.go @@ -1,6 +1,12 @@ package admiral import ( + "context" + "sort" + "sync" + "testing" + "time" + argo "github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1" argofake "github.com/argoproj/argo-rollouts/pkg/client/clientset/versioned/fake" argoprojv1alpha1 "github.com/argoproj/argo-rollouts/pkg/client/clientset/versioned/typed/rollouts/v1alpha1" @@ -8,13 +14,10 @@ import ( "github.com/istio-ecosystem/admiral/admiral/pkg/controller/common" "github.com/istio-ecosystem/admiral/admiral/pkg/test" coreV1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/apis/meta/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes/fake" "k8s.io/client-go/tools/clientcmd" - "sort" - "sync" - "testing" - "time" ) func TestNewRolloutController(t *testing.T) { @@ -33,6 +36,7 @@ func TestNewRolloutController(t *testing.T) { } func TestRolloutController_Added(t *testing.T) { + ctx := context.Background() //Rollouts with the correct label are added to the cache mdh := test.MockRolloutHandler{} cache := rolloutCache{ @@ -115,10 +119,10 @@ func TestRolloutController_Added(t *testing.T) { ns := coreV1.Namespace{} ns.Name = "test-ns" ns.Annotations = map[string]string{"admiral.io/ignore": "true"} - depController.K8sClient.CoreV1().Namespaces().Create(&ns) + depController.K8sClient.CoreV1().Namespaces().Create(ctx, &ns, metav1.CreateOptions{}) } depController.Cache.cache = map[string]*RolloutClusterEntry{} - depController.Added(c.rollout) + depController.Added(ctx, c.rollout) if c.expectedRollout == nil { if len(depController.Cache.cache) != 0 || (depController.Cache.cache["id"] != nil && len(depController.Cache.cache["id"].Rollouts) != 0) { t.Errorf("Cache should be empty if expected rollout is nil") @@ -135,6 +139,7 @@ func TestRolloutController_Added(t *testing.T) { } func TestRolloutController_Deleted(t *testing.T) { + ctx := context.Background() //Rollouts with the correct label are added to the cache mdh := test.MockRolloutHandler{} cache := rolloutCache{ @@ -183,7 +188,7 @@ func TestRolloutController_Deleted(t *testing.T) { }, } } - depController.Deleted(c.rollout) + depController.Deleted(ctx, c.rollout) if c.expectedRollout == nil { if len(depController.Cache.cache) > 0 && len(depController.Cache.cache["id"].Rollouts) != 0 { @@ -196,11 +201,12 @@ func TestRolloutController_Deleted(t *testing.T) { } func TestRolloutController_GetRolloutBySelectorInNamespace(t *testing.T) { + rollout := argo.Rollout{} rollout.Namespace = "namespace" rollout.Name = "fake-app-rollout-qal" rollout.Spec = argo.RolloutSpec{ - Selector: &v1.LabelSelector{MatchLabels: map[string]string{"identity": "app1"},}, + Selector: &v1.LabelSelector{MatchLabels: map[string]string{"identity": "app1"}}, Template: coreV1.PodTemplateSpec{ ObjectMeta: v1.ObjectMeta{ Labels: map[string]string{"identity": "app1", "env": "qal"}, @@ -212,7 +218,7 @@ func TestRolloutController_GetRolloutBySelectorInNamespace(t *testing.T) { rollout2.Namespace = "namespace" rollout2.Name = "fake-app-rollout-e2e" rollout2.Spec = argo.RolloutSpec{ - Selector: &v1.LabelSelector{MatchLabels: map[string]string{"identity": "app1"},}, + Selector: &v1.LabelSelector{MatchLabels: map[string]string{"identity": "app1"}}, Template: coreV1.PodTemplateSpec{ ObjectMeta: v1.ObjectMeta{ Labels: map[string]string{"identity": "app1", "env": "e2e"}, @@ -225,7 +231,7 @@ func TestRolloutController_GetRolloutBySelectorInNamespace(t *testing.T) { rollout3.Name = "fake-app-rollout-prf-1" rollout3.CreationTimestamp = v1.Now() rollout3.Spec = argo.RolloutSpec{ - Selector: &v1.LabelSelector{MatchLabels: map[string]string{"identity": "app1"},}, + Selector: &v1.LabelSelector{MatchLabels: map[string]string{"identity": "app1"}}, Template: coreV1.PodTemplateSpec{ ObjectMeta: v1.ObjectMeta{ Labels: map[string]string{"identity": "app1", "env": "prf"}, @@ -238,7 +244,7 @@ func TestRolloutController_GetRolloutBySelectorInNamespace(t *testing.T) { rollout4.Name = "fake-app-rollout-prf-2" rollout4.CreationTimestamp = v1.Date(2020, 1, 1, 1, 1, 1, 1, time.UTC) rollout4.Spec = argo.RolloutSpec{ - Selector: &v1.LabelSelector{MatchLabels: map[string]string{"identity": "app2"},}, + Selector: &v1.LabelSelector{MatchLabels: map[string]string{"identity": "app2"}}, Template: coreV1.PodTemplateSpec{ ObjectMeta: v1.ObjectMeta{ Labels: map[string]string{"identity": "app2", "env": "prf"}, @@ -265,39 +271,41 @@ func TestRolloutController_GetRolloutBySelectorInNamespace(t *testing.T) { name: "Get one", expectedRollouts: []argo.Rollout{rollout}, fakeClient: oneRolloutClient, - selector: map[string]string {"identity": "app1", common.RolloutPodHashLabel: "random-hash"}, + selector: map[string]string{"identity": "app1", common.RolloutPodHashLabel: "random-hash"}, }, { name: "Get one from long list", expectedRollouts: []argo.Rollout{rollout4}, fakeClient: allRolloutsClient, - selector: map[string]string {"identity": "app2", common.RolloutPodHashLabel: "random-hash"}, + selector: map[string]string{"identity": "app2", common.RolloutPodHashLabel: "random-hash"}, }, { name: "Get many from long list", expectedRollouts: []argo.Rollout{rollout, rollout3, rollout2}, fakeClient: allRolloutsClient, - selector: map[string]string {"identity": "app1", common.RolloutPodHashLabel: "random-hash"}, + selector: map[string]string{"identity": "app1", common.RolloutPodHashLabel: "random-hash"}, }, { name: "Get none from long list", expectedRollouts: []argo.Rollout{}, fakeClient: allRolloutsClient, - selector: map[string]string {"identity": "app3", common.RolloutPodHashLabel: "random-hash"}, + selector: map[string]string{"identity": "app3", common.RolloutPodHashLabel: "random-hash"}, }, { name: "Get none from empty list", expectedRollouts: []argo.Rollout{}, fakeClient: noRolloutsClient, - selector: map[string]string {"identity": "app1"}, + selector: map[string]string{"identity": "app1"}, }, } + ctx := context.Background() + //Run the test for every provided case for _, c := range testCases { t.Run(c.name, func(t *testing.T) { rolloutController.RolloutClient = c.fakeClient - returnedRollouts := rolloutController.GetRolloutBySelectorInNamespace(c.selector, "namespace") + returnedRollouts := rolloutController.GetRolloutBySelectorInNamespace(ctx, c.selector, "namespace") sort.Slice(returnedRollouts, func(i, j int) bool { return returnedRollouts[i].Name > returnedRollouts[j].Name diff --git a/admiral/pkg/controller/admiral/routingpolicy.go b/admiral/pkg/controller/admiral/routingpolicy.go index c16f99a3..fb9eef87 100644 --- a/admiral/pkg/controller/admiral/routingpolicy.go +++ b/admiral/pkg/controller/admiral/routingpolicy.go @@ -1,9 +1,11 @@ - package admiral import ( + "context" "fmt" - "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/v1" + "time" + + v1 "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/v1" clientset "github.com/istio-ecosystem/admiral/admiral/pkg/client/clientset/versioned" informerV1 "github.com/istio-ecosystem/admiral/admiral/pkg/client/informers/externalversions/admiral/v1" "istio.io/client-go/pkg/clientset/versioned" @@ -11,48 +13,46 @@ import ( "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" "k8s.io/client-go/tools/cache" - "time" ) -// Handler interface contains the methods that are required +// RoutingPolicyHandler interface contains the methods that are required type RoutingPolicyHandler interface { - Added(obj *v1.RoutingPolicy) - Updated(obj *v1.RoutingPolicy) - Deleted(obj *v1.RoutingPolicy) + Added(ctx context.Context, obj *v1.RoutingPolicy) + Updated(ctx context.Context, obj *v1.RoutingPolicy) + Deleted(ctx context.Context, obj *v1.RoutingPolicy) } type RoutingPolicyEntry struct { - Identity string - RoutingPolicy *v1.RoutingPolicy + Identity string + RoutingPolicy *v1.RoutingPolicy } type RoutingPolicyClusterEntry struct { - Identity string + Identity string RoutingPolicies map[string]*v1.RoutingPolicy } type RoutingPolicyController struct { - K8sClient kubernetes.Interface + K8sClient kubernetes.Interface CrdClient clientset.Interface - IstioClient versioned.Interface + IstioClient versioned.Interface RoutingPolicyHandler RoutingPolicyHandler informer cache.SharedIndexInformer } - -func (r *RoutingPolicyController) Added(obj interface{}) { +func (r *RoutingPolicyController) Added(ctx context.Context, obj interface{}) { routingPolicy := obj.(*v1.RoutingPolicy) - r.RoutingPolicyHandler.Added(routingPolicy) + r.RoutingPolicyHandler.Added(ctx, routingPolicy) } -func (r *RoutingPolicyController) Updated(obj interface{}, oldObj interface{}) { +func (r *RoutingPolicyController) Updated(ctx context.Context, obj interface{}, oldObj interface{}) { routingPolicy := obj.(*v1.RoutingPolicy) - r.RoutingPolicyHandler.Updated(routingPolicy) + r.RoutingPolicyHandler.Updated(ctx, routingPolicy) } -func (r *RoutingPolicyController) Deleted(obj interface{}) { +func (r *RoutingPolicyController) Deleted(ctx context.Context, obj interface{}) { routingPolicy := obj.(*v1.RoutingPolicy) - r.RoutingPolicyHandler.Deleted(routingPolicy) + r.RoutingPolicyHandler.Deleted(ctx, routingPolicy) } func NewRoutingPoliciesController(stopCh <-chan struct{}, handler RoutingPolicyHandler, configPath *rest.Config, resyncPeriod time.Duration) (*RoutingPolicyController, error) { @@ -84,7 +84,7 @@ func NewRoutingPoliciesController(stopCh <-chan struct{}, handler RoutingPolicyH cache.Indexers{}, ) - NewController("rp-ctrl-" + configPath.Host, stopCh, &rpController, rpController.informer) + NewController("rp-ctrl-"+configPath.Host, stopCh, &rpController, rpController.informer) return &rpController, nil } diff --git a/admiral/pkg/controller/admiral/routingpolicy_test.go b/admiral/pkg/controller/admiral/routingpolicy_test.go index 6219f953..47ec8114 100644 --- a/admiral/pkg/controller/admiral/routingpolicy_test.go +++ b/admiral/pkg/controller/admiral/routingpolicy_test.go @@ -1,17 +1,18 @@ package admiral import ( + "context" + "testing" + "time" + "github.com/google/go-cmp/cmp" "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/model" v1 "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/v1" "github.com/istio-ecosystem/admiral/admiral/pkg/test" v12 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/tools/clientcmd" - "testing" - "time" ) - func TestNewroutingPolicyController(t *testing.T) { config, err := clientcmd.BuildConfigFromFlags("", "../../test/resources/admins@fake-cluster.k8s.local") if err != nil { @@ -31,7 +32,6 @@ func TestNewroutingPolicyController(t *testing.T) { } } - func TestRoutingPolicyAddUpdateDelete(t *testing.T) { config, err := clientcmd.BuildConfigFromFlags("", "../../test/resources/admins@fake-cluster.k8s.local") if err != nil { @@ -53,11 +53,13 @@ func TestRoutingPolicyAddUpdateDelete(t *testing.T) { rp := model.RoutingPolicy{ Config: map[string]string{"cacheTTL": "86400", "dispatcherUrl": "stage.greeting.router.mesh", "pathPrefix": "/hello,/hello/v2/"}, Plugin: "greeting", - Hosts: []string{"stage.greeting.mesh"}, + Hosts: []string{"stage.greeting.mesh"}, } + ctx := context.Background() + rpObj := makeK8sRoutingPolicyObj(rpName, "namespace1", rp) - routingPolicyController.Added(rpObj) + routingPolicyController.Added(ctx, rpObj) if !cmp.Equal(handler.Obj.Spec, rpObj.Spec) { t.Errorf("Add should call the handler with the object") @@ -66,18 +68,18 @@ func TestRoutingPolicyAddUpdateDelete(t *testing.T) { updatedrp := model.RoutingPolicy{ Config: map[string]string{"cacheTTL": "86400", "dispatcherUrl": "e2e.greeting.router.mesh", "pathPrefix": "/hello,/hello/v2/"}, Plugin: "greeting", - Hosts: []string{"e2e.greeting.mesh"}, + Hosts: []string{"e2e.greeting.mesh"}, } updatedRpObj := makeK8sRoutingPolicyObj(rpName, "namespace1", updatedrp) - routingPolicyController.Updated(updatedRpObj, rpObj) + routingPolicyController.Updated(ctx, updatedRpObj, rpObj) if !cmp.Equal(handler.Obj.Spec, updatedRpObj.Spec) { t.Errorf("Update should call the handler with the updated object") } - routingPolicyController.Deleted(updatedRpObj) + routingPolicyController.Deleted(ctx, updatedRpObj) if handler.Obj != nil { t.Errorf("Delete should delete the routing policy") @@ -85,7 +87,6 @@ func TestRoutingPolicyAddUpdateDelete(t *testing.T) { } - func makeK8sRoutingPolicyObj(name string, namespace string, rp model.RoutingPolicy) *v1.RoutingPolicy { return &v1.RoutingPolicy{ Spec: rp, diff --git a/admiral/pkg/controller/admiral/service.go b/admiral/pkg/controller/admiral/service.go index 0f998c52..a4d9a599 100644 --- a/admiral/pkg/controller/admiral/service.go +++ b/admiral/pkg/controller/admiral/service.go @@ -1,11 +1,13 @@ package admiral import ( + "context" "fmt" - "github.com/prometheus/common/log" "sort" "time" + "github.com/prometheus/common/log" + "github.com/istio-ecosystem/admiral/admiral/pkg/controller/common" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" @@ -19,11 +21,11 @@ import ( "k8s.io/client-go/tools/cache" ) -// Handler interface contains the methods that are required +// ServiceHandler interface contains the methods that are required type ServiceHandler interface { - Added(obj *k8sV1.Service) - Updated(obj *k8sV1.Service) - Deleted(obj *k8sV1.Service) + Added(ctx context.Context, obj *k8sV1.Service) + Updated(ctx context.Context, obj *k8sV1.Service) + Deleted(ctx context.Context, obj *k8sV1.Service) } type ServiceClusterEntry struct { @@ -80,7 +82,7 @@ func (s *serviceCache) Get(key string) []*k8sV1.Service { defer s.mutex.Unlock() serviceClusterEntry := s.cache[key] if serviceClusterEntry != nil { - return getOrderedServices (serviceClusterEntry.Service[key]) + return getOrderedServices(serviceClusterEntry.Service[key]) } else { return nil } @@ -88,7 +90,7 @@ func (s *serviceCache) Get(key string) []*k8sV1.Service { func getOrderedServices(serviceMap map[string]*k8sV1.Service) []*k8sV1.Service { orderedServices := make([]*k8sV1.Service, 0, len(serviceMap)) - for _, value := range serviceMap { + for _, value := range serviceMap { orderedServices = append(orderedServices, value) } if len(orderedServices) > 1 { @@ -164,13 +166,15 @@ func NewServiceController(clusterID string, stopCh <-chan struct{}, handler Serv return nil, fmt.Errorf("failed to create ingress service controller k8s client: %v", err) } + ctx := context.Background() + serviceController.informer = cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(opts meta_v1.ListOptions) (runtime.Object, error) { - return serviceController.K8sClient.CoreV1().Services(meta_v1.NamespaceAll).List(opts) + return serviceController.K8sClient.CoreV1().Services(meta_v1.NamespaceAll).List(ctx, opts) }, WatchFunc: func(opts meta_v1.ListOptions) (watch.Interface, error) { - return serviceController.K8sClient.CoreV1().Services(meta_v1.NamespaceAll).Watch(opts) + return serviceController.K8sClient.CoreV1().Services(meta_v1.NamespaceAll).Watch(ctx, opts) }, }, &k8sV1.Service{}, resyncPeriod, cache.Indexers{}, @@ -182,22 +186,23 @@ func NewServiceController(clusterID string, stopCh <-chan struct{}, handler Serv return &serviceController, nil } -func (s *ServiceController) Added(obj interface{}) { +func (s *ServiceController) Added(ctx context.Context, obj interface{}) { service := obj.(*k8sV1.Service) s.Cache.Put(service) - s.ServiceHandler.Added(service) + s.ServiceHandler.Added(ctx, service) } -func (s *ServiceController) Updated(obj interface{}, oldObj interface{}) { +func (s *ServiceController) Updated(ctx context.Context, obj interface{}, oldObj interface{}) { + service := obj.(*k8sV1.Service) s.Cache.Put(service) - s.ServiceHandler.Updated(service) + s.ServiceHandler.Updated(ctx, service) } -func (s *ServiceController) Deleted(obj interface{}) { +func (s *ServiceController) Deleted(ctx context.Context, obj interface{}) { service := obj.(*k8sV1.Service) s.Cache.Delete(service) - s.ServiceHandler.Deleted(service) + s.ServiceHandler.Deleted(ctx, service) } func (s *serviceCache) shouldIgnoreBasedOnLabels(service *k8sV1.Service) bool { diff --git a/admiral/pkg/controller/admiral/service_test.go b/admiral/pkg/controller/admiral/service_test.go index fb2cd30f..3b958846 100644 --- a/admiral/pkg/controller/admiral/service_test.go +++ b/admiral/pkg/controller/admiral/service_test.go @@ -130,11 +130,11 @@ func TestServiceCache_GetLoadBalancer(t *testing.T) { externalIPService.Spec.ExternalIPs = []string{"1.2.3.4"} externalIPService.Spec.Ports = []v1.ServicePort{ { - "http", - v1.ProtocolTCP, - common.DefaultMtlsPort, - intstr.FromInt(80), - 30800, + Name: "http", + Protocol: v1.ProtocolTCP, + Port: common.DefaultMtlsPort, + TargetPort: intstr.FromInt(80), + NodePort: 30800, }, } externalIPService.Labels = map[string]string{"app": "test-service-externalip"} diff --git a/admiral/pkg/controller/istio/destinationrule.go b/admiral/pkg/controller/istio/destinationrule.go index 467f8e65..f3a6c53c 100644 --- a/admiral/pkg/controller/istio/destinationrule.go +++ b/admiral/pkg/controller/istio/destinationrule.go @@ -1,6 +1,7 @@ package istio import ( + "context" "fmt" "time" @@ -15,9 +16,9 @@ import ( // Handler interface contains the methods that are required type DestinationRuleHandler interface { - Added(obj *networking.DestinationRule) - Updated(obj *networking.DestinationRule) - Deleted(obj *networking.DestinationRule) + Added(ctx context.Context, obj *networking.DestinationRule) + Updated(ctx context.Context, obj *networking.DestinationRule) + Deleted(ctx context.Context, obj *networking.DestinationRule) } type DestinationRuleEntry struct { @@ -53,18 +54,18 @@ func NewDestinationRuleController(clusterID string, stopCh <-chan struct{}, hand return &drController, nil } -func (sec *DestinationRuleController) Added(ojb interface{}) { +func (sec *DestinationRuleController) Added(ctx context.Context, ojb interface{}) { dr := ojb.(*networking.DestinationRule) - sec.DestinationRuleHandler.Added(dr) + sec.DestinationRuleHandler.Added(ctx, dr) } -func (sec *DestinationRuleController) Updated(ojb interface{}, oldObj interface{}) { +func (sec *DestinationRuleController) Updated(ctx context.Context, ojb interface{}, oldObj interface{}) { dr := ojb.(*networking.DestinationRule) - sec.DestinationRuleHandler.Updated(dr) + sec.DestinationRuleHandler.Updated(ctx, dr) } -func (sec *DestinationRuleController) Deleted(ojb interface{}) { +func (sec *DestinationRuleController) Deleted(ctx context.Context, ojb interface{}) { dr := ojb.(*networking.DestinationRule) - sec.DestinationRuleHandler.Deleted(dr) + sec.DestinationRuleHandler.Deleted(ctx, dr) } diff --git a/admiral/pkg/controller/istio/destinationrule_test.go b/admiral/pkg/controller/istio/destinationrule_test.go index 82e08c5e..5112e0c4 100644 --- a/admiral/pkg/controller/istio/destinationrule_test.go +++ b/admiral/pkg/controller/istio/destinationrule_test.go @@ -1,14 +1,17 @@ package istio import ( + "context" + "testing" + "time" + "github.com/google/go-cmp/cmp" "github.com/istio-ecosystem/admiral/admiral/pkg/test" + "google.golang.org/protobuf/testing/protocmp" v1alpha32 "istio.io/api/networking/v1alpha3" "istio.io/client-go/pkg/apis/networking/v1alpha3" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/tools/clientcmd" - "testing" - "time" ) func TestNewDestinationRuleController(t *testing.T) { @@ -31,20 +34,21 @@ func TestNewDestinationRuleController(t *testing.T) { dstRule := &v1alpha3.DestinationRule{Spec: v1alpha32.DestinationRule{}, ObjectMeta: v1.ObjectMeta{Name: "dr1", Namespace: "namespace1"}} - destinationRuleController.Added(dstRule) + ctx := context.Background() - if !cmp.Equal(dstRule.Spec, handler.Obj.Spec) { + destinationRuleController.Added(ctx, dstRule) + if !cmp.Equal(&dstRule.Spec, &handler.Obj.Spec, protocmp.Transform()) { t.Errorf("Handler should have the added obj") } updatedDstRule := &v1alpha3.DestinationRule{Spec: v1alpha32.DestinationRule{Host: "hello.global"}, ObjectMeta: v1.ObjectMeta{Name: "dr1", Namespace: "namespace1"}} - destinationRuleController.Updated(updatedDstRule, dstRule) + destinationRuleController.Updated(ctx, updatedDstRule, dstRule) - if !cmp.Equal(updatedDstRule.Spec, handler.Obj.Spec) { + if !cmp.Equal(&updatedDstRule.Spec, &handler.Obj.Spec, protocmp.Transform()) { t.Errorf("Handler should have the updated obj") } - destinationRuleController.Deleted(dstRule) + destinationRuleController.Deleted(ctx, dstRule) if handler.Obj != nil { t.Errorf("Handler should have no obj") diff --git a/admiral/pkg/controller/istio/serviceentry.go b/admiral/pkg/controller/istio/serviceentry.go index 7d98cf37..2fd97375 100644 --- a/admiral/pkg/controller/istio/serviceentry.go +++ b/admiral/pkg/controller/istio/serviceentry.go @@ -1,6 +1,7 @@ package istio import ( + "context" "fmt" "time" @@ -53,17 +54,17 @@ func NewServiceEntryController(clusterID string, stopCh <-chan struct{}, handler return &seController, nil } -func (sec *ServiceEntryController) Added(ojb interface{}) { +func (sec *ServiceEntryController) Added(ctx context.Context, ojb interface{}) { se := ojb.(*networking.ServiceEntry) sec.ServiceEntryHandler.Added(se) } -func (sec *ServiceEntryController) Updated(ojb interface{}, oldObj interface{}) { +func (sec *ServiceEntryController) Updated(ctx context.Context, ojb interface{}, oldObj interface{}) { se := ojb.(*networking.ServiceEntry) sec.ServiceEntryHandler.Updated(se) } -func (sec *ServiceEntryController) Deleted(ojb interface{}) { +func (sec *ServiceEntryController) Deleted(ctx context.Context, ojb interface{}) { se := ojb.(*networking.ServiceEntry) sec.ServiceEntryHandler.Deleted(se) } diff --git a/admiral/pkg/controller/istio/serviceentry_test.go b/admiral/pkg/controller/istio/serviceentry_test.go index 0b8c02e6..31b0ba20 100644 --- a/admiral/pkg/controller/istio/serviceentry_test.go +++ b/admiral/pkg/controller/istio/serviceentry_test.go @@ -1,14 +1,17 @@ package istio import ( + "context" + "testing" + "time" + "github.com/google/go-cmp/cmp" "github.com/istio-ecosystem/admiral/admiral/pkg/test" + "google.golang.org/protobuf/testing/protocmp" "istio.io/api/networking/v1alpha3" v1alpha32 "istio.io/client-go/pkg/apis/networking/v1alpha3" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/tools/clientcmd" - "testing" - "time" ) func TestNewServiceEntryController(t *testing.T) { @@ -31,20 +34,22 @@ func TestNewServiceEntryController(t *testing.T) { serviceEntry := &v1alpha32.ServiceEntry{Spec: v1alpha3.ServiceEntry{}, ObjectMeta: v1.ObjectMeta{Name: "se1", Namespace: "namespace1"}} - serviceEntryController.Added(serviceEntry) + ctx := context.Background() + + serviceEntryController.Added(ctx, serviceEntry) - if !cmp.Equal(serviceEntry.Spec, handler.Obj.Spec) { + if !cmp.Equal(&serviceEntry.Spec, &handler.Obj.Spec, protocmp.Transform()) { t.Errorf("Handler should have the added obj") } updatedServiceEntry := &v1alpha32.ServiceEntry{Spec: v1alpha3.ServiceEntry{Hosts: []string{"hello.global"}}, ObjectMeta: v1.ObjectMeta{Name: "se1", Namespace: "namespace1"}} - serviceEntryController.Updated(updatedServiceEntry, serviceEntry) + serviceEntryController.Updated(ctx, updatedServiceEntry, serviceEntry) - if !cmp.Equal(updatedServiceEntry.Spec, handler.Obj.Spec) { + if !cmp.Equal(&updatedServiceEntry.Spec, &handler.Obj.Spec, protocmp.Transform()) { t.Errorf("Handler should have the updated obj") } - serviceEntryController.Deleted(serviceEntry) + serviceEntryController.Deleted(ctx, serviceEntry) if handler.Obj != nil { t.Errorf("Handler should have no obj") diff --git a/admiral/pkg/controller/istio/sidecar.go b/admiral/pkg/controller/istio/sidecar.go index 86068f04..9a59a112 100644 --- a/admiral/pkg/controller/istio/sidecar.go +++ b/admiral/pkg/controller/istio/sidecar.go @@ -1,6 +1,7 @@ package istio import ( + "context" "fmt" "time" @@ -13,11 +14,11 @@ import ( "k8s.io/client-go/tools/cache" ) -// Handler interface contains the methods that are required +// SidecarHandler interface contains the methods that are required type SidecarHandler interface { - Added(obj *networking.Sidecar) - Updated(obj *networking.Sidecar) - Deleted(obj *networking.Sidecar) + Added(ctx context.Context, obj *networking.Sidecar) + Updated(ctx context.Context, obj *networking.Sidecar) + Deleted(ctx context.Context, obj *networking.Sidecar) } type SidecarEntry struct { @@ -53,18 +54,18 @@ func NewSidecarController(clusterID string, stopCh <-chan struct{}, handler Side return &sidecarController, nil } -func (sec *SidecarController) Added(ojb interface{}) { +func (sec *SidecarController) Added(ctx context.Context, ojb interface{}) { sidecar := ojb.(*networking.Sidecar) - sec.SidecarHandler.Added(sidecar) + sec.SidecarHandler.Added(ctx, sidecar) } -func (sec *SidecarController) Updated(ojb interface{}, oldObj interface{}) { +func (sec *SidecarController) Updated(ctx context.Context, ojb interface{}, oldObj interface{}) { sidecar := ojb.(*networking.Sidecar) - sec.SidecarHandler.Updated(sidecar) + sec.SidecarHandler.Updated(ctx, sidecar) } -func (sec *SidecarController) Deleted(ojb interface{}) { +func (sec *SidecarController) Deleted(ctx context.Context, ojb interface{}) { sidecar := ojb.(*networking.Sidecar) - sec.SidecarHandler.Deleted(sidecar) + sec.SidecarHandler.Deleted(ctx, sidecar) } diff --git a/admiral/pkg/controller/istio/sidecar_test.go b/admiral/pkg/controller/istio/sidecar_test.go index 09bb0509..9b2a95a3 100644 --- a/admiral/pkg/controller/istio/sidecar_test.go +++ b/admiral/pkg/controller/istio/sidecar_test.go @@ -1,14 +1,17 @@ package istio import ( + "context" + "testing" + "time" + "github.com/google/go-cmp/cmp" "github.com/istio-ecosystem/admiral/admiral/pkg/test" + "google.golang.org/protobuf/testing/protocmp" v1alpha32 "istio.io/api/networking/v1alpha3" "istio.io/client-go/pkg/apis/networking/v1alpha3" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/tools/clientcmd" - "testing" - "time" ) func TestNewSidecarController(t *testing.T) { @@ -31,20 +34,22 @@ func TestNewSidecarController(t *testing.T) { sc := &v1alpha3.Sidecar{Spec: v1alpha32.Sidecar{}, ObjectMeta: v1.ObjectMeta{Name: "sc1", Namespace: "namespace1"}} - sidecarController.Added(sc) + ctx := context.Background() + + sidecarController.Added(ctx, sc) - if !cmp.Equal(sc.Spec, handler.Obj.Spec) { + if !cmp.Equal(&sc.Spec, &handler.Obj.Spec, protocmp.Transform()) { t.Errorf("Handler should have the added obj") } updatedSc := &v1alpha3.Sidecar{Spec: v1alpha32.Sidecar{WorkloadSelector: &v1alpha32.WorkloadSelector{Labels: map[string]string{"this": "that"}}}, ObjectMeta: v1.ObjectMeta{Name: "sc1", Namespace: "namespace1"}} - sidecarController.Updated(updatedSc, sc) + sidecarController.Updated(ctx, updatedSc, sc) - if !cmp.Equal(updatedSc.Spec, handler.Obj.Spec) { + if !cmp.Equal(&updatedSc.Spec, &handler.Obj.Spec, protocmp.Transform()) { t.Errorf("Handler should have the updated obj") } - sidecarController.Deleted(sc) + sidecarController.Deleted(ctx, sc) if handler.Obj != nil { t.Errorf("Handler should have no obj") diff --git a/admiral/pkg/controller/istio/virtualservice.go b/admiral/pkg/controller/istio/virtualservice.go index 2e0fa2b8..6914f049 100644 --- a/admiral/pkg/controller/istio/virtualservice.go +++ b/admiral/pkg/controller/istio/virtualservice.go @@ -1,6 +1,7 @@ package istio import ( + "context" "fmt" "time" @@ -13,11 +14,11 @@ import ( "k8s.io/client-go/tools/cache" ) -// Handler interface contains the methods that are required +// VirtualServiceHandler interface contains the methods that are required type VirtualServiceHandler interface { - Added(obj *networking.VirtualService) - Updated(obj *networking.VirtualService) - Deleted(obj *networking.VirtualService) + Added(ctx context.Context, obj *networking.VirtualService) + Updated(ctx context.Context, obj *networking.VirtualService) + Deleted(ctx context.Context, obj *networking.VirtualService) } type VirtualServiceController struct { @@ -48,18 +49,18 @@ func NewVirtualServiceController(clusterID string, stopCh <-chan struct{}, handl return &drController, nil } -func (sec *VirtualServiceController) Added(ojb interface{}) { +func (sec *VirtualServiceController) Added(ctx context.Context, ojb interface{}) { dr := ojb.(*networking.VirtualService) - sec.VirtualServiceHandler.Added(dr) + sec.VirtualServiceHandler.Added(ctx, dr) } -func (sec *VirtualServiceController) Updated(ojb interface{}, oldObj interface{}) { +func (sec *VirtualServiceController) Updated(ctx context.Context, ojb interface{}, oldObj interface{}) { dr := ojb.(*networking.VirtualService) - sec.VirtualServiceHandler.Updated(dr) + sec.VirtualServiceHandler.Updated(ctx, dr) } -func (sec *VirtualServiceController) Deleted(ojb interface{}) { +func (sec *VirtualServiceController) Deleted(ctx context.Context, ojb interface{}) { dr := ojb.(*networking.VirtualService) - sec.VirtualServiceHandler.Deleted(dr) + sec.VirtualServiceHandler.Deleted(ctx, dr) } diff --git a/admiral/pkg/controller/istio/virtualservice_test.go b/admiral/pkg/controller/istio/virtualservice_test.go index 868e0af1..b905cafa 100644 --- a/admiral/pkg/controller/istio/virtualservice_test.go +++ b/admiral/pkg/controller/istio/virtualservice_test.go @@ -1,14 +1,17 @@ package istio import ( + "context" + "testing" + "time" + "github.com/google/go-cmp/cmp" "github.com/istio-ecosystem/admiral/admiral/pkg/test" + "google.golang.org/protobuf/testing/protocmp" v1alpha32 "istio.io/api/networking/v1alpha3" "istio.io/client-go/pkg/apis/networking/v1alpha3" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/tools/clientcmd" - "testing" - "time" ) func TestNewVirtualServiceController(t *testing.T) { @@ -31,21 +34,23 @@ func TestNewVirtualServiceController(t *testing.T) { vs := &v1alpha3.VirtualService{Spec: v1alpha32.VirtualService{}, ObjectMeta: v1.ObjectMeta{Name: "vs1", Namespace: "namespace1"}} - virtualServiceController.Added(vs) + ctx := context.Background() + + virtualServiceController.Added(ctx, vs) - if !cmp.Equal(vs.Spec, handler.Obj.Spec) { + if !cmp.Equal(&vs.Spec, &handler.Obj.Spec, protocmp.Transform()) { t.Errorf("Handler should have the added obj") } updatedVs := &v1alpha3.VirtualService{Spec: v1alpha32.VirtualService{Hosts: []string{"hello.global"}}, ObjectMeta: v1.ObjectMeta{Name: "vs1", Namespace: "namespace1"}} - virtualServiceController.Updated(updatedVs, vs) + virtualServiceController.Updated(ctx, updatedVs, vs) - if !cmp.Equal(updatedVs.Spec, handler.Obj.Spec) { + if !cmp.Equal(&updatedVs.Spec, &handler.Obj.Spec, protocmp.Transform()) { t.Errorf("Handler should have the updated obj") } - virtualServiceController.Deleted(vs) + virtualServiceController.Deleted(ctx, vs) if handler.Obj != nil { t.Errorf("Handler should have no obj") diff --git a/admiral/pkg/controller/secret/secretcontroller.go b/admiral/pkg/controller/secret/secretcontroller.go index af97d794..5e8d1674 100644 --- a/admiral/pkg/controller/secret/secretcontroller.go +++ b/admiral/pkg/controller/secret/secretcontroller.go @@ -18,11 +18,12 @@ import ( "context" "errors" "fmt" + "time" + "github.com/istio-ecosystem/admiral/admiral/pkg/controller/common" "github.com/istio-ecosystem/admiral/admiral/pkg/controller/secret/resolver" log "github.com/sirupsen/logrus" "k8s.io/client-go/rest" - "time" corev1 "k8s.io/api/core/v1" meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -95,15 +96,16 @@ func NewController( removeCallback removeSecretCallback, secretResolverType string) *Controller { + ctx := context.Background() secretsInformer := cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(opts meta_v1.ListOptions) (runtime.Object, error) { opts.LabelSelector = filterLabel + "=true" - return kubeclientset.CoreV1().Secrets(namespace).List(opts) + return kubeclientset.CoreV1().Secrets(namespace).List(ctx, opts) }, WatchFunc: func(opts meta_v1.ListOptions) (watch.Interface, error) { opts.LabelSelector = filterLabel + "=true" - return kubeclientset.CoreV1().Secrets(namespace).Watch(opts) + return kubeclientset.CoreV1().Secrets(namespace).Watch(ctx, opts) }, }, &corev1.Secret{}, 0, cache.Indexers{}, @@ -186,12 +188,12 @@ func (c *Controller) Run(stopCh <-chan struct{}) { // StartSecretController creates the secret controller. func StartSecretController( + ctx context.Context, k8s kubernetes.Interface, addCallback addSecretCallback, updateCallback updateSecretCallback, removeCallback removeSecretCallback, namespace string, - ctx context.Context, secretResolverType string) (*Controller, error) { clusterStore := newClustersStore() diff --git a/admiral/pkg/controller/secret/secretcontroller_test.go b/admiral/pkg/controller/secret/secretcontroller_test.go index 577fdfd1..6e02bddf 100644 --- a/admiral/pkg/controller/secret/secretcontroller_test.go +++ b/admiral/pkg/controller/secret/secretcontroller_test.go @@ -17,16 +17,17 @@ package secret import ( "context" "fmt" + "sync" + "testing" + "time" + "github.com/istio-ecosystem/admiral/admiral/pkg/controller/common" "github.com/prometheus/client_golang/prometheus" io_prometheus_client "github.com/prometheus/client_model/go" "k8s.io/client-go/rest" - "sync" - "testing" - "time" . "github.com/onsi/gomega" - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes/fake" clientcmdapi "k8s.io/client-go/tools/clientcmd/api" @@ -114,15 +115,17 @@ func createMultiClusterSecret(k8s *fake.Clientset) error { data["testRemoteCluster"] = []byte("Test") secret.Data = data - _, err := k8s.CoreV1().Secrets(secretNameSpace).Create(&secret) + ctx := context.Background() + _, err := k8s.CoreV1().Secrets(secretNameSpace).Create(ctx, &secret, metav1.CreateOptions{}) return err } func deleteMultiClusterSecret(k8s *fake.Clientset) error { var immediate int64 - return k8s.CoreV1().Secrets(secretNameSpace).Delete( - secretName, &metav1.DeleteOptions{GracePeriodSeconds: &immediate}) + ctx := context.Background() + return k8s.CoreV1().Secrets(secretNameSpace).Delete(ctx, + secretName, metav1.DeleteOptions{GracePeriodSeconds: &immediate}) } func mockLoadKubeConfig(kubeconfig []byte) (*clientcmdapi.Config, error) { @@ -234,9 +237,10 @@ func Test_SecretController(t *testing.T) { // The assertion ShouldNot(BeNil()) make sure that start secret controller return a not nil controller and nil error registry := prometheus.DefaultGatherer g.Expect( - StartSecretController(clientset, addCallback, updateCallback, deleteCallback, secretNameSpace, context.TODO(), "")). + StartSecretController(context.TODO(), clientset, addCallback, updateCallback, deleteCallback, secretNameSpace, "")). ShouldNot(BeNil()) + ctx := context.Background() for i, step := range steps { resetCallbackData() @@ -245,13 +249,13 @@ func Test_SecretController(t *testing.T) { switch { case step.add != nil: - _, err := clientset.CoreV1().Secrets(secretNameSpace).Create(step.add) + _, err := clientset.CoreV1().Secrets(secretNameSpace).Create(ctx, step.add, metav1.CreateOptions{}) g.Expect(err).Should(BeNil()) case step.update != nil: - _, err := clientset.CoreV1().Secrets(secretNameSpace).Update(step.update) + _, err := clientset.CoreV1().Secrets(secretNameSpace).Update(ctx, step.update, metav1.UpdateOptions{}) g.Expect(err).Should(BeNil()) case step.delete != nil: - g.Expect(clientset.CoreV1().Secrets(secretNameSpace).Delete(step.delete.Name, &metav1.DeleteOptions{})). + g.Expect(clientset.CoreV1().Secrets(secretNameSpace).Delete(ctx, step.delete.Name, metav1.DeleteOptions{})). Should(Succeed()) } diff --git a/admiral/pkg/test/mock.go b/admiral/pkg/test/mock.go index 1060ce54..0e5a380a 100644 --- a/admiral/pkg/test/mock.go +++ b/admiral/pkg/test/mock.go @@ -1,8 +1,10 @@ package test import ( + "context" + argo "github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1" - "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/v1" + v1 "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/v1" v1alpha32 "istio.io/client-go/pkg/apis/networking/v1alpha3" k8sAppsV1 "k8s.io/api/apps/v1" k8sCoreV1 "k8s.io/api/core/v1" @@ -28,41 +30,41 @@ func (m *MockIstioConfigStore) Delete(typ, name, namespace string) error { type MockDeploymentHandler struct { } -func (m *MockDeploymentHandler) Added(obj *k8sAppsV1.Deployment) { +func (m *MockDeploymentHandler) Added(ctx context.Context, obj *k8sAppsV1.Deployment) { } -func (m *MockDeploymentHandler) Deleted(obj *k8sAppsV1.Deployment) { +func (m *MockDeploymentHandler) Deleted(ctx context.Context, obj *k8sAppsV1.Deployment) { } type MockRolloutHandler struct { } -func (m *MockRolloutHandler) Added(obj *argo.Rollout) { +func (m *MockRolloutHandler) Added(ctx context.Context, obj *argo.Rollout) { } -func (m *MockRolloutHandler) Deleted(obj *argo.Rollout) { +func (m *MockRolloutHandler) Deleted(ctx context.Context, obj *argo.Rollout) { } -func (m *MockRolloutHandler) Updated(obj *argo.Rollout) { +func (m *MockRolloutHandler) Updated(ctx context.Context, obj *argo.Rollout) { } type MockServiceHandler struct { } -func (m *MockServiceHandler) Added(obj *k8sCoreV1.Service) { +func (m *MockServiceHandler) Added(ctx context.Context, obj *k8sCoreV1.Service) { } -func (m *MockServiceHandler) Updated(obj *k8sCoreV1.Service) { +func (m *MockServiceHandler) Updated(ctx context.Context, obj *k8sCoreV1.Service) { } -func (m *MockServiceHandler) Deleted(obj *k8sCoreV1.Service) { +func (m *MockServiceHandler) Deleted(ctx context.Context, obj *k8sCoreV1.Service) { } @@ -92,15 +94,15 @@ func (m *MockNodeHandler) Deleted(obj *k8sCoreV1.Node) { type MockDependencyHandler struct { } -func (m *MockDependencyHandler) Added(obj *v1.Dependency) { +func (m *MockDependencyHandler) Added(ctx context.Context, obj *v1.Dependency) { } -func (m *MockDependencyHandler) Updated(obj *v1.Dependency) { +func (m *MockDependencyHandler) Updated(ctx context.Context, obj *v1.Dependency) { } -func (m *MockDependencyHandler) Deleted(obj *v1.Dependency) { +func (m *MockDependencyHandler) Deleted(ctx context.Context, obj *v1.Dependency) { } @@ -108,15 +110,15 @@ type MockGlobalTrafficHandler struct { Obj *v1.GlobalTrafficPolicy } -func (m *MockGlobalTrafficHandler) Added(obj *v1.GlobalTrafficPolicy) { +func (m *MockGlobalTrafficHandler) Added(ctx context.Context, obj *v1.GlobalTrafficPolicy) { m.Obj = obj } -func (m *MockGlobalTrafficHandler) Updated(obj *v1.GlobalTrafficPolicy) { +func (m *MockGlobalTrafficHandler) Updated(ctx context.Context, obj *v1.GlobalTrafficPolicy) { m.Obj = obj } -func (m *MockGlobalTrafficHandler) Deleted(obj *v1.GlobalTrafficPolicy) { +func (m *MockGlobalTrafficHandler) Deleted(ctx context.Context, obj *v1.GlobalTrafficPolicy) { m.Obj = nil } @@ -140,15 +142,15 @@ type MockVirtualServiceHandler struct { Obj *v1alpha32.VirtualService } -func (m *MockVirtualServiceHandler) Added(obj *v1alpha32.VirtualService) { +func (m *MockVirtualServiceHandler) Added(ctx context.Context, obj *v1alpha32.VirtualService) { m.Obj = obj } -func (m *MockVirtualServiceHandler) Updated(obj *v1alpha32.VirtualService) { +func (m *MockVirtualServiceHandler) Updated(ctx context.Context, obj *v1alpha32.VirtualService) { m.Obj = obj } -func (m *MockVirtualServiceHandler) Deleted(obj *v1alpha32.VirtualService) { +func (m *MockVirtualServiceHandler) Deleted(ctx context.Context, obj *v1alpha32.VirtualService) { m.Obj = nil } @@ -156,15 +158,15 @@ type MockDestinationRuleHandler struct { Obj *v1alpha32.DestinationRule } -func (m *MockDestinationRuleHandler) Added(obj *v1alpha32.DestinationRule) { +func (m *MockDestinationRuleHandler) Added(ctx context.Context, obj *v1alpha32.DestinationRule) { m.Obj = obj } -func (m *MockDestinationRuleHandler) Updated(obj *v1alpha32.DestinationRule) { +func (m *MockDestinationRuleHandler) Updated(ctx context.Context, obj *v1alpha32.DestinationRule) { m.Obj = obj } -func (m *MockDestinationRuleHandler) Deleted(obj *v1alpha32.DestinationRule) { +func (m *MockDestinationRuleHandler) Deleted(ctx context.Context, obj *v1alpha32.DestinationRule) { m.Obj = nil } @@ -172,15 +174,15 @@ type MockSidecarHandler struct { Obj *v1alpha32.Sidecar } -func (m *MockSidecarHandler) Added(obj *v1alpha32.Sidecar) { +func (m *MockSidecarHandler) Added(ctx context.Context, obj *v1alpha32.Sidecar) { m.Obj = obj } -func (m *MockSidecarHandler) Updated(obj *v1alpha32.Sidecar) { +func (m *MockSidecarHandler) Updated(ctx context.Context, obj *v1alpha32.Sidecar) { m.Obj = obj } -func (m *MockSidecarHandler) Deleted(obj *v1alpha32.Sidecar) { +func (m *MockSidecarHandler) Deleted(ctx context.Context, obj *v1alpha32.Sidecar) { m.Obj = nil } @@ -188,14 +190,14 @@ type MockRoutingPolicyHandler struct { Obj *v1.RoutingPolicy } -func (m *MockRoutingPolicyHandler) Added(obj *v1.RoutingPolicy) { +func (m *MockRoutingPolicyHandler) Added(ctx context.Context, obj *v1.RoutingPolicy) { m.Obj = obj } -func (m *MockRoutingPolicyHandler) Deleted(obj *v1.RoutingPolicy) { +func (m *MockRoutingPolicyHandler) Deleted(ctx context.Context, obj *v1.RoutingPolicy) { m.Obj = nil } -func (m *MockRoutingPolicyHandler) Updated(obj *v1.RoutingPolicy) { +func (m *MockRoutingPolicyHandler) Updated(ctx context.Context, obj *v1.RoutingPolicy) { m.Obj = obj -} \ No newline at end of file +} diff --git a/admiral/pkg/test/resources/admins@fake-cluster.k8s.local b/admiral/pkg/test/resources/admins@fake-cluster.k8s.local index 33cfa93e..974d3717 100644 --- a/admiral/pkg/test/resources/admins@fake-cluster.k8s.local +++ b/admiral/pkg/test/resources/admins@fake-cluster.k8s.local @@ -1,7 +1,7 @@ apiVersion: v1 clusters: - cluster: - certificate-authority-data: TUlJQ1VUQ0NBZnVnQXdJQkFnSUJBREFOQmdrcWhraUc5dzBCQVFRRkFEQlhNUXN3Q1FZRFZRUUdFd0pEVGpFTApNQWtHQTFVRUNCTUNVRTR4Q3pBSkJnTlZCQWNUQWtOT01Rc3dDUVlEVlFRS0V3SlBUakVMTUFrR0ExVUVDeE1DClZVNHhGREFTQmdOVkJBTVRDMGhsY205dVp5QlpZVzVuTUI0WERUQTFNRGN4TlRJeE1UazBOMW9YRFRBMU1EZ3gKTkRJeE1UazBOMW93VnpFTE1Ba0dBMVVFQmhNQ1EwNHhDekFKQmdOVkJBZ1RBbEJPTVFzd0NRWURWUVFIRXdKRApUakVMTUFrR0ExVUVDaE1DVDA0eEN6QUpCZ05WQkFzVEFsVk9NUlF3RWdZRFZRUURFd3RJWlhKdmJtY2dXV0Z1Clp6QmNNQTBHQ1NxR1NJYjNEUUVCQVFVQUEwc0FNRWdDUVFDcDVobkc3b2dCaHRseW5wT1MyMWNCZXdLRS9CN2oKVjE0cWV5c2xucjI2eFpVc1NWa28zNlpuaGlhTy96Yk1Pb1JjS0s5dkVjZ010Y0xGdVFUV0RsM1JBZ01CQUFHagpnYkV3Z2E0d0hRWURWUjBPQkJZRUZGWEk3MGtyWGVRRHhaZ2JhQ1FvUjRqVURuY0VNSDhHQTFVZEl3UjRNSGFBCkZGWEk3MGtyWGVRRHhaZ2JhQ1FvUjRqVURuY0VvVnVrV1RCWE1Rc3dDUVlEVlFRR0V3SkRUakVMTUFrR0ExVUUKQ0JNQ1VFNHhDekFKQmdOVkJBY1RBa05PTVFzd0NRWURWUVFLRXdKUFRqRUxNQWtHQTFVRUN4TUNWVTR4RkRBUwpCZ05WQkFNVEMwaGxjbTl1WnlCWllXNW5nZ0VBTUF3R0ExVWRFd1FGTUFNQkFmOHdEUVlKS29aSWh2Y05BUUVFCkJRQURRUUEvdWd6QnJqaks5amNXbkRWZkdIbGszaWNOUnEwb1Y3UmkzMnovK0hRWDY3YVJmZ1p1N0tXZEkrSnUKV203RENmclBOR1Z3RldVUU9tc1B1ZTlyWkJnTw== + certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tDQpNSUlFN3pDQ0ExZWdBd0lCQWdJUU5MbUh5bU9wUy9Ib3Y2bFdyT3hvU1RBTkJna3Foa2lHOXcwQkFRc0ZBRENCDQpqekVlTUJ3R0ExVUVDaE1WYld0alpYSjBJR1JsZG1Wc2IzQnRaVzUwSUVOQk1USXdNQVlEVlFRTERDbHpjMmhoDQpjbTFoTXpSQWFXNTBkV2wwWkdWd1lqRXlaV0VnS0ZOb2NtbHlZVzBnVTJoaGNtMWhLVEU1TURjR0ExVUVBd3d3DQpiV3RqWlhKMElITnphR0Z5YldFek5FQnBiblIxYVhSa1pYQmlNVEpsWVNBb1UyaHlhWEpoYlNCVGFHRnliV0VwDQpNQjRYRFRJeE1EZ3dNakl5TXpJek9Gb1hEVE14TURnd01qSXlNekl6T0Zvd2dZOHhIakFjQmdOVkJBb1RGVzFyDQpZMlZ5ZENCa1pYWmxiRzl3YldWdWRDQkRRVEV5TURBR0ExVUVDd3dwYzNOb1lYSnRZVE0wUUdsdWRIVnBkR1JsDQpjR0l4TW1WaElDaFRhSEpwY21GdElGTm9ZWEp0WVNreE9UQTNCZ05WQkFNTU1HMXJZMlZ5ZENCemMyaGhjbTFoDQpNelJBYVc1MGRXbDBaR1Z3WWpFeVpXRWdLRk5vY21seVlXMGdVMmhoY20xaEtUQ0NBYUl3RFFZSktvWklodmNODQpBUUVCQlFBRGdnR1BBRENDQVlvQ2dnR0JBTWM1eHBwOCtHSmxCbGVTYTc0L0VnR3J4a3VZd3M0Mmd6UzRWS2xwDQpiVTNRSXpDV2psOVd4L0hhRVVqLzA3R1dtMlhOQWVoSS91b1JIS0x0aERMWWdMelRoazBMTDFqZkZCaDV3bDRtDQplaDlCcE5EUnhXcDNQaWhScW13SGUxNFArbDR1YU1aSHNveG5WSncvQS9La05pZXhMVXZMOVZqUXpacko4Y1luDQovTjZWVjNuc1dGQjF5dVlCdHBJUHo2ODJQS291cHpqcTVRcWdOUmo1dzFHM2p0MUFabjViK004YmNKMlQvUG1hDQp4UkNVa3NxTWpwdjZhVVdpdkd1UW5yL0xaVWpxWWhSU2xLYlNoOGdjRjNmZ3VSOC9ZTjB1OVM0R1lEa2JwMXc5DQpRYitwYk5CeS9pSkdkSzJOS0JsOHRvQmdESWx2OFlmSmdEbDdCbk1uM1J2NG02T0w0VHVVVjIva25JKy9xMkZsDQpTWW8rL0F0QUVtRGV2ZEIxbUV3emRId1AvR0NsT2QrV1hjSEV2TENibC9MZ2FIeC8zZWUyNmEwb1hzVlp4N21PDQpXMGxrMU1JTXVlbTdjMTh6WXdjRDlzUXBVVG4xRTcrTGlzWHpVNC9SdVB6MHFpQUp5RzRVZ3lqY0JzdVZ6UTNqDQo2WUNaWlUxb2ZLVzQ1aWF1QmpaOUNKS2ZVUUlEQVFBQm8wVXdRekFPQmdOVkhROEJBZjhFQkFNQ0FnUXdFZ1lEDQpWUjBUQVFIL0JBZ3dCZ0VCL3dJQkFEQWRCZ05WSFE0RUZnUVVacVdGS1BrY3d4cWFOejUvbDBhZzNYMWpGNzh3DQpEUVlKS29aSWh2Y05BUUVMQlFBRGdnR0JBSlYrRE5DanViZUdqejgyQ1FFMmNSbyszektDSm42T3pTaE85WnVCDQpFM3dxUFBJT1QvOTBtZm40dEJhT0R0NmovNi9mRTZad1YyWU93UVErR3plOGZORzJEMEZYVE16a3l3Q0VwcEkyDQpIWmtIZ0JPOE45VFhja0pIR1crYkFXc0lSRHc2V2pvbThQWTN1RDA1QWEzV2RYd2ROYUE1R2hTQ3ZVVEU0bVVYDQpESjdYVjVLZjlPdEhObllXOFZ3b3B0NlBhM2tpUHdQZE9BU0E1OVUvVVFhWTRwVE5TRnBTY1A1R1VEbnVKUTUwDQpXOEdmem1FNkV4Y0ROOXRMRnVYT0oyelFpTWpKMGVKQUxIckM2UUtrRXk0anpCTFY0RFN0SURBQ2dqbzdtU28zDQphWER0NnozbTVlSUp4TmIrMG51VTRnc1BRbnQwb2sxVW9VNVpES3ZRZ3FKcGZSMU9NYUlEWkVPREJ6dXpZYTE2DQp1V0pOQ3BEaU4rZGtBMXhQQ08wVUk4STRqcDBxek9rMjNzejlEVEwvNldNbldndkZRdWxJcVRWMDNHVE1MRnEyDQpFOXpLb0JqQzdURUJrczVwSlZmMkhwVkdrUitMVzVnZnBVT0ZFanFLYnBhMEorV1hHVVRSU3R1UVBiNjQzRVBTDQpZeEl6TGR4OW04RU1zeHpYTjNQUGpDVTYxdz09DQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tDQo= server: https://localhost:6441 name: apple contexts: diff --git a/admiral/pkg/test/types.go b/admiral/pkg/test/types.go index 035a64d6..d556ceac 100644 --- a/admiral/pkg/test/types.go +++ b/admiral/pkg/test/types.go @@ -1,6 +1,8 @@ package test import ( + "context" + k8sCoreV1 "k8s.io/api/core/v1" ) @@ -10,11 +12,11 @@ type FakeConfigMapController struct { ConfigmapToReturn *k8sCoreV1.ConfigMap } -func (c *FakeConfigMapController) GetConfigMap() (*k8sCoreV1.ConfigMap, error) { +func (c *FakeConfigMapController) GetConfigMap(ctx context.Context) (*k8sCoreV1.ConfigMap, error) { return c.ConfigmapToReturn, c.GetError } -func (c *FakeConfigMapController) PutConfigMap(newMap *k8sCoreV1.ConfigMap) error { +func (c *FakeConfigMapController) PutConfigMap(ctx context.Context, newMap *k8sCoreV1.ConfigMap) error { return c.PutError } func (c *FakeConfigMapController)GetIPPrefixForServiceEntries() (seIpPrefix string) { diff --git a/go.mod b/go.mod index 12646439..0543e668 100644 --- a/go.mod +++ b/go.mod @@ -1,90 +1,111 @@ module github.com/istio-ecosystem/admiral -go 1.12 +go 1.18 require ( - github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d // indirect - github.com/argoproj/argo-rollouts v0.8.3 + github.com/argoproj/argo-rollouts v1.2.1 github.com/cenkalti/backoff v2.2.1+incompatible - github.com/emicklei/go-restful v2.11.2+incompatible // indirect - github.com/go-openapi/spec v0.19.6 // indirect - github.com/go-openapi/swag v0.19.7 // indirect - github.com/gogo/protobuf v1.3.1 - github.com/golang/groupcache v0.0.0-20191002201903-404acd9df4cc // indirect - github.com/golang/protobuf v1.3.2 - github.com/google/go-cmp v0.4.0 + github.com/go-openapi/swag v0.19.15 // indirect + github.com/golang/protobuf v1.5.2 + github.com/google/go-cmp v0.5.6 github.com/gorilla/mux v1.8.0 - github.com/imdario/mergo v0.3.8 // indirect - github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect - github.com/mailru/easyjson v0.7.1 // indirect - github.com/onsi/ginkgo v1.10.2 // indirect - github.com/onsi/gomega v1.7.0 - github.com/prometheus/client_golang v1.5.0 + github.com/imdario/mergo v0.3.12 // indirect + github.com/mailru/easyjson v0.7.6 // indirect + github.com/onsi/gomega v1.19.0 + github.com/prometheus/client_golang v1.12.2 github.com/prometheus/client_model v0.2.0 - github.com/prometheus/common v0.9.1 - github.com/sirupsen/logrus v1.4.2 - github.com/spf13/cobra v0.0.5 + github.com/sirupsen/logrus v1.8.1 + github.com/spf13/cobra v1.5.0 github.com/stretchr/testify v1.7.0 - golang.org/x/crypto v0.0.0-20191108234033-bd318be0434a // indirect - golang.org/x/net v0.0.0-20200301022130-244492dfa37a // indirect - golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect - google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a // indirect - google.golang.org/grpc v1.25.1 // indirect - gopkg.in/yaml.v2 v2.2.8 - istio.io/api v0.0.0-20200226024546-cca495b82b03 - istio.io/client-go v0.0.0-20200226182959-cde3e69bd9dd - istio.io/gogo-genproto v0.0.0-20191024203824-d079cc8b1d55 // indirect - k8s.io/api v0.17.3 - k8s.io/apimachinery v0.17.3 - k8s.io/client-go v0.17.3 - k8s.io/kube-openapi v0.0.0-20200204173128-addea2498afe // indirect + golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect + golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect + google.golang.org/genproto v0.0.0-20220531134929-86cf59382f1b // indirect + gopkg.in/yaml.v2 v2.4.0 + istio.io/api v0.0.0-20220621155648-3e39d064ab6b + istio.io/client-go v1.14.0 + k8s.io/api v0.24.2 + k8s.io/apimachinery v0.24.2 + k8s.io/client-go v0.24.2 sigs.k8s.io/yaml v1.2.0 // indirect ) -replace k8s.io/api => k8s.io/api v0.17.3 - -replace k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.17.3 - -replace k8s.io/apimachinery => k8s.io/apimachinery v0.17.5-beta.0 - -replace k8s.io/apiserver => k8s.io/apiserver v0.17.3 - -replace k8s.io/cli-runtime => k8s.io/cli-runtime v0.17.3 - -replace k8s.io/client-go => k8s.io/client-go v0.17.3 - -replace k8s.io/cloud-provider => k8s.io/cloud-provider v0.17.3 - -replace k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.17.3 - -replace k8s.io/code-generator => k8s.io/code-generator v0.17.5-beta.0 - -replace k8s.io/component-base => k8s.io/component-base v0.17.3 - -replace k8s.io/cri-api => k8s.io/cri-api v0.17.18-rc.0 - -replace k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.17.3 - -replace k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.17.3 - -replace k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.17.3 - -replace k8s.io/kube-proxy => k8s.io/kube-proxy v0.17.3 - -replace k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.17.3 - -replace k8s.io/kubectl => k8s.io/kubectl v0.17.3 - -replace k8s.io/kubelet => k8s.io/kubelet v0.17.3 - -replace k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.17.3 - -replace k8s.io/metrics => k8s.io/metrics v0.17.3 - -replace k8s.io/node-api => k8s.io/node-api v0.17.3 - -replace k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.17.3 +require ( + github.com/prometheus/common v0.32.1 + google.golang.org/protobuf v1.28.1 +) -replace k8s.io/sample-cli-plugin => k8s.io/sample-cli-plugin v0.17.3 +require ( + github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect + github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d // indirect + github.com/beorn7/perks v1.0.1 // indirect + github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/emicklei/go-restful/v3 v3.8.0 // indirect + github.com/evanphx/json-patch v4.12.0+incompatible // indirect + github.com/fsnotify/fsnotify v1.5.1 // indirect + github.com/go-logr/logr v1.2.0 // indirect + github.com/go-openapi/jsonpointer v0.19.5 // indirect + github.com/go-openapi/jsonreference v0.20.0 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/google/gnostic v0.5.7-v3refs // indirect + github.com/google/gofuzz v1.1.0 // indirect + github.com/google/uuid v1.1.2 // indirect + github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/josharian/intern v1.0.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/onsi/ginkgo v1.16.5 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/prometheus/procfs v0.7.3 // indirect + github.com/spf13/pflag v1.0.5 // indirect + golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect + golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect + golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect + golang.org/x/text v0.3.7 // indirect + golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect + google.golang.org/appengine v1.6.7 // indirect + gopkg.in/alecthomas/kingpin.v2 v2.2.6 // indirect + gopkg.in/inf.v0 v0.9.1 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + k8s.io/klog/v2 v2.60.1 // indirect + k8s.io/kube-openapi v0.0.0-20220621154418-c39d0f63fac8 // indirect + k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 // indirect + sigs.k8s.io/json v0.0.0-20220525155127-227cbc7cc124 // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect +) -replace k8s.io/sample-controller => k8s.io/sample-controller v0.17.3 +replace ( + github.com/fsnotify/fsnotify => github.com/fsnotify/fsnotify v1.5.1 + github.com/go-check/check => github.com/go-check/check v0.0.0-20180628173108-788fd7840127 + github.com/prometheus/common => github.com/prometheus/common v0.26.0 + k8s.io/api => k8s.io/api v0.24.2 + k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.24.2 + k8s.io/apimachinery => k8s.io/apimachinery v0.24.2 + k8s.io/apiserver => k8s.io/apiserver v0.24.2 + k8s.io/cli-runtime => k8s.io/cli-runtime v0.24.2 + k8s.io/client-go => k8s.io/client-go v0.24.2 + k8s.io/cloud-provider => k8s.io/cloud-provider v0.24.2 + k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.24.2 + k8s.io/code-generator => k8s.io/code-generator v0.24.2 + k8s.io/component-base => k8s.io/component-base v0.24.2 + k8s.io/component-helpers => k8s.io/component-helpers v0.24.2 + k8s.io/controller-manager => k8s.io/controller-manager v0.24.2 + k8s.io/cri-api => k8s.io/cri-api v0.24.2 + k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.24.2 + k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.24.2 + k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.24.2 + k8s.io/kube-proxy => k8s.io/kube-proxy v0.24.2 + k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.24.2 + k8s.io/kubectl => k8s.io/kubectl v0.24.2 + k8s.io/kubelet => k8s.io/kubelet v0.24.2 + k8s.io/kubernetes => k8s.io/kubernetes v1.23.1 + k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.24.2 + k8s.io/metrics => k8s.io/metrics v0.24.2 + k8s.io/mount-utils => k8s.io/mount-utils v0.24.2 + k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.24.2 + k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.24.2 +) diff --git a/go.sum b/go.sum index 34b2687e..581873f2 100644 --- a/go.sum +++ b/go.sum @@ -1,839 +1,730 @@ -bitbucket.org/bertimus9/systemstat v0.0.0-20180207000608-0eeff89b0690/go.mod h1:Ulb78X89vxKYgdL24HMTiXYHlyHEvruOj1ZPlqeNEZM= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -github.com/Azure/azure-sdk-for-go v35.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= -github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI= -github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0= -github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA= -github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= -github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= -github.com/Azure/go-autorest/autorest/to v0.2.0/go.mod h1:GunWKJp1AEqgMaGLV+iocmRAJWqST1wQYhyyjXJ3SJc= -github.com/Azure/go-autorest/autorest/validation v0.1.0/go.mod h1:Ha3z/SqBeaalWQvokg3NZAlQTalVMtOIAs1aGK7G6u8= -github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc= -github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= +cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= +cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= +cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= +cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= +github.com/Azure/go-autorest/autorest v0.11.18/go.mod h1:dSiJPy22c3u0OtOKDNttNgqpNFY/GeWa7GH/Pz56QRA= +github.com/Azure/go-autorest/autorest/adal v0.9.13/go.mod h1:W/MM4U6nLxnIskrw4UwWzlHfGjwUS50aOsc/I3yuU8M= +github.com/Azure/go-autorest/autorest/date v0.3.0/go.mod h1:BI0uouVdmngYNUzGWeSYnokU+TrmwEsOqdt8Y6sso74= +github.com/Azure/go-autorest/autorest/mocks v0.4.1/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k= +github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= +github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= 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/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= -github.com/GoogleCloudPlatform/k8s-cloud-provider v0.0.0-20190822182118-27a4ced34534/go.mod h1:iroGtC8B3tQiqtds1l+mgk/BBOrxbqjH+eUfFQYRc14= -github.com/JeffAshton/win_pdh v0.0.0-20161109143554-76bb4ee9f0ab/go.mod h1:3VYc5hodBMJ5+l/7J4xAyMeuM2PNuepvHlGs8yilUCA= -github.com/MakeNowJust/heredoc v0.0.0-20170808103936-bb23615498cd/go.mod h1:64YHyfSL2R96J44Nlwm39UHepQbyR5q10x7iYa1ks2E= -github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA= -github.com/Microsoft/hcsshim v0.0.0-20190417211021-672e52e9209d/go.mod h1:Op3hHsoHPAvb6lceZHDtd9OkTew38wNoXnJs8iY7rUg= github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= -github.com/OpenPeeDeeP/depguard v1.0.0/go.mod h1:7/4sitnI9YlQgTLLk734QlzXT8DuHVnAyztLplQjk+o= -github.com/OpenPeeDeeP/depguard v1.0.1/go.mod h1:xsIw86fROiiwelg+jB2uM9PiKihMMmUx/1V+TNhjQvM= -github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= -github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= -github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI= github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= -github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= -github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= -github.com/Rican7/retry v0.1.0/go.mod h1:FgOROf8P5bebcC1DS0PdOQiqGUridaZvikzUmkFW6gg= -github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM= 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= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d h1:UQZhZ2O0vMHr2cI+DC1Mbh0TJxzA3RcLoMsFw+aXw7E= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= -github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= -github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= -github.com/antlr/antlr4 v0.0.0-20191011202612-ad2bd05285ca/go.mod h1:T7PbCXFs94rrTttyxjbyT5+/1V8T2TYDejxUfHJjw1Y= -github.com/antonmedv/expr v1.4.2/go.mod h1:xesgliOuukGf21740qhh8PvFdN66yZ9lJJ/PzSFAmzI= -github.com/argoproj/argo-rollouts v0.8.3 h1:tjudGKI0+igRLtuQ6QWuYnldY1ylxtA1A5bBL/9R17A= -github.com/argoproj/argo-rollouts v0.8.3/go.mod h1:+RujwsBG/yTbpW8PdduyS3QxpmeEbePcUeFUoTuY+c4= -github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/argoproj/argo-rollouts v1.2.1 h1:4hSgKEqpQsZreZBv+XcLsB+oBaRGMVW19nMScx5ikIQ= +github.com/argoproj/argo-rollouts v1.2.1/go.mod h1:ETmWr9Lysxr9SgbqalMMBdytBcDHUt9qulFoKJ9b9ZU= +github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= -github.com/auth0/go-jwt-middleware v0.0.0-20170425171159-5493cabe49f7/go.mod h1:LWMyo4iOLWXHGdBki7NIht1kHru/0wM179h+d3g8ATM= -github.com/aws/aws-sdk-go v1.16.26/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/bazelbuild/bazel-gazelle v0.18.2/go.mod h1:D0ehMSbS+vesFsLGiD6JXu3mVEzOlfUl8wNnq+x/9p0= -github.com/bazelbuild/bazel-gazelle v0.19.1-0.20191105222053-70208cbdc798/go.mod h1:rPwzNHUqEzngx1iVBfO/2X2npKaT3tqPqqHW6rVsn/A= -github.com/bazelbuild/buildtools v0.0.0-20190731111112-f720930ceb60/go.mod h1:5JP0TXzWDHXv8qvxRC4InIazwdyDseBDbzESUMKk1yU= -github.com/bazelbuild/buildtools v0.0.0-20190917191645-69366ca98f89/go.mod h1:5JP0TXzWDHXv8qvxRC4InIazwdyDseBDbzESUMKk1yU= -github.com/bazelbuild/rules_go v0.0.0-20190719190356-6dae44dc5cab/go.mod h1:MC23Dc/wkXEyk3Wpq6lCqz0ZAYOZDw2DR5y3N1q2i7M= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bifurcation/mint v0.0.0-20180715133206-93c51c6ce115/go.mod h1:zVt7zX3K/aDCk9Tj+VM7YymsX66ERvzCJzw8rFCX2JU= -github.com/blang/semver v3.5.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= -github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= -github.com/bouk/monkey v1.0.0/go.mod h1:PG/63f4XEUlVyW1ttIeOJmJhhe1+t9EC/je3eTjvFhE= -github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= -github.com/caddyserver/caddy v1.0.3/go.mod h1:G+ouvOY32gENkJC+jhgl62TyhvqEsFaDiZ4uw0RzP1E= -github.com/cenkalti/backoff v2.1.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/prettybench v0.0.0-20150116022406-03b8cfe5406c/go.mod h1:Xe6ZsFhtM8HrDku0pxJ3/Lr51rwykrzgFwpmTzleatY= -github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/chai2010/gettext-go v0.0.0-20160711120539-c6fed771bfd5/go.mod h1:/iP1qXHoty45bqomnu2LM+VVyAEdWN+vtSHGlQgyxbw= -github.com/checkpoint-restore/go-criu v0.0.0-20190109184317-bdb7599cd87b/go.mod h1:TrMrLQfeENAPYPRsJuq3jsqdlRh3lvi6trTZJG8+tho= -github.com/cheekybits/genny v0.0.0-20170328200008-9127e812e1e9/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ= +github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= +github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/clusterhq/flocker-go v0.0.0-20160920122132-2b8b7259d313/go.mod h1:P1wt9Z3DP8O6W3rvwCt0REIlshg1InHImaLW0t3ObY0= -github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= -github.com/codegangsta/negroni v1.0.0/go.mod h1:v0y3T5G7Y1UlFfyxFn/QLRU4a2EuNau2iZY63YTKWo0= -github.com/container-storage-interface/spec v1.2.0/go.mod h1:6URME8mwIBbpVyZV93Ce5St17xBiQJQY67NDsuohiy4= -github.com/containerd/console v0.0.0-20170925154832-84eeaae905fa/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw= -github.com/containerd/containerd v1.0.2/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= -github.com/containerd/typeurl v0.0.0-20190228175220-2a93cfde8c20/go.mod h1:Cm3kwCdlkCfMSHURc+r6fwoGH6/F1hH3S4sg0rLFWPc= -github.com/containernetworking/cni v0.7.1/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY= -github.com/coredns/corefile-migration v1.0.4/go.mod h1:OFwBp/Wc9dJt5cAZzHWMNhK1r5L0p0jDwIBc6j8NC8E= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= -github.com/coreos/go-oidc v2.1.0+incompatible/go.mod h1:CgnwVTmzoESiwO9qyAFEMiHoZ1nMCKZlZ9V6mm3/LKc= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/coreos/pkg v0.0.0-20180108230652-97fdf19511ea/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= -github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= -github.com/cyphar/filepath-securejoin v0.2.2/go.mod h1:FpkQEhXnPnOthhzymB7CGsFk2G9VLXONKD9G7QGMM+4= -github.com/davecgh/go-spew v0.0.0-20151105211317-5215b55f46b2/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/daviddengcn/go-colortext v0.0.0-20160507010035-511bcaf42ccd/go.mod h1:dv4zxwHi5C/8AeI+4gX4dCWOIvNi7I6JCSX0HvlKPgE= -github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= -github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v0.7.3-0.20190327010347-be7ac8be2ae0/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/docker v1.4.2-0.20190327010347-be7ac8be2ae0/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/go-connections v0.3.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= -github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/docker/libnetwork v0.8.0-dev.2.0.20190624125649-f0e46a78ea34/go.mod h1:93m0aTqz6z+g32wla4l4WxTrdtvBRmVzYRkYvasA5Z8= -github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= -github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= -github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/elazarl/goproxy v0.0.0-20170405201442-c4fc26588b6e/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= +github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= github.com/emicklei/go-restful v2.9.5+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= -github.com/emicklei/go-restful v2.11.2+incompatible h1:Z4Z0K2AuOw+QtgwkkJnwpT165MBr12qS8rnBwjP/Pzs= -github.com/emicklei/go-restful v2.11.2+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= +github.com/emicklei/go-restful/v3 v3.8.0 h1:eCZ8ulSerjdAiaNpF7GxXIE7ZCMo1moN1qX+S609eVw= +github.com/emicklei/go-restful/v3 v3.8.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/euank/go-kmsg-parser v2.0.0+incompatible/go.mod h1:MhmAMZ8V4CYH4ybgdRwPr2TU5ThnS43puaKEMpja1uw= -github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= -github.com/evanphx/json-patch v4.5.0+incompatible h1:ouOWdg56aJriqS0huScTkVXPC5IcNrDCXZ6OoTAWu7M= -github.com/evanphx/json-patch v4.5.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= -github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d/go.mod h1:ZZMPRZwes7CROmyNKgQzC3XPs6L/G2EJLHddWejkmf4= -github.com/fatih/camelcase v1.0.0/go.mod h1:yN2Sb0lFhZJUdVvtELVWefmrXpuZESvPmqwoZc+/fpc= -github.com/fatih/color v1.6.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= -github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg= -github.com/gdamore/tcell v1.1.2/go.mod h1:h3kq4HO9l2On+V9ed8w8ewqQEmGCSSHOgQ+2h8uzurE= -github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/evanphx/json-patch v4.12.0+incompatible h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84= +github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= +github.com/form3tech-oss/jwt-go v3.2.3+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= +github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI= +github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= +github.com/getkin/kin-openapi v0.76.0/go.mod h1:660oXbgy5JFMKreazJaQTw7o+X00qeSyhcnluiMv+Xg= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32/go.mod h1:GIjDIg/heH5DOkXY3YJ/wNhfHsQHoXGjl8G8amsYQ1I= -github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= -github.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= -github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= -github.com/go-acme/lego v2.5.0+incompatible/go.mod h1:yzMNe9CasVUhkquNvti5nAtPmG94USbYxYrZfTkIn0M= -github.com/go-bindata/go-bindata v3.1.1+incompatible/go.mod h1:xK8Dsgwmeed+BBsSy2XTopBn/8uK2HWuGSnA11C3Joo= -github.com/go-critic/go-critic v0.3.5-0.20190526074819-1df300866540/go.mod h1:+sE8vrLDS2M0pZkBk0wy6+nLdKexVDrl/jBqQOTDThA= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-lintpack/lintpack v0.5.2/go.mod h1:NwZuYi2nUHho8XEIZ6SIxihrnPoqBTDqfpXvXAN0sXM= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= -github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= -github.com/go-openapi/analysis v0.0.0-20180825180245-b006789cd277/go.mod h1:k70tL6pCuVxPJOHXQ+wIac1FUrvNkHolPie/cLEU6hI= -github.com/go-openapi/analysis v0.17.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= -github.com/go-openapi/analysis v0.18.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= -github.com/go-openapi/analysis v0.19.2/go.mod h1:3P1osvZa9jKjb8ed2TPng3f0i/UY9snX6gxi44djMjk= -github.com/go-openapi/analysis v0.19.5/go.mod h1:hkEAkxagaIvIP7VTn8ygJNkd4kAYON2rCu0v0ObL0AU= -github.com/go-openapi/errors v0.17.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= -github.com/go-openapi/errors v0.18.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= -github.com/go-openapi/errors v0.19.2/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA4kxxpKBC94= -github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0= -github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= -github.com/go-openapi/jsonpointer v0.18.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= -github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= -github.com/go-openapi/jsonpointer v0.19.3 h1:gihV7YNZK1iK6Tgwwsxo2rJbD1GTbdm72325Bq8FI3w= +github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= +github.com/go-logr/logr v1.2.0 h1:QK40JKJyMdUDz+h+xvCsru/bJhvG0UxvePV0ufL/AcE= +github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9/go.mod h1:W3Z9FmVs9qj+KR4zFKmDPGiLdk1D9Rlm7cyMvf57TTg= -github.com/go-openapi/jsonreference v0.17.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= -github.com/go-openapi/jsonreference v0.18.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= -github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc= -github.com/go-openapi/jsonreference v0.19.3 h1:5cxNfTy0UVC3X8JL5ymxzyoUZmo8iZb+jeTWn7tUa8o= +github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= +github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8= -github.com/go-openapi/loads v0.17.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= -github.com/go-openapi/loads v0.18.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= -github.com/go-openapi/loads v0.19.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= -github.com/go-openapi/loads v0.19.2/go.mod h1:QAskZPMX5V0C2gvfkGZzJlINuP7Hx/4+ix5jWFxsNPs= -github.com/go-openapi/loads v0.19.4/go.mod h1:zZVHonKd8DXyxyw4yfnVjPzBjIQcLt0CCsn0N0ZrQsk= -github.com/go-openapi/runtime v0.0.0-20180920151709-4f900dc2ade9/go.mod h1:6v9a6LTXWQCdL8k1AO3cvqx5OtZY/Y9wKTgaoP6YRfA= -github.com/go-openapi/runtime v0.19.0/go.mod h1:OwNfisksmmaZse4+gpV3Ne9AyMOlP1lt4sK4FXt0O64= -github.com/go-openapi/runtime v0.19.4/go.mod h1:X277bwSUBxVlCYR3r7xgZZGKVvBd/29gLDlFGtJ8NL4= -github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501/go.mod h1:J8+jY1nAiCcj+friV/PDoE1/3eeccG9LYBs0tYvLOWc= -github.com/go-openapi/spec v0.17.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= -github.com/go-openapi/spec v0.18.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= -github.com/go-openapi/spec v0.19.2/go.mod h1:sCxk3jxKgioEJikev4fgkNmwS+3kuYdJtcsZsD5zxMY= -github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo= -github.com/go-openapi/spec v0.19.6 h1:rMMMj8cV38KVXK7SFc+I2MWClbEfbK705+j+dyqun5g= -github.com/go-openapi/spec v0.19.6/go.mod h1:Hm2Jr4jv8G1ciIAo+frC/Ft+rR2kQDh8JHKHb3gWUSk= -github.com/go-openapi/strfmt v0.17.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU= -github.com/go-openapi/strfmt v0.18.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU= -github.com/go-openapi/strfmt v0.19.0/go.mod h1:+uW+93UVvGGq2qGaZxdDeJqSAqBqBdl+ZPMF/cC8nDY= -github.com/go-openapi/strfmt v0.19.3/go.mod h1:0yX7dbo8mKIvc3XSKp7MNfxw4JytCfCD6+bY1AVL9LU= -github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dpr1UfpPtxFw+EFuQ41HhCWZfha5jSVRG7C7I= -github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= -github.com/go-openapi/swag v0.18.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= -github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/jsonreference v0.19.5/go.mod h1:RdybgQwPxbL4UEjuAruzK1x3nE69AqPYEJeo/TWfEeg= +github.com/go-openapi/jsonreference v0.20.0 h1:MYlu0sBgChmCfJxxUKZ8g1cPWFOB37YSZqewK7OKeyA= +github.com/go-openapi/jsonreference v0.20.0/go.mod h1:Ag74Ico3lPc+zR+qjn4XBUmXymS4zJbYVCZmcgkasdo= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= -github.com/go-openapi/swag v0.19.7 h1:VRuXN2EnMSsZdauzdss6JBC29YotDqG59BZ+tdlIL1s= -github.com/go-openapi/swag v0.19.7/go.mod h1:ao+8BpOPyKdpQz3AOJfbeEVpLmWAvlT1IfTe5McPyhY= -github.com/go-openapi/validate v0.18.0/go.mod h1:Uh4HdOzKt19xGIGm1qHf/ofbX1YQ4Y+MYsct2VUrAJ4= -github.com/go-openapi/validate v0.19.2/go.mod h1:1tRCw7m3jtI8eNWEEliiAqUIcBztB2KDnRCRMUi7GTA= -github.com/go-openapi/validate v0.19.5/go.mod h1:8DJv2CVJQ6kGNpFW6eV9N3JviE1C85nY1c2z52x1Gk4= -github.com/go-ozzo/ozzo-validation v3.5.0+incompatible/go.mod h1:gsEKFIVnabGBt6mXmxK0MoFy+cZoTJY6mu5Ll3LVLBU= +github.com/go-openapi/swag v0.19.14/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= +github.com/go-openapi/swag v0.19.15 h1:D2NRCBzS9/pEY3gP9Nl8aDqGUcPFrwG2p+CNFrLyrCM= +github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-toolsmith/astcast v1.0.0/go.mod h1:mt2OdQTeAQcY4DQgPSArJjHCcOwlX+Wl/kwN+LbLGQ4= -github.com/go-toolsmith/astcopy v1.0.0/go.mod h1:vrgyG+5Bxrnz4MZWPF+pI4R8h3qKRjjyvV/DSez4WVQ= -github.com/go-toolsmith/astequal v0.0.0-20180903214952-dcb477bfacd6/go.mod h1:H+xSiq0+LtiDC11+h1G32h7Of5O3CYFJ99GVbS5lDKY= -github.com/go-toolsmith/astequal v1.0.0/go.mod h1:H+xSiq0+LtiDC11+h1G32h7Of5O3CYFJ99GVbS5lDKY= -github.com/go-toolsmith/astfmt v0.0.0-20180903215011-8f8ee99c3086/go.mod h1:mP93XdblcopXwlyN4X4uodxXQhldPGZbcEJIimQHrkg= -github.com/go-toolsmith/astfmt v1.0.0/go.mod h1:cnWmsOAuq4jJY6Ct5YWlVLmcmLMn1JUPuQIHCY7CJDw= -github.com/go-toolsmith/astinfo v0.0.0-20180906194353-9809ff7efb21/go.mod h1:dDStQCHtmZpYOmjRP/8gHHnCCch3Zz3oEgCdZVdtweU= -github.com/go-toolsmith/astp v0.0.0-20180903215135-0af7e3c24f30/go.mod h1:SV2ur98SGypH1UjcPpCatrV5hPazG6+IfNHbkDXBRrk= -github.com/go-toolsmith/astp v1.0.0/go.mod h1:RSyrtpVlfTFGDYRbrjyWP1pYu//tSFcvdYrA8meBmLI= -github.com/go-toolsmith/pkgload v0.0.0-20181119091011-e9e65178eee8/go.mod h1:WoMrjiy4zvdS+Bg6z9jZH82QXwkcgCBX6nOfnmdaHks= -github.com/go-toolsmith/pkgload v1.0.0/go.mod h1:5eFArkbO80v7Z0kdngIxsRXRMTaX4Ilcwuh3clNrQJc= -github.com/go-toolsmith/strparse v1.0.0/go.mod h1:YI2nUKP9YGZnL/L1/DLFBfixrcjslWct4wyljWhSRy8= -github.com/go-toolsmith/typep v1.0.0/go.mod h1:JSQCQMUPdRlMZFswiq3TGpNp1GMktqkR2Ns5AIQkATU= -github.com/gobuffalo/flect v0.2.0/go.mod h1:W3K3X9ksuZfir8f/LrfVtWmCDQFfayuylOJ7sz/Fj80= -github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= -github.com/godbus/dbus v0.0.0-20181101234600-2ff6f7ffd60f/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= -github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= -github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= -github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20181024230925-c65c006176ff/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20191002201903-404acd9df4cc h1:55rEp52jU6bkyslZ1+C/7NGfpQsEc6pxGLAGDOctqbw= -github.com/golang/groupcache v0.0.0-20191002201903-404acd9df4cc/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.0.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v0.0.0-20161109072736-4bd1920723d7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= +github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2/go.mod h1:k9Qvh+8juN+UKMCS/3jFtGICgW8O96FVaZsaxdzDkR4= -github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a/go.mod h1:ryS0uhF+x9jgbj/N71xsEqODy9BN81/GonCZiOzirOk= -github.com/golangci/errcheck v0.0.0-20181223084120-ef45e06d44b6/go.mod h1:DbHgvLiFKX1Sh2T1w8Q/h4NAI8MHIpzCdnBUDTXU3I0= -github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613/go.mod h1:SyvUF2NxV+sN8upjjeVYr5W7tyxaT1JVtvhKhOn2ii8= -github.com/golangci/go-tools v0.0.0-20190318055746-e32c54105b7c/go.mod h1:unzUULGw35sjyOYjUt0jMTXqHlZPpPc6e+xfO4cd6mM= -github.com/golangci/goconst v0.0.0-20180610141641-041c5f2b40f3/go.mod h1:JXrF4TWy4tXYn62/9x8Wm/K/dm06p8tCKwFRDPZG/1o= -github.com/golangci/gocyclo v0.0.0-20180528134321-2becd97e67ee/go.mod h1:ozx7R9SIwqmqf5pRP90DhR2Oay2UIjGuKheCBCNwAYU= -github.com/golangci/gofmt v0.0.0-20181222123516-0b8337e80d98/go.mod h1:9qCChq59u/eW8im404Q2WWTrnBUQKjpNYKMbU4M7EFU= -github.com/golangci/golangci-lint v1.18.0/go.mod h1:kaqo8l0OZKYPtjNmG4z4HrWLgcYNIJ9B9q3LWri9uLg= -github.com/golangci/gosec v0.0.0-20190211064107-66fb7fc33547/go.mod h1:0qUabqiIQgfmlAmulqxyiGkkyF6/tOGSnY2cnPVwrzU= -github.com/golangci/ineffassign v0.0.0-20190609212857-42439a7714cc/go.mod h1:e5tpTHCfVze+7EpLEozzMB3eafxo2KT5veNg1k6byQU= -github.com/golangci/lint-1 v0.0.0-20190420132249-ee948d087217/go.mod h1:66R6K6P6VWk9I95jvqGxkqJxVWGFy9XlDwLwVz1RCFg= -github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca/go.mod h1:tvlJhZqDe4LMs4ZHD0oMUlt9G2LWuDGoisJTBzLMV9o= -github.com/golangci/misspell v0.0.0-20180809174111-950f5d19e770/go.mod h1:dEbvlSfYbMQDtrpRMQU675gSDLDNa8sCPPChZ7PhiVA= -github.com/golangci/prealloc v0.0.0-20180630174525-215b22d4de21/go.mod h1:tf5+bzsHdTM0bsB7+8mt0GUMvjCgwLpTapNZHU8AajI= -github.com/golangci/revgrep v0.0.0-20180526074752-d9c87f5ffaf0/go.mod h1:qOQCunEYvmd/TLamH+7LlVccLvUH5kZNhbCgTHoBbp4= -github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4/go.mod h1:Izgrg8RkN3rCIMLGE9CyYmU9pY2Jer6DgANEnZ/L/cQ= -github.com/golangplus/bytes v0.0.0-20160111154220-45c989fe5450/go.mod h1:Bk6SMAONeMXrxql8uvOKuAZSu8aM5RUGv+1C6IJaEho= -github.com/golangplus/fmt v0.0.0-20150411045040-2a5d6d7d2995/go.mod h1:lJgMEyOkYFkPcDKwRXegd+iM6E7matEszMG5HhwytU8= -github.com/golangplus/testing v0.0.0-20180327235837-af21d9c3145e/go.mod h1:0AA//k/eakGydO4jKRoRL2j92ZKSzTgj9tclaCrvXHk= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/cadvisor v0.35.0/go.mod h1:1nql6U13uTHaLYB8rLS5x9IJc2qT6Xd/Tr1sTX6NE48= +github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= +github.com/google/gnostic v0.5.7-v3refs h1:FhTMOKj2VhjpouxvWJAV1TL304uMlb9zcDqkl6cEI54= +github.com/google/gnostic v0.5.7-v3refs/go.mod h1:73MKFl6jIHelAJNaBGFzt3SPtZULs9dYrGFt8OiIsHQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= -github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= -github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= -github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g= +github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= -github.com/googleapis/gnostic v0.2.0/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= -github.com/googleapis/gnostic v0.3.1 h1:WeAefnSUHlBb0iJKwxFDZdbfGwkd7xRNuV+IpXMJhYk= -github.com/googleapis/gnostic v0.3.1/go.mod h1:on+2t9HRStVgn95RSsFWFz+6Q0Snyqv1awfrALZdbtU= -github.com/gophercloud/gophercloud v0.1.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= -github.com/gorilla/mux v1.7.0/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= -github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gostaticanalysis/analysisutil v0.0.0-20190318220348-4088753ea4d3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE= -github.com/gostaticanalysis/analysisutil v0.0.3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= -github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= -github.com/hashicorp/golang-lru v0.0.0-20180201235237-0fb14efe8c47/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= -github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= -github.com/hashicorp/hcl v0.0.0-20180404174102-ef8a98b0bbce/go.mod h1:oZtUIOe8dh44I2q6ScRibXws4Ajl+d+nod3AaR9vL5w= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/heketi/heketi v9.0.1-0.20190917153846-c2e2a4ab7ab9+incompatible/go.mod h1:bB9ly3RchcQqsQ9CpyaQwvva7RS5ytVoSoholZQON6o= -github.com/heketi/tests v0.0.0-20151005000721-f3775cbcefd6/go.mod h1:xGMAM8JLi7UkZt1i4FQeQy0R2T8GLUwQhOP5M1gBhy4= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/imdario/mergo v0.3.7/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/imdario/mergo v0.3.8 h1:CGgOkSJeqMRmt0D9XLWExdT4m4F1vd3FV3VPt+0VxkQ= -github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= +github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= -github.com/jimstudt/http-authentication v0.0.0-20140401203705-3eca13d6893a/go.mod h1:wK6yTYYcgjHE1Z1QtXACPDjcFJyBskHEdagmnq3vsP8= -github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= -github.com/json-iterator/go v0.0.0-20180612202835-f2b4162afba3/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns= -github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a/go.mod h1:UJSiEoRfvx3hP73CvoARgeLjaIOjybY9vj8PUPPFGeU= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/karrick/godirwalk v1.7.5/go.mod h1:2c9FRhkDxdIbgkOnCEvnSWs71Bhugbl46shStcFDJ34= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= -github.com/kisielk/gotool v0.0.0-20161130080628-0de1eaf82fa3/go.mod h1:jxZFDH7ILpTPQTk+E2s+z4CUas9lVNjIuKR4c5/zKgM= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/klauspost/cpuid v0.0.0-20180405133222-e7e905edc00e/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= -github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s= -github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= -github.com/libopenstorage/openstorage v1.0.0/go.mod h1:Sp1sIObHjat1BeXhfMqLZ14wnOzEhNx2YQedreMcUyc= -github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de/go.mod h1:zAbeS9B/r2mtpb6U+EI2rYA5OAXxsYw6wTamcNW+zcE= -github.com/lithammer/dedent v1.1.0/go.mod h1:jrXYCQtgg0nJiN+StA2KgR7w6CiQNv9Fd/Z9BP0jIOc= -github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= -github.com/lpabon/godbc v0.1.1/go.mod h1:Jo9QV0cf3U6jZABgiJ2skINAXb9j8m51r07g4KI92ZA= -github.com/lucas-clemente/aes12 v0.0.0-20171027163421-cd47fb39b79f/go.mod h1:JpH9J1c9oX6otFSgdUHwUBUizmKlrMjxWnIAjff4m04= -github.com/lucas-clemente/quic-clients v0.1.0/go.mod h1:y5xVIEoObKqULIKivu+gD/LU90pL73bTdtQjPBvtCBk= -github.com/lucas-clemente/quic-go v0.10.2/go.mod h1:hvaRS9IHjFLMq76puFJeWNfmn+H70QZ/CXoxqw9bzao= -github.com/lucas-clemente/quic-go-certificates v0.0.0-20160823095156-d2f86524cced/go.mod h1:NCcRLrOTZbzhZvixZLlERbJtDtYsmMw8Jc4vS8Z0g58= -github.com/lucasb-eyer/go-colorful v1.0.2/go.mod h1:0MS4r+7BZKSJ5mw4/S5MPN+qHFF1fYclkSPilDOKW0s= -github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= -github.com/magiconair/properties v1.7.6/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= -github.com/mailru/easyjson v0.7.1 h1:mdxE1MF9o53iCb2Ghj1VfWvh7ZOwHpnVG/xwXrV90U8= -github.com/mailru/easyjson v0.7.1/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= -github.com/marten-seemann/qtls v0.2.3/go.mod h1:xzjG7avBwGGbdZ8dTGxlBnLArsVKLvwmjgmPuiQEcYk= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= -github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= -github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-shellwords v1.0.5/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o= -github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= -github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= +github.com/mailru/easyjson v0.7.6 h1:8yTIVnZgCoiM1TgqoeTl+LfU5Jg6/xL3QhGQnimLYnA= +github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/mesos/mesos-go v0.0.9/go.mod h1:kPYCMQ9gsOXVAle1OsoY4I1+9kPu8GHkf88aV59fDr4= -github.com/mholt/certmagic v0.6.2-0.20190624175158-6a42ef9fe8c2/go.mod h1:g4cOPxcjV0oFq3qwpjSA30LReKD8AoIfwAY9VvG35NY= -github.com/miekg/dns v1.1.3/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/miekg/dns v1.1.4/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/mindprince/gonvml v0.0.0-20190828220739-9ebdce4bb989/go.mod h1:2eu9pRWp8mo84xCg6KswZ+USQHjwgRhNp06sozOdsTY= -github.com/mistifyio/go-zfs v2.1.1+incompatible/go.mod h1:8AuVvqP/mXw1px98n46wfvcGfQ4ci2FwoAjKYxuo3Z4= -github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-ps v0.0.0-20170309133038-4fdf99ab2936/go.mod h1:r1VsdOzOPt1ZSrGZWFoNhsAedKnEd6r9Np1+5blZCWk= -github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= -github.com/mitchellh/mapstructure v0.0.0-20180220230111-00c29f56e238/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI= +github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180320133207-05fbef0ca5da/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/mohae/deepcopy v0.0.0-20170603005431-491d3605edfb/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= -github.com/morikuni/aec v0.0.0-20170113033406-39771216ff4c/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= -github.com/mozilla/tls-observatory v0.0.0-20180409132520-8791a200eb40/go.mod h1:SrKMQvPiws7F7iqYp8/TX+IhxCYhzr6N/1yb8cwHsGk= -github.com/mrunalp/fileutils v0.0.0-20171103030105-7d4729fb3618/go.mod h1:x8F1gnqOkIEiO4rqoeEEEqQbo7HjGMTvyoq3gej4iT0= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/mvdan/xurls v1.1.0/go.mod h1:tQlNn3BED8bE/15hnSL2HLkDeLWpNPAwtw7wkEq44oU= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= -github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0= -github.com/naoina/toml v0.1.1/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= -github.com/nbutton23/zxcvbn-go v0.0.0-20160627004424-a22cb81b2ecd/go.mod h1:o96djdrsSGy3AWPyBgZMAGfxZNfgntdJG+11KU4QvbU= -github.com/nbutton23/zxcvbn-go v0.0.0-20171102151520-eafdab6b0663/go.mod h1:o96djdrsSGy3AWPyBgZMAGfxZNfgntdJG+11KU4QvbU= -github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.2 h1:uqH7bpe+ERSiDa34FDOF7RikN6RzXgduUF8yarlZp94= -github.com/onsi/ginkgo v1.10.2/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= +github.com/onsi/ginkgo/v2 v2.1.3 h1:e/3Cwtogj0HA+25nMP1jCMDIf8RtRYbGwGGuBIFztkc= github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= -github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME= -github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= -github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opencontainers/runc v1.0.0-rc9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= -github.com/opencontainers/runtime-spec v1.0.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= -github.com/opencontainers/selinux v1.3.1-0.20190929122143-5215b1806f52/go.mod h1:+BLncwf63G4dgOzykXAxcmnFlUaOlkDdmw/CqsW6pjs= -github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= -github.com/pelletier/go-toml v1.1.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.19.0 h1:4ieX6qQjPP/BfC3mpsAtIGGlxTWPeA3Inl/7DtXw1tw= +github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA= -github.com/pquerna/ffjson v0.0.0-20180717144149-af8b230fcd20/go.mod h1:YARuvh7BUWHNhzDq2OM5tzR2RiCcN2D7sapiKyCel/M= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.5.0 h1:Ctq0iGpCmr3jeP77kbF2UxgvRwzWWz+4Bh9/vJTyg1A= -github.com/prometheus/client_golang v1.5.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.12.2 h1:51L9cDoUHVrXx4zWYlcLQIZ+d+VXHgqnYKkIuq4g/34= +github.com/prometheus/client_golang v1.12.2/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.9.1 h1:KOMtN28tlbam3/7ZKEYKHhKoJZYYj3gMH4uc62x7X7U= -github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.8 h1:+fpWZdT24pJBiqJdAwYBjPSk+5YmQzYNPYzQsdzLkt8= -github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= -github.com/quasilyte/go-consistent v0.0.0-20190521200055-c6f3937de18c/go.mod h1:5STLWrekHfjyYwxBRVRXNOSewLJ3PWfDJd1VyTS21fI= -github.com/quobyte/api v0.1.2/go.mod h1:jL7lIHrmqQ7yh05OJ+eEEdHr0u/kmT1Ff9iHd+4H6VI= -github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M= -github.com/rivo/tview v0.0.0-20190515161233-bd836ef13b4b/go.mod h1:+rKjP5+h9HMwWRpAfhIkkQ9KE3m3Nz5rwn7YtUpwgqk= -github.com/rivo/uniseg v0.0.0-20190513083848-b9f5b9457d44/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/robfig/cron v1.1.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k= -github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= -github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/prometheus/common v0.26.0 h1:iMAkS2TDoNWnKM+Kopnx/8tnEStIfpYA0ur0xQzzhMQ= +github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= +github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= +github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rubiojr/go-vhd v0.0.0-20160810183302-0bfd3b39853c/go.mod h1:DM5xW0nvfNNm2uytzsvhI3OnX8uzaRAg8UX/CnDqbto= -github.com/russross/blackfriday v0.0.0-20170610170232-067529f716f4/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/ryanuber/go-glob v0.0.0-20170128012129-256dc444b735/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= -github.com/sanity-io/litter v1.1.0/go.mod h1:CJ0VCw2q4qKU7LaQr3n7UOSHzgEMgcGco7N/SkZQPjw= -github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= -github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= -github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= -github.com/shirou/gopsutil v0.0.0-20180427012116-c95755e4bcd7/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= -github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc= -github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= -github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= -github.com/sirupsen/logrus v1.0.5/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= -github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= -github.com/sourcegraph/go-diff v0.5.1/go.mod h1:j2dHj3m8aZgQO8lMTcTnBcXkRRRqi34cd2MNlA9u1mE= -github.com/spaceapegames/go-wavefront v1.6.2/go.mod h1:Q9wbY/SM99cOM4NvoJ2SN1bzcJUJOEzta5C7dhnT5IM= -github.com/spf13/afero v1.1.0/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= +github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= -github.com/spf13/cast v1.2.0/go.mod h1:r2rcYCSwa1IExKTDiTfzaxqT2FNHs8hODu4LnUfgKEg= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v0.0.2/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/cobra v0.0.5 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s= -github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/jwalterweatherman v0.0.0-20180109140146-7c0cea34c8ec/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= -github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/cobra v1.5.0 h1:X+jTBEBqF0bHN+9cSMgmfuvv2VHJ9ezmFNf9Y/XstYU= +github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.0.2/go.mod h1:A8kyI5cUJhb8N+3pkfONlcEcZbueH6nhAm0Fq7SrnBM= -github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/storageos/go-api v0.0.0-20180912212459-343b3eff91fc/go.mod h1:ZrLn+e0ZuF3Y65PNF6dIwbJPZqfmtCXxFm9ckv0agOY= +github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= -github.com/stretchr/testify v0.0.0-20151208002404-e3a8ff8ce365/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= -github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= -github.com/thecodeteam/goscaleio v0.1.0/go.mod h1:68sdkZAsK8bvEwBlbQnlLS+xU+hvLYM/iQ8KXej1AwM= -github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= -github.com/timakin/bodyclose v0.0.0-20190721030226-87058b9bfcec/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk= -github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/ultraware/funlen v0.0.1/go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA= -github.com/ultraware/funlen v0.0.2/go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA= -github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= -github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= -github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasthttp v1.2.0/go.mod h1:4vX61m6KN+xDduDNwXrhIAVZaZaZiQ1luJk8LWSxF3s= -github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= -github.com/valyala/quicktemplate v1.1.1/go.mod h1:EH+4AkTd43SvgIbQHYu59/cJyxDoOVRUAfrukLPuGJ4= -github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= -github.com/vektah/gqlparser v1.1.2/go.mod h1:1ycwN7Ij5njmMkPPAOaRFY4rET2Enx7IkVv3vaXspKw= -github.com/vektra/mockery v0.0.0-20181123154057-e78b021dcbb5/go.mod h1:ppEjwdhyy7Y31EnHRDm1JkChoC7LXIJ7Ex0VYLWtZtQ= -github.com/vishvananda/netlink v1.0.0/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk= -github.com/vishvananda/netns v0.0.0-20171111001504-be1fbeda1936/go.mod h1:ZjcWmFBXmLKZu9Nxj3WKYEafiSqer2rnvPr0en9UNpI= -github.com/vmware/govmomi v0.20.3/go.mod h1:URlwyTFZX72RmxtxuaFL2Uj3fD1JTvZdx59bHWk6aFU= -github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/xlab/handysort v0.0.0-20150421192137-fb3537ed64a1/go.mod h1:QcJo0QPSfTONNIgpN5RA8prR7fF8nkF6cTWTcNerRO8= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= -go.mongodb.org/mongo-driver v1.0.3/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= -go.mongodb.org/mongo-driver v1.1.1/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= -go.mongodb.org/mongo-driver v1.1.2/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE= -golang.org/x/build v0.0.0-20190927031335-2835ba2e683f/go.mod h1:fYw7AShPAhGMdXqA9gRadk/CcMsvLlClpE5oBwnS3dM= -golang.org/x/crypto v0.0.0-20180426230345-b49d69b5da94/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190123085648-057139ce5d2b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= +go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= +go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190320223903-b7391e95e576/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190424203555-c05e17bb3b2d/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190617133340-57b3e21c3d56/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= -golang.org/x/crypto v0.0.0-20191108234033-bd318be0434a h1:R/qVym5WAxsZWQqZCwDY/8sdVKV1m1WgU4/S5IRQAzc= -golang.org/x/crypto v0.0.0-20191108234033-bd318be0434a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190312203227-4b39c73a6495/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20170915142106-8351a756f30f/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180911220305-26e67e76b6c3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181102091132-c10e9556a7bc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190320064053-1272bf9dcd53/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190328230028-74de082e2cca/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190502183928-7f726cade0ab/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a h1:GuSPYbZzB5/dcLNCwLQLsg3obCJtX9IJhpXkvY7kzk0= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f h1:oA4XRj0qtSt8Yo1Zms0CUlsT3KG69V2UGQWPBxujDmc= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 h1:RerP+noqYHUQ8CMRcPlC2nvTa4dcBIjegkuWdcUDuqg= +golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20171026204733-164713f0dfce/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190122071731-054c452bb702/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190124100055-b90733256f2e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190209173611-3b5209105503/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190321052220-f7bb7a8bee54/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82 h1:ywK/j/KkyTHcdyYSZNXGjMwgmDSfjglYZ3vStQ/gSCU= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.0.0-20170915090833-1cbadb444a80/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220412211240-33da011f77ad h1:ntjMns5wyP/fN65tdBD4g8J5w8n015+iIIs9rtjXkY0= +golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190921001708-c4c64cad1fd0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0 h1:/5xXl8Y5W96D+TtHSlonuFqGHIWVuyCkGJLwGh9JJFs= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20170915040203-e531a2a1c15f/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 h1:vVKdlvoWBphwdxWKrFZEuM0kGgGLxUOYcY4U/2Vjg44= +golang.org/x/time v0.0.0-20220210224613-90d013bbcef8/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181011042414-1f849cf54d09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181112210238-4b1f3b6b1646/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181117154741-2ddaf7f79a09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190110163146-51295c7ec13a/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190121143147-24cd39ecf745/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190122202912-9c309ee22fab/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190125232054-d66bd3c5d5a6/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190311215038-5c2858a9cfe5/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190322203728-c1a832b0ad89/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190521203540-521d6ed310dd/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190617190820-da514acc4774/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190909030654-5b82db07426d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190920225731-5eefd052ad72/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200505023115-26f46d2f7ef8/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= +golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gonum.org/v1/gonum v0.0.0-20190331200053-3d26580ed485/go.mod h1:2ltnJ7xHfj0zHS40VVPYEAAMTa3ZGguvHGBSJeRWqE0= -gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= -gonum.org/v1/netlib v0.0.0-20190331212654-76723241ea4e/go.mod h1:kS+toOQn6AQKjmKJ7gzohV1XkqsFehRA2FbsbkopSuQ= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.6.1-0.20190607001116-5213b8090861/go.mod h1:btoxGiFvQNVUZQ8W08zLtrVS08CNpINPEfxXxgJL1Q4= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= +google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= +google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= +google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= +google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= +google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.5 h1:tycE03LOZYQNhDpS27tcQdAzLCVMaj7QT2SXxebnpCM= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= +google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190916214212-f660b8655731/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a h1:Ob5/580gVHBJZgXnff1cZDbG+xLtMVE5mDRTe+nIsX4= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201019141844-1ed22bb0c154/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= +google.golang.org/genproto v0.0.0-20220531134929-86cf59382f1b h1:X+VXcq/YthmZqFvppQm4Wleg4o//OmY2uttDv1vDvRo= +google.golang.org/genproto v0.0.0-20220531134929-86cf59382f1b/go.mod h1:yKyY4AMRwFiC8yMMNaMi+RkCnjZJt9LoWuvhXjMs+To= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1 h1:wdKvqQk7IttEw92GoRyKG2IDrUIpgpj6H6m81yfeMW0= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= +google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= +google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/gcfg.v1 v1.2.0/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= -gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= -gopkg.in/mcuadros/go-syslog.v2 v2.2.1/go.mod h1:l5LPIyOOyIdQquNg+oU6Z3524YwrcqEm0aKH+5zpt2U= -gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= -gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= -gopkg.in/square/go-jose.v2 v2.2.2/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/warnings.v0 v0.1.1/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= -gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20190905181640-827449938966/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gotest.tools v2.1.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= -gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= -gotest.tools/gotestsum v0.3.5/go.mod h1:Mnf3e5FUzXbkCfynWBGOwLssY7gTQgCHObK9tMpAriY= -grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o= +gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.2/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -istio.io/api v0.0.0-20200226024546-cca495b82b03 h1:c0Lsnavz2gRslJxqtqiP7VOxr8EJHJJWgfSJabfnZ2s= -istio.io/api v0.0.0-20200226024546-cca495b82b03/go.mod h1:bcY3prusO/6vA6zGHz4PNG2v79clPyTw06Xx3fprJSQ= -istio.io/client-go v0.0.0-20200226182959-cde3e69bd9dd h1:U5eWo5yvlRsk4pr5s6ky63G1dJkAgugXzoiKzkMQxGc= -istio.io/client-go v0.0.0-20200226182959-cde3e69bd9dd/go.mod h1:wLFtAm266NbVvt1Y8ZwbZXCdp1kgnBuxZTAIaMwUkto= -istio.io/gogo-genproto v0.0.0-20190930162913-45029607206a/go.mod h1:OzpAts7jljZceG4Vqi5/zXy/pOg1b209T3jb7Nv5wIs= -istio.io/gogo-genproto v0.0.0-20191024203824-d079cc8b1d55 h1:nvpx66mnuGvXYP4IfCWfUqB9YhiXBF3MvUDsclNnDzI= -istio.io/gogo-genproto v0.0.0-20191024203824-d079cc8b1d55/go.mod h1:OzpAts7jljZceG4Vqi5/zXy/pOg1b209T3jb7Nv5wIs= -k8s.io/api v0.17.3 h1:XAm3PZp3wnEdzekNkcmj/9Y1zdmQYJ1I4GKSBBZ8aG0= -k8s.io/api v0.17.3/go.mod h1:YZ0OTkuw7ipbe305fMpIdf3GLXZKRigjtZaV5gzC2J0= -k8s.io/apiextensions-apiserver v0.17.3/go.mod h1:CJbCyMfkKftAd/X/V6OTHYhVn7zXnDdnkUjS1h0GTeY= -k8s.io/apimachinery v0.17.5-beta.0 h1:fpRN0B+B9lyvz8JSgcNAYsP+MosoQlXAmhsta15Ez9g= -k8s.io/apimachinery v0.17.5-beta.0/go.mod h1:gxLnyZcGNdZTCLnq3fgzyg2A5BVCHTNDFrw8AmuJ+0g= -k8s.io/apiserver v0.17.3/go.mod h1:iJtsPpu1ZpEnHaNawpSV0nYTGBhhX2dUlnn7/QS7QiY= -k8s.io/cli-runtime v0.17.3/go.mod h1:X7idckYphH4SZflgNpOOViSxetiMj6xI0viMAjM81TA= -k8s.io/client-go v0.17.3 h1:deUna1Ksx05XeESH6XGCyONNFfiQmDdqeqUvicvP6nU= -k8s.io/client-go v0.17.3/go.mod h1:cLXlTMtWHkuK4tD360KpWz2gG2KtdWEr/OT02i3emRQ= -k8s.io/cloud-provider v0.17.3/go.mod h1:JBkKSQpbcjcYGDqH5PbifFrcgQ/7WOXRswnfLVbXpI8= -k8s.io/cluster-bootstrap v0.17.3/go.mod h1:ujIYnCKnxY/MecpgPx9WgiYCVCFvici6tVIfI2FiI1g= -k8s.io/code-generator v0.17.5-beta.0/go.mod h1:l8BLVwASXQZTo2xamW5mQNFCe1XPiAesVq7Y1t7PiQQ= -k8s.io/component-base v0.17.3/go.mod h1:GeQf4BrgelWm64PXkIXiPh/XS0hnO42d9gx9BtbZRp8= -k8s.io/cri-api v0.17.18-rc.0/go.mod h1:X1sbHmuXhwaHs9xxYffLqJogVsnI+f6cPRcgPel7ywM= -k8s.io/csi-translation-lib v0.17.3/go.mod h1:FBya8XvGIqDm2/3evLQNxaFXqv/C2UcZa5JgJt6/qqY= -k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= -k8s.io/gengo v0.0.0-20190822140433-26a664648505/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= -k8s.io/heapster v1.2.0-beta.1/go.mod h1:h1uhptVXMwC8xtZBYsPXKVi8fpdlYkTs6k949KozGrM= -k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= -k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= -k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8= -k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= -k8s.io/kube-aggregator v0.17.3/go.mod h1:1dMwMFQbmH76RKF0614L7dNenMl3dwnUJuOOyZ3GMXA= -k8s.io/kube-controller-manager v0.17.3/go.mod h1:22B/TsgVviuCVuNwUrqgyTi5D4AYjMFaK9c8h1oonkY= -k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a/go.mod h1:1TqjTSzOxsLGIKfj0lK8EeCP7K1iUG65v09OM0/WG5E= -k8s.io/kube-openapi v0.0.0-20200204173128-addea2498afe h1:GOfbcWvX5wW2vcfNch83xYp9SDZjRgAJk+t373yaHKk= -k8s.io/kube-openapi v0.0.0-20200204173128-addea2498afe/go.mod h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E= -k8s.io/kube-proxy v0.17.3/go.mod h1:ds8R8bUYPWtQlspC47Sff7o5aQhWDsv6jpQJATDuqaQ= -k8s.io/kube-scheduler v0.17.3/go.mod h1:36HgrrPqzK+rOLTRtDG//b89KjrAZqFI4PXOpdH351M= -k8s.io/kubectl v0.17.3/go.mod h1:NUn4IBY7f7yCMwSop2HCXlw/MVYP4HJBiUmOR3n9w28= -k8s.io/kubelet v0.17.3/go.mod h1:Nh8owUHZcUXtnDAtmGnip36Nw+X6c4rbmDQlVyIhwMQ= -k8s.io/kubernetes v1.17.3/go.mod h1:gt28rfzaskIzJ8d82TSJmGrJ0XZD0BBy8TcQvTuCI3w= -k8s.io/legacy-cloud-providers v0.17.3/go.mod h1:ujZML5v8efVQxiXXTG+nck7SjP8KhMRjUYNIsoSkYI0= -k8s.io/metrics v0.17.3/go.mod h1:HEJGy1fhHOjHggW9rMDBJBD3YuGroH3Y1pnIRw9FFaI= -k8s.io/repo-infra v0.0.1-alpha.1/go.mod h1:wO1t9WaB99V80ljbeENTnayuEEwNZt7gECYh/CEyOJ8= -k8s.io/sample-apiserver v0.17.3/go.mod h1:cn/rvFIttGNqy1v88B5ZlDAbyyqDOoF7JHSwPiqNCNQ= -k8s.io/system-validators v1.0.4/go.mod h1:HgSgTg4NAGNoYYjKsUyk52gdNi2PVDswQ9Iyn66R7NI= -k8s.io/utils v0.0.0-20191114184206-e782cd3c129f h1:GiPwtSzdP43eI1hpPCbROQCCIgCuiMMNF8YUVLF3vJo= -k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew= -modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw= -modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk= -modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k= -modernc.org/strutil v1.0.0/go.mod h1:lstksw84oURvj9y3tn8lGvRxyRC1S2+g5uuIzNfIOBs= -modernc.org/xc v1.0.0/go.mod h1:mRNCo0bvLjGhHO9WsyuKVU4q0ceiDDDoEeWDJHrNx8I= -mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc= -mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4= -mvdan.cc/unparam v0.0.0-20190209190245-fbb59629db34/go.mod h1:H6SUd1XjIs+qQCyskXg5OFSrilMRUkD8ePJpHKDPaeY= -sigs.k8s.io/controller-tools v0.2.5/go.mod h1:+t0Hz6tOhJQCdd7IYO0mNzimmiM9sqMU0021u6UCF2o= -sigs.k8s.io/kustomize v2.0.3+incompatible/go.mod h1:MkjgH3RdOWrievjo6c9T245dYlB5QeXV4WCbnt/PEpU= -sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI= -sigs.k8s.io/structured-merge-diff v1.0.1-0.20191108220359-b1b620dd3f06/go.mod h1:/ULNhyfzRopfcjskuui0cTITekDduZ7ycKN3oUT9R18= -sigs.k8s.io/structured-merge-diff/v3 v3.0.0-20200116222232-67a7b8c61874/go.mod h1:PlARxl6Hbt/+BC80dRLi1qAmnMqwqDg62YvvVkZjemw= -sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +istio.io/api v0.0.0-20220621155648-3e39d064ab6b h1:H/0SpurAugYS4nhEcYx6uEUv1EX2WqL8vejJrRCVQIA= +istio.io/api v0.0.0-20220621155648-3e39d064ab6b/go.mod h1:SJ6R+VKPZwpWnQsNlQL5cVGjAUNm/alk0D/6P5tV+tM= +istio.io/client-go v1.14.0 h1:KKXMnxXx3U2866OP8FBYlJhjKdI3yIUQnt8L6hSzDHE= +istio.io/client-go v1.14.0/go.mod h1:C7K0CKQlvY84yQKkZhxQbD1riqvnsgXJm3jF5GOmzNg= +k8s.io/api v0.24.2 h1:g518dPU/L7VRLxWfcadQn2OnsiGWVOadTLpdnqgY2OI= +k8s.io/api v0.24.2/go.mod h1:AHqbSkTm6YrQ0ObxjO3Pmp/ubFF/KuM7jU+3khoBsOg= +k8s.io/apimachinery v0.24.2 h1:5QlH9SL2C8KMcrNJPor+LbXVTaZRReml7svPEh4OKDM= +k8s.io/apimachinery v0.24.2/go.mod h1:82Bi4sCzVBdpYjyI4jY6aHX+YCUchUIrZrXKedjd2UM= +k8s.io/client-go v0.24.2 h1:CoXFSf8if+bLEbinDqN9ePIDGzcLtqhfd6jpfnwGOFA= +k8s.io/client-go v0.24.2/go.mod h1:zg4Xaoo+umDsfCWr4fCnmLEtQXyCNXCvJuSsglNcV30= +k8s.io/gengo v0.0.0-20210813121822-485abfe95c7c/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= +k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= +k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= +k8s.io/klog/v2 v2.60.1 h1:VW25q3bZx9uE3vvdL6M8ezOX79vA2Aq1nEWLqNQclHc= +k8s.io/klog/v2 v2.60.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= +k8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42/go.mod h1:Z/45zLw8lUo4wdiUkI+v/ImEGAvu3WatcZl3lPMR4Rk= +k8s.io/kube-openapi v0.0.0-20220621154418-c39d0f63fac8 h1:30P0UV8MQgg4f1khIUT09xHmpI5B5Wg0Vg6JNkUqsQ0= +k8s.io/kube-openapi v0.0.0-20220621154418-c39d0f63fac8/go.mod h1:PNbiP2hKArDh8cgJZTDL6Ss/z3wsbga8yjj/7VMB+I4= +k8s.io/utils v0.0.0-20210802155522-efc7438f0176/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= +k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 h1:HNSDgDCrr/6Ly3WEGKZftiE7IY19Vz2GdbOCyI4qqhc= +k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= +sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2/go.mod h1:B+TnT182UBxE84DiCz4CVE26eOSDAeYCpfDnC2kdKMY= +sigs.k8s.io/json v0.0.0-20220525155127-227cbc7cc124 h1:2sgAQQcY0dEW2SsQwTXhQV4vO6+rSslYx8K3XmM5hqQ= +sigs.k8s.io/json v0.0.0-20220525155127-227cbc7cc124/go.mod h1:B+TnT182UBxE84DiCz4CVE26eOSDAeYCpfDnC2kdKMY= +sigs.k8s.io/structured-merge-diff/v4 v4.0.2/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= +sigs.k8s.io/structured-merge-diff/v4 v4.2.1 h1:bKCqE9GvQ5tiVHn5rfn1r+yao3aLQEaLzkkmAkf+A6Y= +sigs.k8s.io/structured-merge-diff/v4 v4.2.1/go.mod h1:j/nl6xW8vLS49O8YvXW1ocPhZawJtm+Yrr7PPRQ0Vg4= sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q= sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= -sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0= -vbom.ml/util v0.0.0-20160121211510-db5cfe13f5cc/go.mod h1:so/NYdZXCz+E3ZpW0uAoCj6uzU2+8OWDFv/HxUSs7kI= diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index 62b4c200..ec94ca26 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -7,7 +7,7 @@ set -o pipefail SCRIPT_ROOT=$(realpath $(dirname ${BASH_SOURCE})/..) #brew install coreutils (mac) or sudo apt-get install realpath (linux) if you don't have it # Grab code-generator version from go.sum. -CODEGEN_VERSION=$(grep 'k8s.io/code-generator' go.mod | awk '{print $5}' | head -1) +CODEGEN_VERSION=$(grep 'k8s.io/code-generator' go.mod | awk '{print $4}' | head -1) CODEGEN_PKG=$(echo `go env GOPATH`"/pkg/mod/k8s.io/code-generator@${CODEGEN_VERSION}") echo ">> Using ${CODEGEN_PKG}" From 18074b25f963f58e684327aaa5ab9ccb0614a7a7 Mon Sep 17 00:00:00 2001 From: Anubhav Aeron Date: Tue, 30 Aug 2022 09:02:24 -0700 Subject: [PATCH 2/7] exclude asset list Signed-off-by: Anubhav Aeron --- admiral/cmd/admiral/cmd/root.go | 13 ++-- admiral/pkg/clusters/serviceentry.go | 89 ++++++++++++-------------- admiral/pkg/clusters/types.go | 36 +++++------ admiral/pkg/controller/common/types.go | 5 +- 4 files changed, 68 insertions(+), 75 deletions(-) diff --git a/admiral/cmd/admiral/cmd/root.go b/admiral/cmd/admiral/cmd/root.go index 4e100077..1b71eb03 100644 --- a/admiral/cmd/admiral/cmd/root.go +++ b/admiral/cmd/admiral/cmd/root.go @@ -4,17 +4,18 @@ import ( "context" "flag" "fmt" - "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/routes" - "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/server" - "github.com/istio-ecosystem/admiral/admiral/pkg/clusters" - "github.com/istio-ecosystem/admiral/admiral/pkg/controller/common" - log "github.com/sirupsen/logrus" "os" "os/signal" "sync" "syscall" "time" + "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/routes" + "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/server" + "github.com/istio-ecosystem/admiral/admiral/pkg/clusters" + "github.com/istio-ecosystem/admiral/admiral/pkg/controller/common" + log "github.com/sirupsen/logrus" + "github.com/spf13/cobra" ) @@ -142,6 +143,8 @@ func GetRootCmd(args []string) *cobra.Command { "The value of envoy filter is to add additional config to the filter config section") rootCmd.PersistentFlags().BoolVar(¶ms.EnableRoutingPolicy, "enable_routing_policy", false, "If Routing Policy feature needs to be enabled") + rootCmd.PersistentFlags().StringArrayVar(¶ms.ExcludeAssetList, "exclude_asset_list", []string{}, + "List of assets which should be excluded from getting processed") return rootCmd } diff --git a/admiral/pkg/clusters/serviceentry.go b/admiral/pkg/clusters/serviceentry.go index 327e8394..72e770aa 100644 --- a/admiral/pkg/clusters/serviceentry.go +++ b/admiral/pkg/clusters/serviceentry.go @@ -56,46 +56,37 @@ func createServiceEntry(ctx context.Context, event admiral.EventType, rc *Remote } func modifyServiceEntryForNewServiceOrPod(ctx context.Context, event admiral.EventType, env string, sourceIdentity string, remoteRegistry *RemoteRegistry) map[string]*networking.ServiceEntry { - defer util.LogElapsedTime("modifyServiceEntryForNewServiceOrPod", sourceIdentity, env, "")() - if CurrentAdmiralState.ReadOnly { log.Infof(LogFormat, event, env, sourceIdentity, "", "Processing skipped as Admiral is in Read-only mode") return nil } - if IsCacheWarmupTime(remoteRegistry) { log.Infof(LogFormat, event, env, sourceIdentity, "", "Processing skipped during cache warm up state") return nil } //create a service entry, destination rule and virtual service in the local cluster - sourceServices := make(map[string]*k8sV1.Service) - sourceWeightedServices := make(map[string]map[string]*WeightedService) - sourceDeployments := make(map[string]*k8sAppsV1.Deployment) - sourceRollouts := make(map[string]*argo.Rollout) - - var serviceEntries = make(map[string]*networking.ServiceEntry) - - var cname string - cnames := make(map[string]string) - var serviceInstance *k8sV1.Service - var weightedServices map[string]*WeightedService - var rollout *argo.Rollout - var deployment *k8sAppsV1.Deployment - var gtps = make(map[string][]*v1.GlobalTrafficPolicy) - - var namespace string - - var gtpKey = common.ConstructGtpKey(env, sourceIdentity) - - start := time.Now() - - clusters := remoteRegistry.GetClusterIds() + var ( + namespace string + cname string + serviceInstance *k8sV1.Service + weightedServices map[string]*WeightedService + rollout *argo.Rollout + deployment *k8sAppsV1.Deployment + gtps = make(map[string][]*v1.GlobalTrafficPolicy) + sourceServices = make(map[string]*k8sV1.Service) + sourceWeightedServices = make(map[string]map[string]*WeightedService) + sourceDeployments = make(map[string]*k8sAppsV1.Deployment) + sourceRollouts = make(map[string]*argo.Rollout) + serviceEntries = make(map[string]*networking.ServiceEntry) + cnames = make(map[string]string) + start = time.Now() + gtpKey = common.ConstructGtpKey(env, sourceIdentity) + clusters = remoteRegistry.GetClusterIds() + ) for _, clusterId := range clusters { - rc := remoteRegistry.GetRemoteController(clusterId) - if rc == nil { log.Warnf(LogFormat, "Find", "remote-controller", clusterId, clusterId, "remote controller not available/initialized for the cluster") continue @@ -109,7 +100,16 @@ func modifyServiceEntryForNewServiceOrPod(ctx context.Context, event admiral.Eve rollout = rc.RolloutController.Cache.Get(sourceIdentity, env) } + if deployment == nil && rollout == nil { + log.Infof("Neither deployment nor rollouts found for identity=%s in env=%s namespace=%s", sourceIdentity, env, namespace) + continue + } + if deployment != nil { + if isAnExcludedAsset(common.GetDeploymentGlobalIdentifier(deployment), remoteRegistry.ExcludeAssetList) { + log.Infof(LogFormat, event, env, sourceIdentity, clusterId, "Processing skipped as asset is in the exclude list") + return nil + } remoteRegistry.AdmiralCache.IdentityClusterCache.Put(sourceIdentity, rc.ClusterID, rc.ClusterID) serviceInstance = getServiceForDeployment(rc, deployment) if serviceInstance == nil { @@ -117,14 +117,16 @@ func modifyServiceEntryForNewServiceOrPod(ctx context.Context, event admiral.Eve } namespace = deployment.Namespace localMeshPorts := GetMeshPorts(rc.ClusterID, serviceInstance, deployment) - cname = common.GetCname(deployment, common.GetWorkloadIdentifier(), common.GetHostnameSuffix()) sourceDeployments[rc.ClusterID] = deployment createServiceEntry(ctx, event, rc, remoteRegistry.AdmiralCache, localMeshPorts, deployment, serviceEntries) } else if rollout != nil { + if isAnExcludedAsset(common.GetRolloutGlobalIdentifier(rollout), remoteRegistry.ExcludeAssetList) { + log.Infof(LogFormat, event, env, sourceIdentity, clusterId, "Processing skipped as asset is in the exclude list") + return nil + } remoteRegistry.AdmiralCache.IdentityClusterCache.Put(sourceIdentity, rc.ClusterID, rc.ClusterID) weightedServices = getServiceForRollout(ctx, rc, rollout) - if len(weightedServices) == 0 { continue } @@ -136,14 +138,10 @@ func modifyServiceEntryForNewServiceOrPod(ctx context.Context, event admiral.Eve } namespace = rollout.Namespace localMeshPorts := GetMeshPortsForRollout(rc.ClusterID, serviceInstance, rollout) - cname = common.GetCnameForRollout(rollout, common.GetWorkloadIdentifier(), common.GetHostnameSuffix()) cnames[cname] = "1" sourceRollouts[rc.ClusterID] = rollout createServiceEntryForRollout(ctx, event, rc, remoteRegistry.AdmiralCache, localMeshPorts, rollout, serviceEntries) - - } else { - continue } gtpsInNamespace := rc.GlobalTraffic.Cache.Get(gtpKey, namespace) @@ -207,9 +205,8 @@ func modifyServiceEntryForNewServiceOrPod(ctx context.Context, event admiral.Eve if blueGreenStrategy { oldPorts := ep.Ports updateEndpointsForBlueGreen(sourceRollouts[sourceCluster], sourceWeightedServices[sourceCluster], cnames, ep, sourceCluster, key) - - AddServiceEntriesWithDr(ctx, remoteRegistry, map[string]string{sourceCluster: sourceCluster}, - + AddServiceEntriesWithDr( + ctx, remoteRegistry, map[string]string{sourceCluster: sourceCluster}, map[string]*networking.ServiceEntry{key: serviceEntry}) //swap it back to use for next iteration ep.Address = clusterIngress @@ -219,15 +216,15 @@ func modifyServiceEntryForNewServiceOrPod(ctx context.Context, event admiral.Eve //add one endpoint per each service, may be modify var se = copyServiceEntry(serviceEntry) updateEndpointsForWeightedServices(se, sourceWeightedServices[sourceCluster], clusterIngress, meshPorts) - AddServiceEntriesWithDr(ctx, remoteRegistry, map[string]string{sourceCluster: sourceCluster}, - + AddServiceEntriesWithDr( + ctx, remoteRegistry, map[string]string{sourceCluster: sourceCluster}, map[string]*networking.ServiceEntry{key: se}) } else { ep.Address = localFqdn oldPorts := ep.Ports ep.Ports = meshPorts - AddServiceEntriesWithDr(ctx, remoteRegistry, map[string]string{sourceCluster: sourceCluster}, - + AddServiceEntriesWithDr( + ctx, remoteRegistry, map[string]string{sourceCluster: sourceCluster}, map[string]*networking.ServiceEntry{key: serviceEntry}) //swap it back to use for next iteration ep.Address = clusterIngress @@ -238,21 +235,21 @@ func modifyServiceEntryForNewServiceOrPod(ctx context.Context, event admiral.Eve } if common.GetWorkloadSidecarUpdate() == "enabled" { - modifySidecarForLocalClusterCommunication(ctx, serviceInstance.Namespace, remoteRegistry.AdmiralCache.DependencyNamespaceCache.Get(sourceIdentity), rc) + modifySidecarForLocalClusterCommunication( + ctx, serviceInstance.Namespace, + remoteRegistry.AdmiralCache.DependencyNamespaceCache.Get(sourceIdentity), rc) } for _, val := range dependents { - remoteRegistry.AdmiralCache.DependencyNamespaceCache.Put(val, serviceInstance.Namespace, localFqdn, cnames) + remoteRegistry.AdmiralCache.DependencyNamespaceCache.Put( + val, serviceInstance.Namespace, localFqdn, cnames) } - } util.LogElapsedTimeSince("WriteServiceEntryToSourceClusters", sourceIdentity, env, "", start) //Write to dependent clusters - start = time.Now() - dependentClusters := getDependentClusters(dependents, remoteRegistry.AdmiralCache.IdentityClusterCache, sourceServices) //update cname dependent cluster cache @@ -261,9 +258,7 @@ func modifyServiceEntryForNewServiceOrPod(ctx context.Context, event admiral.Eve } AddServiceEntriesWithDr(ctx, remoteRegistry, dependentClusters, serviceEntries) - util.LogElapsedTimeSince("WriteServiceEntryToDependentClusters", sourceIdentity, env, "", start) - return serviceEntries } diff --git a/admiral/pkg/clusters/types.go b/admiral/pkg/clusters/types.go index 9ec59299..c4bfa717 100644 --- a/admiral/pkg/clusters/types.go +++ b/admiral/pkg/clusters/types.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "strings" "sync" "time" @@ -66,6 +67,7 @@ type RemoteRegistry struct { ctx context.Context AdmiralCache *AdmiralCache StartTime time.Time + ExcludeAssetList []string } func NewRemoteRegistry(ctx context.Context, params common.AdmiralParams) *RemoteRegistry { @@ -100,6 +102,7 @@ func NewRemoteRegistry(ctx context.Context, params common.AdmiralParams) *Remote StartTime: time.Now(), remoteControllers: make(map[string]*RemoteController), AdmiralCache: admiralCache, + ExcludeAssetList: params.ExcludeAssetList, } } @@ -436,6 +439,15 @@ func (sh *ServiceHandler) Deleted(ctx context.Context, obj *k8sV1.Service) { } } +func isAnExcludedAsset(assetName string, excludedAssetList []string) bool { + for _, excludedAsset := range excludedAssetList { + if strings.EqualFold(assetName, excludedAsset) { + return true + } + } + return false +} + func HandleEventForService(ctx context.Context, svc *k8sV1.Service, remoteRegistry *RemoteRegistry, clusterName string) error { if svc.Spec.Selector == nil { return fmt.Errorf("selector missing on service=%s in namespace=%s cluster=%s", svc.Name, svc.Namespace, clusterName) @@ -447,9 +459,9 @@ func HandleEventForService(ctx context.Context, svc *k8sV1.Service, remoteRegist deploymentController := rc.DeploymentController rolloutController := rc.RolloutController if deploymentController != nil { - matchingDeployements := deploymentController.GetDeploymentBySelectorInNamespace(ctx, svc.Spec.Selector, svc.Namespace) - if len(matchingDeployements) > 0 { - for _, deployment := range matchingDeployements { + matchingDeployments := deploymentController.GetDeploymentBySelectorInNamespace(ctx, svc.Spec.Selector, svc.Namespace) + if len(matchingDeployments) > 0 { + for _, deployment := range matchingDeployments { HandleEventForDeployment(ctx, admiral.Update, &deployment, remoteRegistry, clusterName) } } @@ -467,31 +479,23 @@ func HandleEventForService(ctx context.Context, svc *k8sV1.Service, remoteRegist } func (dh *DependencyHandler) Added(ctx context.Context, obj *v1.Dependency) { - log.Infof(LogFormat, "Add", "dependency-record", obj.Name, "", "Received=true namespace="+obj.Namespace) - HandleDependencyRecord(ctx, obj, dh.RemoteRegistry) - } func (dh *DependencyHandler) Updated(ctx context.Context, obj *v1.Dependency) { - log.Infof(LogFormat, "Update", "dependency-record", obj.Name, "", "Received=true namespace="+obj.Namespace) - // need clean up before handle it as added, I need to handle update that delete the dependency, find diff first // this is more complex cos want to make sure no other service depend on the same service (which we just removed the dependancy). // need to make sure nothing depend on that before cleaning up the SE for that service HandleDependencyRecord(ctx, obj, dh.RemoteRegistry) - } func HandleDependencyRecord(ctx context.Context, obj *v1.Dependency, remoteRegitry *RemoteRegistry) { sourceIdentity := obj.Spec.Source - if len(sourceIdentity) == 0 { log.Infof(LogFormat, "Event", "dependency-record", obj.Name, "", "No identity found namespace="+obj.Namespace) } - updateIdentityDependencyCache(sourceIdentity, remoteRegitry.AdmiralCache.IdentityDependencyCache, obj) } @@ -547,10 +551,8 @@ func (rh *RolloutHandler) Deleted(ctx context.Context, obj *argo.Rollout) { // HandleEventForRollout helper function to handle add and delete for RolloutHandler func HandleEventForRollout(ctx context.Context, event admiral.EventType, obj *argo.Rollout, remoteRegistry *RemoteRegistry, clusterName string) { - log.Infof(LogFormat, event, "rollout", obj.Name, clusterName, "Received") globalIdentifier := common.GetRolloutGlobalIdentifier(obj) - if len(globalIdentifier) == 0 { log.Infof(LogFormat, "Event", "rollout", obj.Name, clusterName, "Skipped as '"+common.GetWorkloadIdentifier()+" was not found', namespace="+obj.Namespace) return @@ -564,16 +566,12 @@ func HandleEventForRollout(ctx context.Context, event admiral.EventType, obj *ar // helper function to handle add and delete for DeploymentHandler func HandleEventForDeployment(ctx context.Context, event admiral.EventType, obj *k8sAppsV1.Deployment, remoteRegistry *RemoteRegistry, clusterName string) { - globalIdentifier := common.GetDeploymentGlobalIdentifier(obj) - if len(globalIdentifier) == 0 { log.Infof(LogFormat, "Event", "deployment", obj.Name, clusterName, "Skipped as '"+common.GetWorkloadIdentifier()+" was not found', namespace="+obj.Namespace) return } - env := common.GetEnv(obj) - // Use the same function as added deployment function to update and put new service entry in place to replace old one modifyServiceEntryForNewServiceOrPod(ctx, event, env, globalIdentifier, remoteRegistry) } @@ -581,15 +579,11 @@ func HandleEventForDeployment(ctx context.Context, event admiral.EventType, obj // HandleEventForGlobalTrafficPolicy processes all the events related to GTPs func HandleEventForGlobalTrafficPolicy(ctx context.Context, event admiral.EventType, gtp *v1.GlobalTrafficPolicy, remoteRegistry *RemoteRegistry, clusterName string) error { - globalIdentifier := common.GetGtpIdentity(gtp) - if len(globalIdentifier) == 0 { return fmt.Errorf(LogFormat, "Event", "globaltrafficpolicy", gtp.Name, clusterName, "Skipped as '"+common.GetWorkloadIdentifier()+" was not found', namespace="+gtp.Namespace) } - env := common.GetGtpEnv(gtp) - // For now we're going to force all the events to update only in order to prevent // the endpoints from being deleted. // TODO: Need to come up with a way to prevent deleting default endpoints so that this hack can be removed. diff --git a/admiral/pkg/controller/common/types.go b/admiral/pkg/controller/common/types.go index f1e0e9e0..866c99a8 100644 --- a/admiral/pkg/controller/common/types.go +++ b/admiral/pkg/controller/common/types.go @@ -48,9 +48,10 @@ type AdmiralParams struct { AdmiralStateCheckerName string DRStateStoreConfigPath string ServiceEntryIPPrefix string - EnvoyFilterVersion string - EnvoyFilterAdditionalConfig string + EnvoyFilterVersion string + EnvoyFilterAdditionalConfig string EnableRoutingPolicy bool + ExcludeAssetList []string } func (b AdmiralParams) String() string { From 7f5761ded9bb089553e41520139e18974ff6e1cf Mon Sep 17 00:00:00 2001 From: Anubhav Aeron Date: Wed, 31 Aug 2022 09:22:38 -0700 Subject: [PATCH 3/7] add unit tests Signed-off-by: Anubhav Aeron --- admiral/pkg/clusters/serviceentry_test.go | 229 +++++++++++++++------- 1 file changed, 159 insertions(+), 70 deletions(-) diff --git a/admiral/pkg/clusters/serviceentry_test.go b/admiral/pkg/clusters/serviceentry_test.go index 7558f3c6..5812d3c6 100644 --- a/admiral/pkg/clusters/serviceentry_test.go +++ b/admiral/pkg/clusters/serviceentry_test.go @@ -22,7 +22,7 @@ import ( "github.com/stretchr/testify/assert" "google.golang.org/protobuf/testing/protocmp" "gopkg.in/yaml.v2" - istionetworkingv1alpha3 "istio.io/api/networking/v1alpha3" + istioNetworkingV1Alpha3 "istio.io/api/networking/v1alpha3" "istio.io/client-go/pkg/apis/networking/v1alpha3" istiofake "istio.io/client-go/pkg/clientset/versioned/fake" v14 "k8s.io/api/apps/v1" @@ -53,6 +53,95 @@ func init() { common.InitializeConfig(p) } +func TestModifyServiceEntryForNewServiceOrPodForExcludedAsset(t *testing.T) { + var ( + clusterID = "test" + p = common.AdmiralParams{ + KubeconfigPath: "testdata/fake.config", + } + rr1, _ = InitAdmiral(context.Background(), p) + config = rest.Config{ + Host: "localhost", + } + ) + rr1.ExcludeAssetList = []string{"asset1"} + deploymentController, err := admiral.NewDeploymentController(clusterID, make(chan struct{}), &test.MockDeploymentHandler{}, &config, time.Second*time.Duration(300)) + if err != nil { + t.Fail() + } + rolloutController, err := admiral.NewRolloutsController(clusterID, make(chan struct{}), &test.MockRolloutHandler{}, &config, time.Second*time.Duration(300)) + if err != nil { + t.Fail() + } + rc := &RemoteController{ + DeploymentController: deploymentController, + RolloutController: rolloutController, + } + rr1.PutRemoteController(clusterID, rc) + serviceEntries := modifyServiceEntryForNewServiceOrPod(context.Background(), admiral.Add, "test", "asset1", rr1) + if serviceEntries != nil { + t.Fatalf("expected service entries to be: %v, but got: %v", nil, serviceEntries) + } +} + +/* +func TestModifyServiceEntryForNewServiceOrPodForExcludedAsset(t *testing.T) { + var ( + clusterID = "test" + p = common.AdmiralParams{ + KubeconfigPath: "testdata/fake.config", + } + rr1, _ = InitAdmiral(context.Background(), p) + rr2, _ = InitAdmiral(context.Background(), p) + config = rest.Config{ + Host: "localhost", + } + ) + rr1.ExcludeAssetList = []string{"asset1"} + deploymentController, err := admiral.NewDeploymentController(clusterID, make(chan struct{}), &test.MockDeploymentHandler{}, &config, time.Second*time.Duration(300)) + if err != nil { + t.Fail() + } + rolloutController, err := admiral.NewRolloutsController(clusterID, make(chan struct{}), &test.MockRolloutHandler{}, &config, time.Second*time.Duration(300)) + if err != nil { + t.Fail() + } + rc := &RemoteController{ + DeploymentController: deploymentController, + RolloutController: rolloutController, + } + rr1.PutRemoteController(clusterID, rc) + rr2.PutRemoteController(clusterID, rc) + testCases := []struct { + name string + assetIdentity string + remoteRegistry *RemoteRegistry + expectedServiceEntries map[string]*istioNetworkingV1Alpha3.ServiceEntry + }{ + { + name: "when asset is in the exclude list", + assetIdentity: "asset1", + remoteRegistry: rr1, + expectedServiceEntries: nil, + }, + { + name: "when asset is NOT in the exclude list", + assetIdentity: "bar", + remoteRegistry: rr2, + expectedServiceEntries: nil, + }, + } + for _, c := range testCases { + t.Run(c.name, func(t *testing.T) { + serviceEntries := modifyServiceEntryForNewServiceOrPod(context.Background(), admiral.Add, "test", c.assetIdentity, c.remoteRegistry) + if !reflect.DeepEqual(serviceEntries, c.expectedServiceEntries) { + t.Fatalf("expected service entries to be: %v, but got: %v", c.expectedServiceEntries, serviceEntries) + } + }) + } +} +*/ + func TestAddServiceEntriesWithDr(t *testing.T) { admiralCache := AdmiralCache{} @@ -67,16 +156,16 @@ func TestAddServiceEntriesWithDr(t *testing.T) { gtpCache.mutex = &sync.Mutex{} admiralCache.GlobalTrafficCache = gtpCache - se := istionetworkingv1alpha3.ServiceEntry{ + se := istioNetworkingV1Alpha3.ServiceEntry{ Hosts: []string{"dev.bar.global"}, - Endpoints: []*istionetworkingv1alpha3.WorkloadEntry{ + Endpoints: []*istioNetworkingV1Alpha3.WorkloadEntry{ {Address: "127.0.0.1", Ports: map[string]uint32{"https": 80}, Labels: map[string]string{}, Network: "mesh1", Locality: "us-west", Weight: 100}, }, } - emptyEndpointSe := istionetworkingv1alpha3.ServiceEntry{ + emptyEndpointSe := istioNetworkingV1Alpha3.ServiceEntry{ Hosts: []string{"dev.bar.global"}, - Endpoints: []*istionetworkingv1alpha3.WorkloadEntry{}, + Endpoints: []*istioNetworkingV1Alpha3.WorkloadEntry{}, } seConfig := v1alpha3.ServiceEntry{ @@ -106,8 +195,8 @@ func TestAddServiceEntriesWithDr(t *testing.T) { rr := NewRemoteRegistry(nil, common.AdmiralParams{}) rr.PutRemoteController("c1", rc) rr.AdmiralCache = &admiralCache - AddServiceEntriesWithDr(ctx, rr, map[string]string{"cl1": "cl1"}, map[string]*istionetworkingv1alpha3.ServiceEntry{"se1": &se}) - AddServiceEntriesWithDr(ctx, rr, map[string]string{"cl1": "cl1"}, map[string]*istionetworkingv1alpha3.ServiceEntry{"se1": &emptyEndpointSe}) + AddServiceEntriesWithDr(ctx, rr, map[string]string{"cl1": "cl1"}, map[string]*istioNetworkingV1Alpha3.ServiceEntry{"se1": &se}) + AddServiceEntriesWithDr(ctx, rr, map[string]string{"cl1": "cl1"}, map[string]*istioNetworkingV1Alpha3.ServiceEntry{"se1": &emptyEndpointSe}) } func TestCreateSeAndDrSetFromGtp(t *testing.T) { @@ -137,10 +226,10 @@ func TestCreateSeAndDrSetFromGtp(t *testing.T) { admiralCache.ConfigMapController = cacheController - se := &istionetworkingv1alpha3.ServiceEntry{ + se := &istioNetworkingV1Alpha3.ServiceEntry{ Addresses: []string{"240.10.1.0"}, Hosts: []string{host}, - Endpoints: []*istionetworkingv1alpha3.WorkloadEntry{ + Endpoints: []*istioNetworkingV1Alpha3.WorkloadEntry{ {Address: "127.0.0.1", Ports: map[string]uint32{"https": 80}, Labels: map[string]string{}, Locality: "us-west-2"}, {Address: "240.20.0.1", Ports: map[string]uint32{"https": 80}, Labels: map[string]string{}, Locality: "us-east-2"}, }, @@ -204,7 +293,7 @@ func TestCreateSeAndDrSetFromGtp(t *testing.T) { name string env string locality string - se *istionetworkingv1alpha3.ServiceEntry + se *istioNetworkingV1Alpha3.ServiceEntry gtp *v13.GlobalTrafficPolicy seDrSet map[string]*SeDrTuple }{ @@ -512,12 +601,12 @@ func TestModifyExistingSidecarForLocalClusterCommunication(t *testing.T) { existingSidecarObj.ObjectMeta.Namespace = "test-sidecar-namespace" existingSidecarObj.ObjectMeta.Name = "default" - istioEgress := istionetworkingv1alpha3.IstioEgressListener{ + istioEgress := istioNetworkingV1Alpha3.IstioEgressListener{ Hosts: []string{"test-host"}, } - existingSidecarObj.Spec = istionetworkingv1alpha3.Sidecar{ - Egress: []*istionetworkingv1alpha3.IstioEgressListener{&istioEgress}, + existingSidecarObj.Spec = istioNetworkingV1Alpha3.Sidecar{ + Egress: []*istioNetworkingV1Alpha3.IstioEgressListener{&istioEgress}, } ctx := context.Background() @@ -549,7 +638,7 @@ func TestModifyExistingSidecarForLocalClusterCommunication(t *testing.T) { if !cmp.Equal(updatedSidecar, createdSidecar, protocmp.Transform()) { t.Fatalf("Modify existing sidecar failed as configuration is not same. Details - %v", cmp.Diff(updatedSidecar, createdSidecar)) } - var matched *istionetworkingv1alpha3.IstioEgressListener + var matched *istioNetworkingV1Alpha3.IstioEgressListener for _, listener := range createdSidecarEgress { matched = nil @@ -640,93 +729,93 @@ func TestCreateServiceEntry(t *testing.T) { secondDeployment := v14.Deployment{} secondDeployment.Spec.Template.Labels = map[string]string{"env": "e2e", "identity": "my-first-service"} - se := istionetworkingv1alpha3.ServiceEntry{ + se := istioNetworkingV1Alpha3.ServiceEntry{ Hosts: []string{"e2e.my-first-service.mesh"}, Addresses: []string{localAddress}, - Ports: []*istionetworkingv1alpha3.Port{{Number: uint32(common.DefaultServiceEntryPort), + Ports: []*istioNetworkingV1Alpha3.Port{{Number: uint32(common.DefaultServiceEntryPort), Name: "http", Protocol: "http"}}, - Location: istionetworkingv1alpha3.ServiceEntry_MESH_INTERNAL, - Resolution: istionetworkingv1alpha3.ServiceEntry_DNS, + Location: istioNetworkingV1Alpha3.ServiceEntry_MESH_INTERNAL, + Resolution: istioNetworkingV1Alpha3.ServiceEntry_DNS, SubjectAltNames: []string{"spiffe://prefix/my-first-service"}, - Endpoints: []*istionetworkingv1alpha3.WorkloadEntry{ + Endpoints: []*istioNetworkingV1Alpha3.WorkloadEntry{ {Address: "dummy.admiral.global", Ports: map[string]uint32{"http": 0}, Locality: "us-west-2"}, }, } - oneEndpointSe := istionetworkingv1alpha3.ServiceEntry{ + oneEndpointSe := istioNetworkingV1Alpha3.ServiceEntry{ Hosts: []string{"e2e.my-first-service.mesh"}, Addresses: []string{localAddress}, - Ports: []*istionetworkingv1alpha3.Port{{Number: uint32(common.DefaultServiceEntryPort), + Ports: []*istioNetworkingV1Alpha3.Port{{Number: uint32(common.DefaultServiceEntryPort), Name: "http", Protocol: "http"}}, - Location: istionetworkingv1alpha3.ServiceEntry_MESH_INTERNAL, - Resolution: istionetworkingv1alpha3.ServiceEntry_DNS, + Location: istioNetworkingV1Alpha3.ServiceEntry_MESH_INTERNAL, + Resolution: istioNetworkingV1Alpha3.ServiceEntry_DNS, SubjectAltNames: []string{"spiffe://prefix/my-first-service"}, - Endpoints: []*istionetworkingv1alpha3.WorkloadEntry{ + Endpoints: []*istioNetworkingV1Alpha3.WorkloadEntry{ {Address: "dummy.admiral.global", Ports: map[string]uint32{"http": 0}, Locality: "us-west-2"}, }, } - twoEndpointSe := istionetworkingv1alpha3.ServiceEntry{ + twoEndpointSe := istioNetworkingV1Alpha3.ServiceEntry{ Hosts: []string{"e2e.my-first-service.mesh"}, Addresses: []string{localAddress}, - Ports: []*istionetworkingv1alpha3.Port{{Number: uint32(common.DefaultServiceEntryPort), + Ports: []*istioNetworkingV1Alpha3.Port{{Number: uint32(common.DefaultServiceEntryPort), Name: "http", Protocol: "http"}}, - Location: istionetworkingv1alpha3.ServiceEntry_MESH_INTERNAL, - Resolution: istionetworkingv1alpha3.ServiceEntry_DNS, + Location: istioNetworkingV1Alpha3.ServiceEntry_MESH_INTERNAL, + Resolution: istioNetworkingV1Alpha3.ServiceEntry_DNS, SubjectAltNames: []string{"spiffe://prefix/my-first-service"}, - Endpoints: []*istionetworkingv1alpha3.WorkloadEntry{ + Endpoints: []*istioNetworkingV1Alpha3.WorkloadEntry{ {Address: "dummy.admiral.global", Ports: map[string]uint32{"http": 0}, Locality: "us-west-2"}, {Address: "dummy.admiral.global", Ports: map[string]uint32{"http": 0}, Locality: "us-east-2"}, }, } - threeEndpointSe := istionetworkingv1alpha3.ServiceEntry{ + threeEndpointSe := istioNetworkingV1Alpha3.ServiceEntry{ Hosts: []string{"e2e.my-first-service.mesh"}, Addresses: []string{localAddress}, - Ports: []*istionetworkingv1alpha3.Port{{Number: uint32(common.DefaultServiceEntryPort), + Ports: []*istioNetworkingV1Alpha3.Port{{Number: uint32(common.DefaultServiceEntryPort), Name: "http", Protocol: "http"}}, - Location: istionetworkingv1alpha3.ServiceEntry_MESH_INTERNAL, - Resolution: istionetworkingv1alpha3.ServiceEntry_DNS, + Location: istioNetworkingV1Alpha3.ServiceEntry_MESH_INTERNAL, + Resolution: istioNetworkingV1Alpha3.ServiceEntry_DNS, SubjectAltNames: []string{"spiffe://prefix/my-first-service"}, - Endpoints: []*istionetworkingv1alpha3.WorkloadEntry{ + Endpoints: []*istioNetworkingV1Alpha3.WorkloadEntry{ {Address: "dummy.admiral.global", Ports: map[string]uint32{"http": 0}, Locality: "us-west-2"}, {Address: "dummy.admiral.global", Ports: map[string]uint32{"http": 0}, Locality: "us-west-2"}, {Address: "dummy.admiral.global", Ports: map[string]uint32{"http": 0}, Locality: "us-east-2"}, }, } - eastEndpointSe := istionetworkingv1alpha3.ServiceEntry{ + eastEndpointSe := istioNetworkingV1Alpha3.ServiceEntry{ Hosts: []string{"e2e.my-first-service.mesh"}, Addresses: []string{localAddress}, - Ports: []*istionetworkingv1alpha3.Port{{Number: uint32(common.DefaultServiceEntryPort), + Ports: []*istioNetworkingV1Alpha3.Port{{Number: uint32(common.DefaultServiceEntryPort), Name: "http", Protocol: "http"}}, - Location: istionetworkingv1alpha3.ServiceEntry_MESH_INTERNAL, - Resolution: istionetworkingv1alpha3.ServiceEntry_DNS, + Location: istioNetworkingV1Alpha3.ServiceEntry_MESH_INTERNAL, + Resolution: istioNetworkingV1Alpha3.ServiceEntry_DNS, SubjectAltNames: []string{"spiffe://prefix/my-first-service"}, - Endpoints: []*istionetworkingv1alpha3.WorkloadEntry{ + Endpoints: []*istioNetworkingV1Alpha3.WorkloadEntry{ {Address: "dummy.admiral.global", Ports: map[string]uint32{"http": 0}, Locality: "us-east-2"}, }, } - emptyEndpointSe := istionetworkingv1alpha3.ServiceEntry{ + emptyEndpointSe := istioNetworkingV1Alpha3.ServiceEntry{ Hosts: []string{"e2e.my-first-service.mesh"}, Addresses: []string{localAddress}, - Ports: []*istionetworkingv1alpha3.Port{{Number: uint32(common.DefaultServiceEntryPort), + Ports: []*istioNetworkingV1Alpha3.Port{{Number: uint32(common.DefaultServiceEntryPort), Name: "http", Protocol: "http"}}, - Location: istionetworkingv1alpha3.ServiceEntry_MESH_INTERNAL, - Resolution: istionetworkingv1alpha3.ServiceEntry_DNS, + Location: istioNetworkingV1Alpha3.ServiceEntry_MESH_INTERNAL, + Resolution: istioNetworkingV1Alpha3.ServiceEntry_DNS, SubjectAltNames: []string{"spiffe://prefix/my-first-service"}, - Endpoints: []*istionetworkingv1alpha3.WorkloadEntry{}, + Endpoints: []*istioNetworkingV1Alpha3.WorkloadEntry{}, } - grpcSe := istionetworkingv1alpha3.ServiceEntry{ + grpcSe := istioNetworkingV1Alpha3.ServiceEntry{ Hosts: []string{"e2e.my-first-service.mesh"}, Addresses: []string{localAddress}, - Ports: []*istionetworkingv1alpha3.Port{{Number: uint32(common.DefaultServiceEntryPort), + Ports: []*istioNetworkingV1Alpha3.Port{{Number: uint32(common.DefaultServiceEntryPort), Name: "grpc", Protocol: "grpc"}}, - Location: istionetworkingv1alpha3.ServiceEntry_MESH_INTERNAL, - Resolution: istionetworkingv1alpha3.ServiceEntry_DNS, + Location: istioNetworkingV1Alpha3.ServiceEntry_MESH_INTERNAL, + Resolution: istioNetworkingV1Alpha3.ServiceEntry_DNS, SubjectAltNames: []string{"spiffe://prefix/my-first-service"}, - Endpoints: []*istionetworkingv1alpha3.WorkloadEntry{ + Endpoints: []*istioNetworkingV1Alpha3.WorkloadEntry{ {Address: "dummy.admiral.global", Ports: map[string]uint32{"grpc": 0}, Locality: "us-west-2"}, }, } @@ -738,8 +827,8 @@ func TestCreateServiceEntry(t *testing.T) { admiralCache AdmiralCache meshPorts map[string]uint32 deployment v14.Deployment - serviceEntries map[string]*istionetworkingv1alpha3.ServiceEntry - expectedResult *istionetworkingv1alpha3.ServiceEntry + serviceEntries map[string]*istioNetworkingV1Alpha3.ServiceEntry + expectedResult *istioNetworkingV1Alpha3.ServiceEntry }{ { name: "Should return a created service entry with grpc protocol", @@ -748,7 +837,7 @@ func TestCreateServiceEntry(t *testing.T) { admiralCache: admiralCache, meshPorts: map[string]uint32{"grpc": uint32(80)}, deployment: deployment, - serviceEntries: map[string]*istionetworkingv1alpha3.ServiceEntry{}, + serviceEntries: map[string]*istioNetworkingV1Alpha3.ServiceEntry{}, expectedResult: &grpcSe, }, { @@ -758,7 +847,7 @@ func TestCreateServiceEntry(t *testing.T) { admiralCache: admiralCache, meshPorts: map[string]uint32{"http": uint32(80)}, deployment: deployment, - serviceEntries: map[string]*istionetworkingv1alpha3.ServiceEntry{}, + serviceEntries: map[string]*istioNetworkingV1Alpha3.ServiceEntry{}, expectedResult: &se, }, { @@ -768,7 +857,7 @@ func TestCreateServiceEntry(t *testing.T) { admiralCache: admiralCache, meshPorts: map[string]uint32{"http": uint32(80)}, deployment: deployment, - serviceEntries: map[string]*istionetworkingv1alpha3.ServiceEntry{ + serviceEntries: map[string]*istioNetworkingV1Alpha3.ServiceEntry{ "e2e.my-first-service.mesh": &oneEndpointSe, }, expectedResult: &emptyEndpointSe, @@ -780,7 +869,7 @@ func TestCreateServiceEntry(t *testing.T) { admiralCache: admiralCache, meshPorts: map[string]uint32{"http": uint32(80)}, deployment: deployment, - serviceEntries: map[string]*istionetworkingv1alpha3.ServiceEntry{ + serviceEntries: map[string]*istioNetworkingV1Alpha3.ServiceEntry{ "e2e.my-first-service.mesh": &twoEndpointSe, }, expectedResult: &eastEndpointSe, @@ -792,7 +881,7 @@ func TestCreateServiceEntry(t *testing.T) { admiralCache: admiralCache, meshPorts: map[string]uint32{"http": uint32(80)}, deployment: deployment, - serviceEntries: map[string]*istionetworkingv1alpha3.ServiceEntry{ + serviceEntries: map[string]*istioNetworkingV1Alpha3.ServiceEntry{ "e2e.my-first-service.mesh": &threeEndpointSe, }, expectedResult: &eastEndpointSe, @@ -804,7 +893,7 @@ func TestCreateServiceEntry(t *testing.T) { //Run the test for every provided case for _, c := range deploymentSeCreationTestCases { t.Run(c.name, func(t *testing.T) { - var createdSE *istionetworkingv1alpha3.ServiceEntry + var createdSE *istioNetworkingV1Alpha3.ServiceEntry createdSE = createServiceEntry(ctx, c.action, c.rc, &c.admiralCache, c.meshPorts, &c.deployment, c.serviceEntries) if !reflect.DeepEqual(createdSE, c.expectedResult) { t.Errorf("Test %s failed, expected: %v got %v", c.name, c.expectedResult, createdSE) @@ -822,7 +911,7 @@ func TestCreateServiceEntry(t *testing.T) { admiralCache AdmiralCache meshPorts map[string]uint32 rollout argo.Rollout - expectedResult *istionetworkingv1alpha3.ServiceEntry + expectedResult *istioNetworkingV1Alpha3.ServiceEntry }{ { name: "Should return a created service entry with grpc protocol", @@ -845,7 +934,7 @@ func TestCreateServiceEntry(t *testing.T) { //Run the test for every provided case for _, c := range rolloutSeCreationTestCases { t.Run(c.name, func(t *testing.T) { - createdSE := createServiceEntryForRollout(ctx, admiral.Add, c.rc, &c.admiralCache, c.meshPorts, &c.rollout, map[string]*istionetworkingv1alpha3.ServiceEntry{}) + createdSE := createServiceEntryForRollout(ctx, admiral.Add, c.rc, &c.admiralCache, c.meshPorts, &c.rollout, map[string]*istioNetworkingV1Alpha3.ServiceEntry{}) if !reflect.DeepEqual(createdSE, c.expectedResult) { t.Errorf("Test %s failed, expected: %v got %v", c.name, c.expectedResult, createdSE) } @@ -1183,7 +1272,7 @@ func TestUpdateEndpointsForBlueGreen(t *testing.T) { rollout.Spec.Template.Annotations = map[string]string{} rollout.Spec.Template.Annotations[common.SidecarEnabledPorts] = "8080" - endpoint := &istionetworkingv1alpha3.WorkloadEntry{ + endpoint := &istioNetworkingV1Alpha3.WorkloadEntry{ Labels: map[string]string{}, Address: CLUSTER_INGRESS_1, Ports: map[string]uint32{"http": 15443}, } @@ -1194,23 +1283,23 @@ func TestUpdateEndpointsForBlueGreen(t *testing.T) { PREVIEW_SERVICE: {Service: &v1.Service{ObjectMeta: v12.ObjectMeta{Name: PREVIEW_SERVICE, Namespace: NAMESPACE}}}, } - activeWantedEndpoints := &istionetworkingv1alpha3.WorkloadEntry{ + activeWantedEndpoints := &istioNetworkingV1Alpha3.WorkloadEntry{ Address: ACTIVE_SERVICE + common.Sep + NAMESPACE + common.DotLocalDomainSuffix, Ports: meshPorts, } - previewWantedEndpoints := &istionetworkingv1alpha3.WorkloadEntry{ + previewWantedEndpoints := &istioNetworkingV1Alpha3.WorkloadEntry{ Address: PREVIEW_SERVICE + common.Sep + NAMESPACE + common.DotLocalDomainSuffix, Ports: meshPorts, } testCases := []struct { name string rollout *argo.Rollout - inputEndpoint *istionetworkingv1alpha3.WorkloadEntry + inputEndpoint *istioNetworkingV1Alpha3.WorkloadEntry weightedServices map[string]*WeightedService clusterIngress string meshPorts map[string]uint32 meshHost string - wantedEndpoints *istionetworkingv1alpha3.WorkloadEntry + wantedEndpoints *istioNetworkingV1Alpha3.WorkloadEntry }{ { name: "should return endpoint with active service address", @@ -1251,8 +1340,8 @@ func TestUpdateEndpointsForWeightedServices(t *testing.T) { const STABLE_SERVICE = "stableService" const NAMESPACE = "namespace" - se := &istionetworkingv1alpha3.ServiceEntry{ - Endpoints: []*istionetworkingv1alpha3.WorkloadEntry{ + se := &istioNetworkingV1Alpha3.ServiceEntry{ + Endpoints: []*istioNetworkingV1Alpha3.WorkloadEntry{ {Labels: map[string]string{}, Address: CLUSTER_INGRESS_1, Weight: 10, Ports: map[string]uint32{"http": 15443}}, {Labels: map[string]string{}, Address: CLUSTER_INGRESS_2, Weight: 10, Ports: map[string]uint32{"http": 15443}}, }, @@ -1269,24 +1358,24 @@ func TestUpdateEndpointsForWeightedServices(t *testing.T) { STABLE_SERVICE: {Weight: 100, Service: &v1.Service{ObjectMeta: v12.ObjectMeta{Name: STABLE_SERVICE, Namespace: NAMESPACE}}}, } - wantedEndpoints := []*istionetworkingv1alpha3.WorkloadEntry{ + wantedEndpoints := []*istioNetworkingV1Alpha3.WorkloadEntry{ {Address: CLUSTER_INGRESS_2, Weight: 10, Ports: map[string]uint32{"http": 15443}}, {Address: STABLE_SERVICE + common.Sep + NAMESPACE + common.DotLocalDomainSuffix, Weight: 90, Ports: meshPorts}, {Address: CANARY_SERVICE + common.Sep + NAMESPACE + common.DotLocalDomainSuffix, Weight: 10, Ports: meshPorts}, } - wantedEndpointsZeroWeights := []*istionetworkingv1alpha3.WorkloadEntry{ + wantedEndpointsZeroWeights := []*istioNetworkingV1Alpha3.WorkloadEntry{ {Address: CLUSTER_INGRESS_2, Weight: 10, Ports: map[string]uint32{"http": 15443}}, {Address: STABLE_SERVICE + common.Sep + NAMESPACE + common.DotLocalDomainSuffix, Weight: 100, Ports: meshPorts}, } testCases := []struct { name string - inputServiceEntry *istionetworkingv1alpha3.ServiceEntry + inputServiceEntry *istioNetworkingV1Alpha3.ServiceEntry weightedServices map[string]*WeightedService clusterIngress string meshPorts map[string]uint32 - wantedEndpoints []*istionetworkingv1alpha3.WorkloadEntry + wantedEndpoints []*istioNetworkingV1Alpha3.WorkloadEntry }{ { name: "should return endpoints with assigned weights", From 5e10fa5c95d6d5736a2332aa7589cd12436c83e5 Mon Sep 17 00:00:00 2001 From: Anubhav Aeron Date: Fri, 2 Sep 2022 08:48:47 -0700 Subject: [PATCH 4/7] update init function in test files to be unique Signed-off-by: Anubhav Aeron --- admiral/pkg/clusters/registry_test.go | 178 +++--- admiral/pkg/clusters/serviceentry_test.go | 558 ++++++++++-------- admiral/pkg/clusters/types_test.go | 53 +- admiral/pkg/clusters/util.go | 13 +- .../pkg/controller/common/rolloutcommon.go | 7 +- 5 files changed, 427 insertions(+), 382 deletions(-) diff --git a/admiral/pkg/clusters/registry_test.go b/admiral/pkg/clusters/registry_test.go index fa7c662b..7bb94fdd 100644 --- a/admiral/pkg/clusters/registry_test.go +++ b/admiral/pkg/clusters/registry_test.go @@ -3,6 +3,7 @@ package clusters import ( "context" "strings" + "sync" "testing" "time" @@ -23,61 +24,59 @@ import ( "k8s.io/client-go/tools/clientcmd" ) -func init() { - p := common.AdmiralParams{ - KubeconfigPath: "testdata/fake.config", - LabelSet: &common.LabelSet{}, - EnableSAN: true, - SANPrefix: "prefix", - HostnameSuffix: "mesh", - SyncNamespace: "ns", - CacheRefreshDuration: time.Minute, - ClusterRegistriesNamespace: "default", - DependenciesNamespace: "default", - SecretResolver: "", - WorkloadSidecarUpdate: "enabled", - WorkloadSidecarName: "default", - EnableRoutingPolicy: true, - EnvoyFilterVersion: "1.13", - } - - p.LabelSet.WorkloadIdentityKey = "identity" - p.LabelSet.GlobalTrafficDeploymentLabel = "identity" - p.LabelSet.PriorityKey = "priority" - p.LabelSet.EnvKey = "admiral.io/env" - - common.InitializeConfig(p) +var registryTestSingleton sync.Once + +func setupForRegistryTests() { + registryTestSingleton.Do(func() { + p := common.AdmiralParams{ + KubeconfigPath: "testdata/fake.config", + LabelSet: &common.LabelSet{}, + EnableSAN: true, + SANPrefix: "prefix", + HostnameSuffix: "mesh", + SyncNamespace: "ns", + CacheRefreshDuration: time.Minute, + ClusterRegistriesNamespace: "default", + DependenciesNamespace: "default", + SecretResolver: "", + WorkloadSidecarUpdate: "enabled", + WorkloadSidecarName: "default", + EnableRoutingPolicy: true, + EnvoyFilterVersion: "1.13", + } + p.LabelSet.WorkloadIdentityKey = "identity" + p.LabelSet.GlobalTrafficDeploymentLabel = "identity" + p.LabelSet.PriorityKey = "priority" + p.LabelSet.EnvKey = "admiral.io/env" + common.InitializeConfig(p) + }) } func TestDeleteCacheControllerThatDoesntExist(t *testing.T) { - + setupForRegistryTests() w := NewRemoteRegistry(nil, common.AdmiralParams{}) - err := w.deleteCacheController("I don't exit") - if err != nil { t.Fail() } } func TestDeleteCacheController(t *testing.T) { - - w := NewRemoteRegistry(nil, common.AdmiralParams{}) - - r := rest.Config{ - Host: "test.com", - } - - cluster := "test.cluster" + setupForRegistryTests() + var ( + cluster = "test.cluster" + w = NewRemoteRegistry(context.TODO(), common.AdmiralParams{}) + r = rest.Config{ + Host: "test.com", + } + ) w.createCacheController(&r, cluster, time.Second*time.Duration(300)) rc := w.GetRemoteController(cluster) - if rc == nil { t.Fail() } err := w.deleteCacheController(cluster) - if err != nil { t.Fail() } @@ -89,54 +88,56 @@ func TestDeleteCacheController(t *testing.T) { } func TestCopyServiceEntry(t *testing.T) { - - se := networking.ServiceEntry{ - Hosts: []string{"test.com"}, - } - - r := copyServiceEntry(&se) - + setupForRegistryTests() + var ( + se = networking.ServiceEntry{ + Hosts: []string{"test.com"}, + } + r = copyServiceEntry(&se) + ) if r.Hosts[0] != "test.com" { t.Fail() } } func TestCopyEndpoint(t *testing.T) { - - se := networking.WorkloadEntry{ - Address: "127.0.0.1", - } - - r := copyEndpoint(&se) - + var ( + se = networking.WorkloadEntry{ + Address: "127.0.0.1", + } + r = copyEndpoint(&se) + ) + setupForRegistryTests() if r.Address != "127.0.0.1" { t.Fail() } - } func TestCopySidecar(t *testing.T) { - spec := networking.Sidecar{ - WorkloadSelector: &networking.WorkloadSelector{ - Labels: map[string]string{"TestLabel": "TestValue"}, - }, - } - - //nolint - sidecar := v1alpha3.Sidecar{Spec: spec} - - newSidecar := copySidecar(&sidecar) - + setupForRegistryTests() + var ( + spec = networking.Sidecar{ + WorkloadSelector: &networking.WorkloadSelector{ + Labels: map[string]string{"TestLabel": "TestValue"}, + }, + } + //nolint + sidecar = v1alpha3.Sidecar{Spec: spec} + newSidecar = copySidecar(&sidecar) + ) if newSidecar.Spec.WorkloadSelector != spec.WorkloadSelector { t.Fail() } } func createMockRemoteController(f func(interface{})) (*RemoteController, error) { - config := rest.Config{ - Host: "localhost", - } - stop := make(chan struct{}) + var ( + config = rest.Config{ + Host: "localhost", + } + stop = make(chan struct{}) + ) + d, err := admiral.NewDeploymentController("", stop, &test.MockDeploymentHandler{}, &config, time.Second*time.Duration(300)) if err != nil { return nil, err @@ -202,83 +203,72 @@ func createMockRemoteController(f func(interface{})) (*RemoteController, error) } func TestCreateSecretController(t *testing.T) { - + setupForRegistryTests() err := createSecretController(context.Background(), NewRemoteRegistry(nil, common.AdmiralParams{})) - if err != nil { t.Fail() } - common.SetKubeconfigPath("fail") - err = createSecretController(context.Background(), NewRemoteRegistry(nil, common.AdmiralParams{})) - - common.SetKubeconfigPath("testdata/fake.config") - if err == nil { t.Fail() } + common.SetKubeconfigPath("testdata/fake.config") } func TestInitAdmiral(t *testing.T) { - + setupForRegistryTests() p := common.AdmiralParams{ KubeconfigPath: "testdata/fake.config", LabelSet: &common.LabelSet{}, } - p.LabelSet.WorkloadIdentityKey = "overridden-key" - rr, err := InitAdmiral(context.Background(), p) - if err != nil { t.Fail() } if len(rr.GetClusterIds()) != 0 { t.Fail() } - if common.GetWorkloadIdentifier() != "identity" { t.Errorf("Workload identity label override failed. Expected \"identity\", got %v", common.GetWorkloadIdentifier()) } } func TestAdded(t *testing.T) { - ctx := context.Background() - p := common.AdmiralParams{ - KubeconfigPath: "testdata/fake.config", - } - rr, _ := InitAdmiral(context.Background(), p) - + setupForRegistryTests() + var ( + ctx = context.Background() + p = common.AdmiralParams{ + KubeconfigPath: "testdata/fake.config", + } + rr, _ = InitAdmiral(context.Background(), p) + ) rc, _ := createMockRemoteController(func(i interface{}) { t.Fail() }) rr.PutRemoteController("test.cluster", rc) - d, e := admiral.NewDependencyController(make(chan struct{}), &test.MockDependencyHandler{}, p.KubeconfigPath, "dep-ns", time.Second*time.Duration(300)) - - if e != nil { + d, err := admiral.NewDependencyController(make(chan struct{}), &test.MockDependencyHandler{}, p.KubeconfigPath, "dep-ns", time.Second*time.Duration(300)) + if err != nil { t.Fail() } - dh := DependencyHandler{ RemoteRegistry: rr, DepController: d, } - depData := v1.Dependency{ Spec: depModel.Dependency{ - IdentityLabel: "idenity", + IdentityLabel: "identity", Destinations: []string{"one", "two"}, Source: "bar", }, } - dh.Added(ctx, &depData) dh.Deleted(ctx, &depData) - } func TestGetServiceForDeployment(t *testing.T) { + setupForRegistryTests() baseRc, _ := createMockRemoteController(func(i interface{}) { //res := i.(istio.Config) //se, ok := res.Spec.(*v1alpha3.ServiceEntry) @@ -298,7 +288,6 @@ func TestGetServiceForDeployment(t *testing.T) { // } //} }) - service := k8sCoreV1.Service{} service.Namespace = "under-test" service.Spec.Ports = []k8sCoreV1.ServicePort{ @@ -364,6 +353,7 @@ func TestGetServiceForDeployment(t *testing.T) { } func TestUpdateCacheController(t *testing.T) { + setupForRegistryTests() p := common.AdmiralParams{ KubeconfigPath: "testdata/fake.config", } diff --git a/admiral/pkg/clusters/serviceentry_test.go b/admiral/pkg/clusters/serviceentry_test.go index 5812d3c6..5f4035e1 100644 --- a/admiral/pkg/clusters/serviceentry_test.go +++ b/admiral/pkg/clusters/serviceentry_test.go @@ -28,76 +28,102 @@ import ( v14 "k8s.io/api/apps/v1" coreV1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" v12 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/rest" ) -func init() { - p := common.AdmiralParams{ - KubeconfigPath: "testdata/fake.config", - LabelSet: &common.LabelSet{}, - EnableSAN: true, - SANPrefix: "prefix", - HostnameSuffix: "mesh", - SyncNamespace: "ns", - CacheRefreshDuration: time.Minute, - ClusterRegistriesNamespace: "default", - DependenciesNamespace: "default", - SecretResolver: "", - } - - p.LabelSet.WorkloadIdentityKey = "identity" - p.LabelSet.GlobalTrafficDeploymentLabel = "identity" - p.LabelSet.PriorityKey = "priority" - - common.InitializeConfig(p) +var serviceEntryTestSingleton sync.Once + +func setupForServiceEntryTests() { + serviceEntryTestSingleton.Do(func() { + p := common.AdmiralParams{ + KubeconfigPath: "testdata/fake.config", + LabelSet: &common.LabelSet{}, + EnableSAN: true, + SANPrefix: "prefix", + HostnameSuffix: "mesh", + SyncNamespace: "ns", + CacheRefreshDuration: 0, + ClusterRegistriesNamespace: "default", + DependenciesNamespace: "default", + SecretResolver: "", + } + p.LabelSet.WorkloadIdentityKey = "identity" + p.LabelSet.GlobalTrafficDeploymentLabel = "identity" + p.LabelSet.PriorityKey = "priority" + p.LabelSet.EnvKey = "env" + common.InitializeConfig(p) + }) } -func TestModifyServiceEntryForNewServiceOrPodForExcludedAsset(t *testing.T) { - var ( - clusterID = "test" - p = common.AdmiralParams{ - KubeconfigPath: "testdata/fake.config", - } - rr1, _ = InitAdmiral(context.Background(), p) - config = rest.Config{ - Host: "localhost", - } - ) - rr1.ExcludeAssetList = []string{"asset1"} - deploymentController, err := admiral.NewDeploymentController(clusterID, make(chan struct{}), &test.MockDeploymentHandler{}, &config, time.Second*time.Duration(300)) - if err != nil { - t.Fail() - } - rolloutController, err := admiral.NewRolloutsController(clusterID, make(chan struct{}), &test.MockRolloutHandler{}, &config, time.Second*time.Duration(300)) - if err != nil { - t.Fail() - } - rc := &RemoteController{ - DeploymentController: deploymentController, - RolloutController: rolloutController, - } - rr1.PutRemoteController(clusterID, rc) - serviceEntries := modifyServiceEntryForNewServiceOrPod(context.Background(), admiral.Add, "test", "asset1", rr1) - if serviceEntries != nil { - t.Fatalf("expected service entries to be: %v, but got: %v", nil, serviceEntries) +func makeTestRollout(name, namespace, identityLabelValue string) argo.Rollout { + return argo.Rollout{ + ObjectMeta: metav1.ObjectMeta{ + Name: name, + Namespace: namespace, + Annotations: map[string]string{ + "env": "test", + }, + }, + Spec: argo.RolloutSpec{ + Template: coreV1.PodTemplateSpec{ + ObjectMeta: v12.ObjectMeta{ + Labels: map[string]string{"identity": identityLabelValue}, + Annotations: map[string]string{ + "env": "test", + }, + }, + }, + Strategy: argo.RolloutStrategy{ + Canary: &argo.CanaryStrategy{ + TrafficRouting: &argo.RolloutTrafficRouting{ + Istio: &argo.IstioTrafficRouting{ + VirtualService: &argo.IstioVirtualService{ + Name: name + "-canary", + }, + }, + }, + CanaryService: name + "-canary", + StableService: name + "-stable", + }, + }, + Selector: &v12.LabelSelector{ + MatchLabels: map[string]string{ + "identity": identityLabelValue, + "app": identityLabelValue, + }, + }, + }, } } -/* func TestModifyServiceEntryForNewServiceOrPodForExcludedAsset(t *testing.T) { + setupForServiceEntryTests() var ( - clusterID = "test" - p = common.AdmiralParams{ - KubeconfigPath: "testdata/fake.config", + env = "test" + stop = make(chan struct{}) + foobarMetadataName = "foobar" + foobarMetadataNamespace = "foobar-ns" + foobarRollout = makeTestRollout(foobarMetadataName, foobarMetadataNamespace, foobarMetadataName) + clusterID = "test-dev-k8s" + p = common.AdmiralParams{ + KubeconfigPath: "testdata/fake.config", + CacheRefreshDuration: 0, + } + config = rest.Config{Host: "localhost"} + foobarCanaryService = &coreV1.Service{ + ObjectMeta: v12.ObjectMeta{ + Name: foobarMetadataName + "-canary", + Namespace: foobarMetadataNamespace, + }, + Spec: coreV1.ServiceSpec{ + Selector: map[string]string{"app": foobarMetadataName}, + }, } rr1, _ = InitAdmiral(context.Background(), p) rr2, _ = InitAdmiral(context.Background(), p) - config = rest.Config{ - Host: "localhost", - } ) - rr1.ExcludeAssetList = []string{"asset1"} deploymentController, err := admiral.NewDeploymentController(clusterID, make(chan struct{}), &test.MockDeploymentHandler{}, &config, time.Second*time.Duration(300)) if err != nil { t.Fail() @@ -106,12 +132,24 @@ func TestModifyServiceEntryForNewServiceOrPodForExcludedAsset(t *testing.T) { if err != nil { t.Fail() } + rolloutController.Cache.UpdateRolloutToClusterCache("foobar", &foobarRollout) + serviceController, err := admiral.NewServiceController(clusterID, stop, &test.MockServiceHandler{}, &config, time.Second*time.Duration(300)) + if err != nil { + t.Fatalf("%v", err) + } + serviceController.Cache.Put(foobarCanaryService) rc := &RemoteController{ DeploymentController: deploymentController, RolloutController: rolloutController, + ServiceController: serviceController, } rr1.PutRemoteController(clusterID, rc) + rr1.ExcludeAssetList = []string{"asset1"} + rr1.StartTime = time.Now() + rr2.PutRemoteController(clusterID, rc) + rr2.StartTime = time.Now() + testCases := []struct { name string assetIdentity string @@ -124,38 +162,36 @@ func TestModifyServiceEntryForNewServiceOrPodForExcludedAsset(t *testing.T) { remoteRegistry: rr1, expectedServiceEntries: nil, }, - { - name: "when asset is NOT in the exclude list", - assetIdentity: "bar", - remoteRegistry: rr2, - expectedServiceEntries: nil, - }, + { + name: "when asset is NOT in the exclude list", + assetIdentity: "foobar", + remoteRegistry: rr2, + expectedServiceEntries: nil, + }, } for _, c := range testCases { t.Run(c.name, func(t *testing.T) { - serviceEntries := modifyServiceEntryForNewServiceOrPod(context.Background(), admiral.Add, "test", c.assetIdentity, c.remoteRegistry) - if !reflect.DeepEqual(serviceEntries, c.expectedServiceEntries) { - t.Fatalf("expected service entries to be: %v, but got: %v", c.expectedServiceEntries, serviceEntries) + serviceEntries := modifyServiceEntryForNewServiceOrPod(context.Background(), admiral.Add, env, c.assetIdentity, c.remoteRegistry) + if len(serviceEntries) != len(c.expectedServiceEntries) { + t.Fatalf("expected service entries to be of length: %d, but got: %d", len(c.expectedServiceEntries), len(serviceEntries)) } }) } } -*/ func TestAddServiceEntriesWithDr(t *testing.T) { - admiralCache := AdmiralCache{} - + setupForServiceEntryTests() + var ( + admiralCache = AdmiralCache{} + cnameIdentityCache = sync.Map{} + gtpCache = &globalTrafficCache{} + ) admiralCache.SeClusterCache = common.NewMapOfMaps() - - cnameIdentityCache := sync.Map{} cnameIdentityCache.Store("dev.bar.global", "bar") admiralCache.CnameIdentityCache = &cnameIdentityCache - - gtpCache := &globalTrafficCache{} gtpCache.identityCache = make(map[string]*v13.GlobalTrafficPolicy) gtpCache.mutex = &sync.Mutex{} admiralCache.GlobalTrafficCache = gtpCache - se := istioNetworkingV1Alpha3.ServiceEntry{ Hosts: []string{"dev.bar.global"}, Endpoints: []*istioNetworkingV1Alpha3.WorkloadEntry{ @@ -200,14 +236,14 @@ func TestAddServiceEntriesWithDr(t *testing.T) { } func TestCreateSeAndDrSetFromGtp(t *testing.T) { - - host := "dev.bar.global" - west := "west" - east := "east" - eastWithCaps := "East" - - admiralCache := AdmiralCache{} - + setupForServiceEntryTests() + var ( + host = "dev.bar.global" + west = "west" + east = "east" + eastWithCaps = "East" + admiralCache = AdmiralCache{} + ) admiralCache.ServiceEntryAddressStore = &ServiceEntryAddressStore{ EntryAddresses: map[string]string{}, Addresses: []string{}, @@ -354,7 +390,7 @@ func TestCreateSeAndDrSetFromGtp(t *testing.T) { } func TestCreateServiceEntryForNewServiceOrPod(t *testing.T) { - + setupForServiceEntryTests() p := common.AdmiralParams{ KubeconfigPath: "testdata/fake.config", } @@ -396,6 +432,7 @@ func TestCreateServiceEntryForNewServiceOrPod(t *testing.T) { } func TestGetLocalAddressForSe(t *testing.T) { + setupForServiceEntryTests() t.Parallel() cacheWithEntry := ServiceEntryAddressStore{ EntryAddresses: map[string]string{"e2e.a.mesh": common.LocalAddressPrefix + ".10.1"}, @@ -537,11 +574,13 @@ func TestGetLocalAddressForSe(t *testing.T) { } func TestMakeRemoteEndpointForServiceEntry(t *testing.T) { - address := "1.2.3.4" - locality := "us-west-2" - portName := "port" - - endpoint := makeRemoteEndpointForServiceEntry(address, locality, portName, common.DefaultMtlsPort) + setupForServiceEntryTests() + var ( + address = "1.2.3.4" + locality = "us-west-2" + portName = "port" + endpoint = makeRemoteEndpointForServiceEntry(address, locality, portName, common.DefaultMtlsPort) + ) if endpoint.Address != address { t.Errorf("Address mismatch. Got: %v, expected: %v", endpoint.Address, address) @@ -567,15 +606,18 @@ func buildFakeConfigMapFromAddressStore(addressStore *ServiceEntryAddressStore, } func TestModifyNonExistingSidecarForLocalClusterCommunication(t *testing.T) { - sidecarController := &istio.SidecarController{} + setupForServiceEntryTests() + var ( + ctx = context.Background() + sidecarEgressMap = make(map[string]common.SidecarEgress) + sidecarController = &istio.SidecarController{} + remoteController = &RemoteController{} + ) sidecarController.IstioClient = istiofake.NewSimpleClientset() - remoteController := &RemoteController{} remoteController.SidecarController = sidecarController - sidecarEgressMap := make(map[string]common.SidecarEgress) sidecarEgressMap["test-dependency-namespace"] = common.SidecarEgress{Namespace: "test-dependency-namespace", FQDN: "test-local-fqdn"} - ctx := context.Background() modifySidecarForLocalClusterCommunication(ctx, "test-sidecar-namespace", sidecarEgressMap, remoteController) @@ -583,33 +625,33 @@ func TestModifyNonExistingSidecarForLocalClusterCommunication(t *testing.T) { if err == nil { t.Errorf("expected 404 not found error but got nil") } - if sidecarObj != nil { t.Fatalf("Modify non existing resource failed, as no new resource should be created.") } } func TestModifyExistingSidecarForLocalClusterCommunication(t *testing.T) { - - sidecarController := &istio.SidecarController{} + setupForServiceEntryTests() + var ( + ctx = context.Background() + existingSidecarObj = &v1alpha3.Sidecar{} + istioEgress = istioNetworkingV1Alpha3.IstioEgressListener{ + Hosts: []string{"test-host"}, + } + remoteController = &RemoteController{} + sidecarController = &istio.SidecarController{} + ) sidecarController.IstioClient = istiofake.NewSimpleClientset() - remoteController := &RemoteController{} remoteController.SidecarController = sidecarController - existingSidecarObj := &v1alpha3.Sidecar{} existingSidecarObj.ObjectMeta.Namespace = "test-sidecar-namespace" existingSidecarObj.ObjectMeta.Name = "default" - istioEgress := istioNetworkingV1Alpha3.IstioEgressListener{ - Hosts: []string{"test-host"}, - } - existingSidecarObj.Spec = istioNetworkingV1Alpha3.Sidecar{ Egress: []*istioNetworkingV1Alpha3.IstioEgressListener{&istioEgress}, } - ctx := context.Background() createdSidecar, err := sidecarController.IstioClient.NetworkingV1alpha3().Sidecars("test-sidecar-namespace").Create(ctx, existingSidecarObj, v12.CreateOptions{}) if err != nil { t.Error(err) @@ -667,22 +709,21 @@ func TestModifyExistingSidecarForLocalClusterCommunication(t *testing.T) { } func TestCreateServiceEntry(t *testing.T) { - - config := rest.Config{ - Host: "localhost", - } - stop := make(chan struct{}) - s, e := admiral.NewServiceController("test", stop, &test.MockServiceHandler{}, &config, time.Second*time.Duration(300)) - - if e != nil { - t.Fatalf("%v", e) + setupForServiceEntryTests() + var ( + stop = make(chan struct{}) + admiralCache = AdmiralCache{} + cnameIdentityCache = sync.Map{} + config = rest.Config{ + Host: "localhost", + } + fakeIstioClient = istiofake.NewSimpleClientset() + ) + s, err := admiral.NewServiceController("test", stop, &test.MockServiceHandler{}, &config, time.Second*time.Duration(300)) + if err != nil { + t.Fatalf("%v", err) } - - admiralCache := AdmiralCache{} - localAddress := common.LocalAddressPrefix + ".10.1" - - cnameIdentityCache := sync.Map{} cnameIdentityCache.Store("dev.bar.global", "bar") admiralCache.CnameIdentityCache = &cnameIdentityCache @@ -692,8 +733,6 @@ func TestCreateServiceEntry(t *testing.T) { } admiralCache.CnameClusterCache = common.NewMapOfMaps() - - fakeIstioClient := istiofake.NewSimpleClientset() rc := &RemoteController{ ServiceEntryController: &istio.ServiceEntryController{ IstioClient: fakeIstioClient, @@ -944,37 +983,44 @@ func TestCreateServiceEntry(t *testing.T) { } func TestCreateServiceEntryForNewServiceOrPodRolloutsUsecase(t *testing.T) { - - const NAMESPACE = "test-test" - const SERVICENAME = "serviceNameActive" - const ROLLOUT_POD_HASH_LABEL string = "rollouts-pod-template-hash" - - ctx := context.Background() - - p := common.AdmiralParams{ - KubeconfigPath: "testdata/fake.config", - } - - rr, _ := InitAdmiral(context.Background(), p) + setupForServiceEntryTests() + const ( + namespace = "test-test" + serviceName = "serviceNameActive" + rolloutPodHashLabel string = "rollouts-pod-template-hash" + ) + var ( + ctx = context.Background() + config = rest.Config{ + Host: "localhost", + } + p = common.AdmiralParams{ + KubeconfigPath: "testdata/fake.config", + } + rr, _ = InitAdmiral(context.Background(), p) + ) rr.StartTime = time.Now().Add(-60 * time.Second) - - config := rest.Config{ - Host: "localhost", + d, err := admiral.NewDeploymentController("", make(chan struct{}), &test.MockDeploymentHandler{}, &config, time.Second*time.Duration(300)) + if err != nil { + t.Fail() } - - d, e := admiral.NewDeploymentController("", make(chan struct{}), &test.MockDeploymentHandler{}, &config, time.Second*time.Duration(300)) - - r, e := admiral.NewRolloutsController("test", make(chan struct{}), &test.MockRolloutHandler{}, &config, time.Second*time.Duration(300)) - v, e := istio.NewVirtualServiceController("", make(chan struct{}), &test.MockVirtualServiceHandler{}, &config, time.Second*time.Duration(300)) - - if e != nil { + r, err := admiral.NewRolloutsController("test", make(chan struct{}), &test.MockRolloutHandler{}, &config, time.Second*time.Duration(300)) + if err != nil { + t.Fail() + } + v, err := istio.NewVirtualServiceController("", make(chan struct{}), &test.MockVirtualServiceHandler{}, &config, time.Second*time.Duration(300)) + if err != nil { + t.Fail() + } + s, err := admiral.NewServiceController("test", make(chan struct{}), &test.MockServiceHandler{}, &config, time.Second*time.Duration(300)) + if err != nil { + t.Fail() + } + gtpc, err := admiral.NewGlobalTrafficController("", make(chan struct{}), &test.MockGlobalTrafficHandler{}, &config, time.Second*time.Duration(300)) + if err != nil { t.Fail() } - s, e := admiral.NewServiceController("test", make(chan struct{}), &test.MockServiceHandler{}, &config, time.Second*time.Duration(300)) - - gtpc, e := admiral.NewGlobalTrafficController("", make(chan struct{}), &test.MockGlobalTrafficHandler{}, &config, time.Second*time.Duration(300)) - cacheWithEntry := ServiceEntryAddressStore{ EntryAddresses: map[string]string{"test.test.mesh-se": common.LocalAddressPrefix + ".10.1"}, Addresses: []string{common.LocalAddressPrefix + ".10.1"}, @@ -1026,7 +1072,7 @@ func TestCreateServiceEntryForNewServiceOrPodRolloutsUsecase(t *testing.T) { }, } - rollout.Namespace = NAMESPACE + rollout.Namespace = namespace rollout.Spec.Strategy = argo.RolloutStrategy{ Canary: &argo.CanaryStrategy{}, } @@ -1045,15 +1091,15 @@ func TestCreateServiceEntryForNewServiceOrPodRolloutsUsecase(t *testing.T) { selectorMap := make(map[string]string) selectorMap["app"] = "test" - selectorMap[ROLLOUT_POD_HASH_LABEL] = "hash" + selectorMap[rolloutPodHashLabel] = "hash" activeService := &coreV1.Service{ Spec: coreV1.ServiceSpec{ Selector: selectorMap, }, } - activeService.Name = SERVICENAME - activeService.Namespace = NAMESPACE + activeService.Name = serviceName + activeService.Namespace = namespace port1 := coreV1.ServicePort{ Port: 8080, Name: "random1", @@ -1082,35 +1128,46 @@ func TestCreateServiceEntryForNewServiceOrPodRolloutsUsecase(t *testing.T) { } func TestCreateServiceEntryForBlueGreenRolloutsUsecase(t *testing.T) { + setupForServiceEntryTests() + const ( + namespace = "test-test" + activeServiceName = "serviceNameActive" + previewServiceName = "serviceNamePreview" + rolloutPodHashLabel string = "rollouts-pod-template-hash" + ) + var ( + ctx = context.Background() + p = common.AdmiralParams{ + KubeconfigPath: "testdata/fake.config", + PreviewHostnamePrefix: "preview", + } + rr, _ = InitAdmiral(context.Background(), p) + config = rest.Config{ + Host: "localhost", + } + ) - const NAMESPACE = "test-test" - const ACTIVE_SERVICENAME = "serviceNameActive" - const PREVIEW_SERVICENAME = "serviceNamePreview" - const ROLLOUT_POD_HASH_LABEL string = "rollouts-pod-template-hash" - - ctx := context.Background() - - p := common.AdmiralParams{ - KubeconfigPath: "testdata/fake.config", - PreviewHostnamePrefix: "preview", + rr.StartTime = time.Now().Add(-60 * time.Second) + d, err := admiral.NewDeploymentController("", make(chan struct{}), &test.MockDeploymentHandler{}, &config, time.Second*time.Duration(300)) + if err != nil { + t.Fail() } - rr, _ := InitAdmiral(context.Background(), p) - config := rest.Config{ - Host: "localhost", + r, err := admiral.NewRolloutsController("test", make(chan struct{}), &test.MockRolloutHandler{}, &config, time.Second*time.Duration(300)) + if err != nil { + t.Fail() } - rr.StartTime = time.Now().Add(-60 * time.Second) - - d, e := admiral.NewDeploymentController("", make(chan struct{}), &test.MockDeploymentHandler{}, &config, time.Second*time.Duration(300)) - - r, e := admiral.NewRolloutsController("test", make(chan struct{}), &test.MockRolloutHandler{}, &config, time.Second*time.Duration(300)) - v, e := istio.NewVirtualServiceController("", make(chan struct{}), &test.MockVirtualServiceHandler{}, &config, time.Second*time.Duration(300)) - - if e != nil { + v, err := istio.NewVirtualServiceController("", make(chan struct{}), &test.MockVirtualServiceHandler{}, &config, time.Second*time.Duration(300)) + if err != nil { + t.Fail() + } + s, err := admiral.NewServiceController("test", make(chan struct{}), &test.MockServiceHandler{}, &config, time.Second*time.Duration(300)) + if err != nil { + t.Fail() + } + gtpc, err := admiral.NewGlobalTrafficController("", make(chan struct{}), &test.MockGlobalTrafficHandler{}, &config, time.Second*time.Duration(300)) + if err != nil { t.Fail() } - s, e := admiral.NewServiceController("test", make(chan struct{}), &test.MockServiceHandler{}, &config, time.Second*time.Duration(300)) - gtpc, e := admiral.NewGlobalTrafficController("", make(chan struct{}), &test.MockGlobalTrafficHandler{}, &config, time.Second*time.Duration(300)) - cacheWithEntry := ServiceEntryAddressStore{ EntryAddresses: map[string]string{ "test.test.mesh-se": common.LocalAddressPrefix + ".10.1", @@ -1165,9 +1222,9 @@ func TestCreateServiceEntryForBlueGreenRolloutsUsecase(t *testing.T) { }, } - rollout.Namespace = NAMESPACE + rollout.Namespace = namespace rollout.Spec.Strategy = argo.RolloutStrategy{ - BlueGreen: &argo.BlueGreenStrategy{ActiveService: ACTIVE_SERVICENAME, PreviewService: PREVIEW_SERVICENAME}, + BlueGreen: &argo.BlueGreenStrategy{ActiveService: activeServiceName, PreviewService: previewServiceName}, } labelMap := make(map[string]string) labelMap["identity"] = "test" @@ -1184,7 +1241,7 @@ func TestCreateServiceEntryForBlueGreenRolloutsUsecase(t *testing.T) { selectorMap := make(map[string]string) selectorMap["app"] = "test" - selectorMap[ROLLOUT_POD_HASH_LABEL] = "hash" + selectorMap[rolloutPodHashLabel] = "hash" port1 := coreV1.ServicePort{ Port: 8080, @@ -1203,8 +1260,8 @@ func TestCreateServiceEntryForBlueGreenRolloutsUsecase(t *testing.T) { Selector: selectorMap, }, } - activeService.Name = ACTIVE_SERVICENAME - activeService.Namespace = NAMESPACE + activeService.Name = activeServiceName + activeService.Namespace = namespace activeService.Spec.Ports = ports s.Cache.Put(activeService) @@ -1214,8 +1271,8 @@ func TestCreateServiceEntryForBlueGreenRolloutsUsecase(t *testing.T) { Selector: selectorMap, }, } - previewService.Name = PREVIEW_SERVICENAME - previewService.Namespace = NAMESPACE + previewService.Name = previewServiceName + previewService.Namespace = namespace previewService.Spec.Ports = ports s.Cache.Put(previewService) @@ -1239,7 +1296,7 @@ func TestCreateServiceEntryForBlueGreenRolloutsUsecase(t *testing.T) { // When Preview service is not defined in BlueGreen strategy rollout.Spec.Strategy = argo.RolloutStrategy{ - BlueGreen: &argo.BlueGreenStrategy{ActiveService: ACTIVE_SERVICENAME}, + BlueGreen: &argo.BlueGreenStrategy{ActiveService: activeServiceName}, } se = modifyServiceEntryForNewServiceOrPod(ctx, admiral.Add, "test", "bar", rr) @@ -1255,40 +1312,44 @@ func TestCreateServiceEntryForBlueGreenRolloutsUsecase(t *testing.T) { } func TestUpdateEndpointsForBlueGreen(t *testing.T) { - const CLUSTER_INGRESS_1 = "ingress1.com" - const ACTIVE_SERVICE = "activeService" - const PREVIEW_SERVICE = "previewService" - const NAMESPACE = "namespace" - const ACTIVE_MESH_HOST = "qal.example.mesh" - const PREVIEW_MESH_HOST = "preview.qal.example.mesh" - - rollout := &argo.Rollout{} + setupForServiceEntryTests() + const ( + clusterIngress1 = "ingress1.com" + activeService = "activeService" + previewService = "previewService" + namespace = "namespace" + activeMeshHost = "qal.example.mesh" + previewMeshHost = "preview.qal.example.mesh" + ) + var ( + rollout = &argo.Rollout{} + meshPorts = map[string]uint32{"http": 8080} + ) + rollout.Spec.Strategy = argo.RolloutStrategy{ BlueGreen: &argo.BlueGreenStrategy{ - ActiveService: ACTIVE_SERVICE, - PreviewService: PREVIEW_SERVICE, + ActiveService: activeService, + PreviewService: previewService, }, } rollout.Spec.Template.Annotations = map[string]string{} rollout.Spec.Template.Annotations[common.SidecarEnabledPorts] = "8080" endpoint := &istioNetworkingV1Alpha3.WorkloadEntry{ - Labels: map[string]string{}, Address: CLUSTER_INGRESS_1, Ports: map[string]uint32{"http": 15443}, + Labels: map[string]string{}, Address: clusterIngress1, Ports: map[string]uint32{"http": 15443}, } - meshPorts := map[string]uint32{"http": 8080} - weightedServices := map[string]*WeightedService{ - ACTIVE_SERVICE: {Service: &v1.Service{ObjectMeta: v12.ObjectMeta{Name: ACTIVE_SERVICE, Namespace: NAMESPACE}}}, - PREVIEW_SERVICE: {Service: &v1.Service{ObjectMeta: v12.ObjectMeta{Name: PREVIEW_SERVICE, Namespace: NAMESPACE}}}, + activeService: {Service: &v1.Service{ObjectMeta: v12.ObjectMeta{Name: activeService, Namespace: namespace}}}, + previewService: {Service: &v1.Service{ObjectMeta: v12.ObjectMeta{Name: previewService, Namespace: namespace}}}, } activeWantedEndpoints := &istioNetworkingV1Alpha3.WorkloadEntry{ - Address: ACTIVE_SERVICE + common.Sep + NAMESPACE + common.DotLocalDomainSuffix, Ports: meshPorts, + Address: activeService + common.Sep + namespace + common.DotLocalDomainSuffix, Ports: meshPorts, } previewWantedEndpoints := &istioNetworkingV1Alpha3.WorkloadEntry{ - Address: PREVIEW_SERVICE + common.Sep + NAMESPACE + common.DotLocalDomainSuffix, Ports: meshPorts, + Address: previewService + common.Sep + namespace + common.DotLocalDomainSuffix, Ports: meshPorts, } testCases := []struct { @@ -1307,7 +1368,7 @@ func TestUpdateEndpointsForBlueGreen(t *testing.T) { inputEndpoint: endpoint, weightedServices: weightedServices, meshPorts: meshPorts, - meshHost: ACTIVE_MESH_HOST, + meshHost: activeMeshHost, wantedEndpoints: activeWantedEndpoints, }, { @@ -1316,7 +1377,7 @@ func TestUpdateEndpointsForBlueGreen(t *testing.T) { inputEndpoint: endpoint, weightedServices: weightedServices, meshPorts: meshPorts, - meshHost: PREVIEW_MESH_HOST, + meshHost: previewMeshHost, wantedEndpoints: previewWantedEndpoints, }, } @@ -1332,42 +1393,41 @@ func TestUpdateEndpointsForBlueGreen(t *testing.T) { } func TestUpdateEndpointsForWeightedServices(t *testing.T) { + setupForServiceEntryTests() t.Parallel() - - const CLUSTER_INGRESS_1 = "ingress1.com" - const CLUSTER_INGRESS_2 = "ingress2.com" - const CANARY_SERVICE = "canaryService" - const STABLE_SERVICE = "stableService" - const NAMESPACE = "namespace" - - se := &istioNetworkingV1Alpha3.ServiceEntry{ - Endpoints: []*istioNetworkingV1Alpha3.WorkloadEntry{ - {Labels: map[string]string{}, Address: CLUSTER_INGRESS_1, Weight: 10, Ports: map[string]uint32{"http": 15443}}, - {Labels: map[string]string{}, Address: CLUSTER_INGRESS_2, Weight: 10, Ports: map[string]uint32{"http": 15443}}, - }, - } - - meshPorts := map[string]uint32{"http": 8080} - - weightedServices := map[string]*WeightedService{ - CANARY_SERVICE: {Weight: 10, Service: &v1.Service{ObjectMeta: v12.ObjectMeta{Name: CANARY_SERVICE, Namespace: NAMESPACE}}}, - STABLE_SERVICE: {Weight: 90, Service: &v1.Service{ObjectMeta: v12.ObjectMeta{Name: STABLE_SERVICE, Namespace: NAMESPACE}}}, - } - weightedServicesZeroWeight := map[string]*WeightedService{ - CANARY_SERVICE: {Weight: 0, Service: &v1.Service{ObjectMeta: v12.ObjectMeta{Name: CANARY_SERVICE, Namespace: NAMESPACE}}}, - STABLE_SERVICE: {Weight: 100, Service: &v1.Service{ObjectMeta: v12.ObjectMeta{Name: STABLE_SERVICE, Namespace: NAMESPACE}}}, - } - - wantedEndpoints := []*istioNetworkingV1Alpha3.WorkloadEntry{ - {Address: CLUSTER_INGRESS_2, Weight: 10, Ports: map[string]uint32{"http": 15443}}, - {Address: STABLE_SERVICE + common.Sep + NAMESPACE + common.DotLocalDomainSuffix, Weight: 90, Ports: meshPorts}, - {Address: CANARY_SERVICE + common.Sep + NAMESPACE + common.DotLocalDomainSuffix, Weight: 10, Ports: meshPorts}, - } - - wantedEndpointsZeroWeights := []*istioNetworkingV1Alpha3.WorkloadEntry{ - {Address: CLUSTER_INGRESS_2, Weight: 10, Ports: map[string]uint32{"http": 15443}}, - {Address: STABLE_SERVICE + common.Sep + NAMESPACE + common.DotLocalDomainSuffix, Weight: 100, Ports: meshPorts}, - } + const ( + clusterIngress1 = "ingress1.com" + clusterIngress2 = "ingress2.com" + canaryService = "canaryService" + stableService = "stableService" + namespace = "namespace" + ) + var ( + meshPorts = map[string]uint32{"http": 8080} + se = &istioNetworkingV1Alpha3.ServiceEntry{ + Endpoints: []*istioNetworkingV1Alpha3.WorkloadEntry{ + {Labels: map[string]string{}, Address: clusterIngress1, Weight: 10, Ports: map[string]uint32{"http": 15443}}, + {Labels: map[string]string{}, Address: clusterIngress2, Weight: 10, Ports: map[string]uint32{"http": 15443}}, + }, + } + weightedServices = map[string]*WeightedService{ + canaryService: {Weight: 10, Service: &v1.Service{ObjectMeta: v12.ObjectMeta{Name: canaryService, Namespace: namespace}}}, + stableService: {Weight: 90, Service: &v1.Service{ObjectMeta: v12.ObjectMeta{Name: stableService, Namespace: namespace}}}, + } + weightedServicesZeroWeight = map[string]*WeightedService{ + canaryService: {Weight: 0, Service: &v1.Service{ObjectMeta: v12.ObjectMeta{Name: canaryService, Namespace: namespace}}}, + stableService: {Weight: 100, Service: &v1.Service{ObjectMeta: v12.ObjectMeta{Name: stableService, Namespace: namespace}}}, + } + wantedEndpoints = []*istioNetworkingV1Alpha3.WorkloadEntry{ + {Address: clusterIngress2, Weight: 10, Ports: map[string]uint32{"http": 15443}}, + {Address: stableService + common.Sep + namespace + common.DotLocalDomainSuffix, Weight: 90, Ports: meshPorts}, + {Address: canaryService + common.Sep + namespace + common.DotLocalDomainSuffix, Weight: 10, Ports: meshPorts}, + } + wantedEndpointsZeroWeights = []*istioNetworkingV1Alpha3.WorkloadEntry{ + {Address: clusterIngress2, Weight: 10, Ports: map[string]uint32{"http": 15443}}, + {Address: stableService + common.Sep + namespace + common.DotLocalDomainSuffix, Weight: 100, Ports: meshPorts}, + } + ) testCases := []struct { name string @@ -1381,7 +1441,7 @@ func TestUpdateEndpointsForWeightedServices(t *testing.T) { name: "should return endpoints with assigned weights", inputServiceEntry: copyServiceEntry(se), weightedServices: weightedServices, - clusterIngress: CLUSTER_INGRESS_1, + clusterIngress: clusterIngress1, meshPorts: meshPorts, wantedEndpoints: wantedEndpoints, }, @@ -1397,7 +1457,7 @@ func TestUpdateEndpointsForWeightedServices(t *testing.T) { name: "should not return endpoints with zero weight", inputServiceEntry: copyServiceEntry(se), weightedServices: weightedServicesZeroWeight, - clusterIngress: CLUSTER_INGRESS_1, + clusterIngress: clusterIngress1, meshPorts: meshPorts, wantedEndpoints: wantedEndpointsZeroWeights, }, @@ -1421,42 +1481,32 @@ func TestUpdateEndpointsForWeightedServices(t *testing.T) { } }) } - } func TestUpdateGlobalGtpCache(t *testing.T) { - + setupForServiceEntryTests() var ( + env_stage = "stage" + identity1 = "identity1" admiralCache = &AdmiralCache{GlobalTrafficCache: &globalTrafficCache{identityCache: make(map[string]*v13.GlobalTrafficPolicy), mutex: &sync.Mutex{}}} - - identity1 = "identity1" - - env_stage = "stage" - - gtp = &v13.GlobalTrafficPolicy{ObjectMeta: v12.ObjectMeta{Name: "gtp", Namespace: "namespace1", CreationTimestamp: v12.NewTime(time.Now().Add(time.Duration(-30))), Labels: map[string]string{"identity": identity1, "env": env_stage}}, Spec: model.GlobalTrafficPolicy{ + gtp = &v13.GlobalTrafficPolicy{ObjectMeta: v12.ObjectMeta{Name: "gtp", Namespace: "namespace1", CreationTimestamp: v12.NewTime(time.Now().Add(time.Duration(-30))), Labels: map[string]string{"identity": identity1, "env": env_stage}}, Spec: model.GlobalTrafficPolicy{ Policy: []*model.TrafficPolicy{{DnsPrefix: "hello"}}, }} - gtp2 = &v13.GlobalTrafficPolicy{ObjectMeta: v12.ObjectMeta{Name: "gtp2", Namespace: "namespace1", CreationTimestamp: v12.NewTime(time.Now().Add(time.Duration(-15))), Labels: map[string]string{"identity": identity1, "env": env_stage}}, Spec: model.GlobalTrafficPolicy{ Policy: []*model.TrafficPolicy{{DnsPrefix: "hellogtp2"}}, }} - gtp7 = &v13.GlobalTrafficPolicy{ObjectMeta: v12.ObjectMeta{Name: "gtp7", Namespace: "namespace1", CreationTimestamp: v12.NewTime(time.Now().Add(time.Duration(-45))), Labels: map[string]string{"identity": identity1, "env": env_stage, "priority": "2"}}, Spec: model.GlobalTrafficPolicy{ Policy: []*model.TrafficPolicy{{DnsPrefix: "hellogtp7"}}, }} - gtp3 = &v13.GlobalTrafficPolicy{ObjectMeta: v12.ObjectMeta{Name: "gtp3", Namespace: "namespace2", CreationTimestamp: v12.NewTime(time.Now()), Labels: map[string]string{"identity": identity1, "env": env_stage}}, Spec: model.GlobalTrafficPolicy{ Policy: []*model.TrafficPolicy{{DnsPrefix: "hellogtp3"}}, }} - gtp4 = &v13.GlobalTrafficPolicy{ObjectMeta: v12.ObjectMeta{Name: "gtp4", Namespace: "namespace1", CreationTimestamp: v12.NewTime(time.Now().Add(time.Duration(-30))), Labels: map[string]string{"identity": identity1, "env": env_stage, "priority": "10"}}, Spec: model.GlobalTrafficPolicy{ Policy: []*model.TrafficPolicy{{DnsPrefix: "hellogtp4"}}, }} - gtp5 = &v13.GlobalTrafficPolicy{ObjectMeta: v12.ObjectMeta{Name: "gtp5", Namespace: "namespace1", CreationTimestamp: v12.NewTime(time.Now().Add(time.Duration(-15))), Labels: map[string]string{"identity": identity1, "env": env_stage, "priority": "2"}}, Spec: model.GlobalTrafficPolicy{ Policy: []*model.TrafficPolicy{{DnsPrefix: "hellogtp5"}}, }} - gtp6 = &v13.GlobalTrafficPolicy{ObjectMeta: v12.ObjectMeta{Name: "gtp6", Namespace: "namespace3", CreationTimestamp: v12.NewTime(time.Now()), Labels: map[string]string{"identity": identity1, "env": env_stage, "priority": "1000"}}, Spec: model.GlobalTrafficPolicy{ Policy: []*model.TrafficPolicy{{DnsPrefix: "hellogtp6"}}, }} @@ -1541,8 +1591,13 @@ func isLower(s string) bool { } func TestIsBlueGreenStrategy(t *testing.T) { + setupForServiceEntryTests() var ( - emptyRollout *argo.Rollout + emptyRollout *argo.Rollout + rolloutWithEmptySpec = &argo.Rollout{} + rolloutWithNoStrategy = &argo.Rollout{ + Spec: argo.RolloutSpec{}, + } rolloutWithBlueGreenStrategy = &argo.Rollout{ Spec: argo.RolloutSpec{ Strategy: argo.RolloutStrategy{ @@ -1561,10 +1616,6 @@ func TestIsBlueGreenStrategy(t *testing.T) { }, }, } - rolloutWithNoStrategy = &argo.Rollout{ - Spec: argo.RolloutSpec{}, - } - rolloutWithEmptySpec = &argo.Rollout{} ) cases := []struct { name string @@ -1607,7 +1658,6 @@ func TestIsBlueGreenStrategy(t *testing.T) { expectedResult: false, }, } - for _, c := range cases { t.Run(c.name, func(t *testing.T) { result := isBlueGreenStrategy(c.rollout) diff --git a/admiral/pkg/clusters/types_test.go b/admiral/pkg/clusters/types_test.go index 85856716..36dd36f6 100644 --- a/admiral/pkg/clusters/types_test.go +++ b/admiral/pkg/clusters/types_test.go @@ -24,33 +24,34 @@ import ( ) var ignoreUnexported = cmpopts.IgnoreUnexported(v1.GlobalTrafficPolicy{}.Status) - -func init() { - p := common.AdmiralParams{ - KubeconfigPath: "testdata/fake.config", - LabelSet: &common.LabelSet{}, - EnableSAN: true, - SANPrefix: "prefix", - HostnameSuffix: "mesh", - SyncNamespace: "ns", - CacheRefreshDuration: time.Minute, - ClusterRegistriesNamespace: "default", - DependenciesNamespace: "default", - SecretResolver: "", - EnableRoutingPolicy: true, - EnvoyFilterVersion: "1.13", - } - - p.LabelSet.WorkloadIdentityKey = "identity" - p.LabelSet.EnvKey = "admiral.io/env" - p.LabelSet.GlobalTrafficDeploymentLabel = "identity" - p.LabelSet.PriorityKey = "priority" - - common.InitializeConfig(p) +var typeTestSingleton sync.Once + +func setupForTypeTests() { + typeTestSingleton.Do(func() { + p := common.AdmiralParams{ + KubeconfigPath: "testdata/fake.config", + LabelSet: &common.LabelSet{}, + EnableSAN: true, + SANPrefix: "prefix", + HostnameSuffix: "mesh", + SyncNamespace: "ns", + CacheRefreshDuration: time.Minute, + ClusterRegistriesNamespace: "default", + DependenciesNamespace: "default", + SecretResolver: "", + EnableRoutingPolicy: true, + EnvoyFilterVersion: "1.13", + } + p.LabelSet.WorkloadIdentityKey = "identity" + p.LabelSet.EnvKey = "admiral.io/env" + p.LabelSet.GlobalTrafficDeploymentLabel = "identity" + p.LabelSet.PriorityKey = "priority" + common.InitializeConfig(p) + }) } func TestDeploymentHandler(t *testing.T) { - + setupForTypeTests() ctx := context.Background() p := common.AdmiralParams{ @@ -132,7 +133,7 @@ func TestDeploymentHandler(t *testing.T) { } func TestRolloutHandler(t *testing.T) { - + setupForTypeTests() ctx := context.Background() p := common.AdmiralParams{ @@ -219,6 +220,7 @@ func TestRolloutHandler(t *testing.T) { } func TestHandleEventForGlobalTrafficPolicy(t *testing.T) { + setupForTypeTests() ctx := context.Background() event := admiral.EventType("Add") p := common.AdmiralParams{ @@ -274,6 +276,7 @@ func TestHandleEventForGlobalTrafficPolicy(t *testing.T) { } func TestRoutingPolicyHandler(t *testing.T) { + setupForTypeTests() p := common.AdmiralParams{ KubeconfigPath: "testdata/fake.config", LabelSet: &common.LabelSet{}, diff --git a/admiral/pkg/clusters/util.go b/admiral/pkg/clusters/util.go index 0db890de..5c509ac4 100644 --- a/admiral/pkg/clusters/util.go +++ b/admiral/pkg/clusters/util.go @@ -2,15 +2,16 @@ package clusters import ( "errors" + "strconv" + "strings" + "time" + argo "github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1" "github.com/istio-ecosystem/admiral/admiral/pkg/controller/common" log "github.com/sirupsen/logrus" "gopkg.in/yaml.v2" k8sAppsV1 "k8s.io/api/apps/v1" k8sV1 "k8s.io/api/core/v1" - "strconv" - "strings" - "time" ) func GetMeshPorts(clusterName string, destService *k8sV1.Service, @@ -30,13 +31,13 @@ func GetMeshPortsForRollout(clusterName string, destService *k8sV1.Service, // Get the service selector to add as workload selector for envoyFilter func GetServiceSelector(clusterName string, destService *k8sV1.Service) *common.Map { var selectors = destService.Spec.Selector - if len(selectors) == 0{ + if len(selectors) == 0 { log.Infof(LogFormat, "GetServiceLabels", "no selectors present", destService.Name, clusterName, selectors) return nil } var tempMap = common.NewMap() for key, value := range selectors { - tempMap.Put(key,value) + tempMap.Put(key, value) } log.Infof(LogFormat, "GetServiceLabels", "selectors present", destService.Name, clusterName, selectors) return tempMap @@ -93,7 +94,7 @@ func getMeshPortsHelper(meshPorts string, destService *k8sV1.Service, clusterNam } if _, ok := meshPortMap[targetPort]; ok { var protocol = GetPortProtocol(servicePort.Name) - log.Debugf(LogFormat, "GetMeshPorts", servicePort.Port, destService.Name, clusterName, "Adding mesh port for protocol: " + protocol) + log.Debugf(LogFormat, "GetMeshPorts", servicePort.Port, destService.Name, clusterName, "Adding mesh port for protocol: "+protocol) ports[protocol] = uint32(servicePort.Port) break } diff --git a/admiral/pkg/controller/common/rolloutcommon.go b/admiral/pkg/controller/common/rolloutcommon.go index 5500d03d..474ae8dc 100644 --- a/admiral/pkg/controller/common/rolloutcommon.go +++ b/admiral/pkg/controller/common/rolloutcommon.go @@ -1,11 +1,12 @@ package common import ( - argo "github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1" - "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/v1" - log "github.com/sirupsen/logrus" "sort" "strings" + + argo "github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1" + v1 "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/v1" + log "github.com/sirupsen/logrus" ) // GetCname returns cname in the format ..global, Ex: stage.Admiral.services.registry.global From 24d2c01c10e5ecc12de7d21467d95bd3c5f27c24 Mon Sep 17 00:00:00 2001 From: Anubhav Aeron Date: Wed, 14 Sep 2022 14:34:59 -0700 Subject: [PATCH 5/7] working unit tests Signed-off-by: Anubhav Aeron --- admiral/pkg/clusters/serviceentry.go | 4 +- admiral/pkg/clusters/serviceentry_test.go | 74 +++++++++++------------ admiral/pkg/clusters/testdata/fake.config | 1 - admiral/pkg/clusters/types.go | 12 ++-- admiral/pkg/clusters/types_test.go | 2 +- admiral/pkg/controller/common/config.go | 12 +++- go.mod | 1 + go.sum | 2 + 8 files changed, 60 insertions(+), 48 deletions(-) diff --git a/admiral/pkg/clusters/serviceentry.go b/admiral/pkg/clusters/serviceentry.go index 72e770aa..f16a2e2c 100644 --- a/admiral/pkg/clusters/serviceentry.go +++ b/admiral/pkg/clusters/serviceentry.go @@ -301,10 +301,10 @@ func sortGtpsByPriorityAndCreationTime(gtpsToOrder []*v1.GlobalTrafficPolicy, id jTime := gtpsToOrder[j].CreationTimestamp if iPriority != jPriority { - log.Debugf("GTP sorting identity=%s env=%s name1=%s creationTime1=%v priority1=%d name2=%s creationTime2=%v priority2=%d", identity, env, gtpsToOrder[i].Name, iTime, iPriority, gtpsToOrder[j].Name, jTime, jPriority) + log.Infof("GTP sorting identity=%s env=%s name1=%s creationTime1=%v priority1=%d name2=%s creationTime2=%v priority2=%d", identity, env, gtpsToOrder[i].Name, iTime, iPriority, gtpsToOrder[j].Name, jTime, jPriority) return iPriority > jPriority } - log.Debugf("GTP sorting identity=%s env=%s name1=%s creationTime1=%v priority1=%d name2=%s creationTime2=%v priority2=%d", identity, env, gtpsToOrder[i].Name, iTime, iPriority, gtpsToOrder[j].Name, jTime, jPriority) + log.Infof("GTP sorting identity=%s env=%s name1=%s creationTime1=%v priority1=%d name2=%s creationTime2=%v priority2=%d", identity, env, gtpsToOrder[i].Name, iTime, iPriority, gtpsToOrder[j].Name, jTime, jPriority) return iTime.After(jTime.Time) }) } diff --git a/admiral/pkg/clusters/serviceentry_test.go b/admiral/pkg/clusters/serviceentry_test.go index 5f4035e1..f6f8e301 100644 --- a/admiral/pkg/clusters/serviceentry_test.go +++ b/admiral/pkg/clusters/serviceentry_test.go @@ -1483,33 +1483,33 @@ func TestUpdateEndpointsForWeightedServices(t *testing.T) { } } +func makeGTP(name, namespace, identity, env, dnsPrefix string, creationTimestamp v12.Time) *v13.GlobalTrafficPolicy { + return &v13.GlobalTrafficPolicy{ + ObjectMeta: v12.ObjectMeta{ + Name: name, + Namespace: namespace, + CreationTimestamp: creationTimestamp, + Labels: map[string]string{"identity": identity, "env": env}, + }, + Spec: model.GlobalTrafficPolicy{ + Policy: []*model.TrafficPolicy{{DnsPrefix: dnsPrefix}}, + }, + } +} + func TestUpdateGlobalGtpCache(t *testing.T) { setupForServiceEntryTests() var ( - env_stage = "stage" + envStage = "stage" identity1 = "identity1" admiralCache = &AdmiralCache{GlobalTrafficCache: &globalTrafficCache{identityCache: make(map[string]*v13.GlobalTrafficPolicy), mutex: &sync.Mutex{}}} - gtp = &v13.GlobalTrafficPolicy{ObjectMeta: v12.ObjectMeta{Name: "gtp", Namespace: "namespace1", CreationTimestamp: v12.NewTime(time.Now().Add(time.Duration(-30))), Labels: map[string]string{"identity": identity1, "env": env_stage}}, Spec: model.GlobalTrafficPolicy{ - Policy: []*model.TrafficPolicy{{DnsPrefix: "hello"}}, - }} - gtp2 = &v13.GlobalTrafficPolicy{ObjectMeta: v12.ObjectMeta{Name: "gtp2", Namespace: "namespace1", CreationTimestamp: v12.NewTime(time.Now().Add(time.Duration(-15))), Labels: map[string]string{"identity": identity1, "env": env_stage}}, Spec: model.GlobalTrafficPolicy{ - Policy: []*model.TrafficPolicy{{DnsPrefix: "hellogtp2"}}, - }} - gtp7 = &v13.GlobalTrafficPolicy{ObjectMeta: v12.ObjectMeta{Name: "gtp7", Namespace: "namespace1", CreationTimestamp: v12.NewTime(time.Now().Add(time.Duration(-45))), Labels: map[string]string{"identity": identity1, "env": env_stage, "priority": "2"}}, Spec: model.GlobalTrafficPolicy{ - Policy: []*model.TrafficPolicy{{DnsPrefix: "hellogtp7"}}, - }} - gtp3 = &v13.GlobalTrafficPolicy{ObjectMeta: v12.ObjectMeta{Name: "gtp3", Namespace: "namespace2", CreationTimestamp: v12.NewTime(time.Now()), Labels: map[string]string{"identity": identity1, "env": env_stage}}, Spec: model.GlobalTrafficPolicy{ - Policy: []*model.TrafficPolicy{{DnsPrefix: "hellogtp3"}}, - }} - gtp4 = &v13.GlobalTrafficPolicy{ObjectMeta: v12.ObjectMeta{Name: "gtp4", Namespace: "namespace1", CreationTimestamp: v12.NewTime(time.Now().Add(time.Duration(-30))), Labels: map[string]string{"identity": identity1, "env": env_stage, "priority": "10"}}, Spec: model.GlobalTrafficPolicy{ - Policy: []*model.TrafficPolicy{{DnsPrefix: "hellogtp4"}}, - }} - gtp5 = &v13.GlobalTrafficPolicy{ObjectMeta: v12.ObjectMeta{Name: "gtp5", Namespace: "namespace1", CreationTimestamp: v12.NewTime(time.Now().Add(time.Duration(-15))), Labels: map[string]string{"identity": identity1, "env": env_stage, "priority": "2"}}, Spec: model.GlobalTrafficPolicy{ - Policy: []*model.TrafficPolicy{{DnsPrefix: "hellogtp5"}}, - }} - gtp6 = &v13.GlobalTrafficPolicy{ObjectMeta: v12.ObjectMeta{Name: "gtp6", Namespace: "namespace3", CreationTimestamp: v12.NewTime(time.Now()), Labels: map[string]string{"identity": identity1, "env": env_stage, "priority": "1000"}}, Spec: model.GlobalTrafficPolicy{ - Policy: []*model.TrafficPolicy{{DnsPrefix: "hellogtp6"}}, - }} + gtp1 = makeGTP("gtp1", "namespace1", identity1, envStage, "hellogtp1", v12.NewTime(time.Now().Add(time.Duration(-30)))) + gtp2 = makeGTP("gtp2", "namespace1", identity1, envStage, "hellogtp2", v12.NewTime(time.Now().Add(time.Duration(-15)))) + gtp7 = makeGTP("gtp7", "namespace1", identity1, envStage, "hellogtp7", v12.NewTime(time.Now().Add(time.Duration(-45)))) + gtp3 = makeGTP("gtp3", "namespace2", identity1, envStage, "hellogtp3", v12.NewTime(time.Now())) + gtp4 = makeGTP("gtp4", "namespace1", identity1, envStage, "hellogtp4", v12.NewTime(time.Now().Add(time.Duration(-30)))) + gtp5 = makeGTP("gtp5", "namespace1", identity1, envStage, "hellogtp5", v12.NewTime(time.Now().Add(time.Duration(-15)))) + gtp6 = makeGTP("gtp6", "namespace3", identity1, envStage, "hellogtp6", v12.NewTime(time.Now())) ) testCases := []struct { @@ -1523,49 +1523,49 @@ func TestUpdateGlobalGtpCache(t *testing.T) { name: "Should return nil when no GTP present", gtps: map[string][]*v13.GlobalTrafficPolicy{}, identity: identity1, - env: env_stage, + env: envStage, expectedGtp: nil, }, { name: "Should return the only existing gtp", - gtps: map[string][]*v13.GlobalTrafficPolicy{"c1": {gtp}}, + gtps: map[string][]*v13.GlobalTrafficPolicy{"c1": {gtp1}}, identity: identity1, - env: env_stage, - expectedGtp: gtp, + env: envStage, + expectedGtp: gtp1, }, { name: "Should return the gtp recently created within the cluster", - gtps: map[string][]*v13.GlobalTrafficPolicy{"c1": {gtp, gtp2}}, + gtps: map[string][]*v13.GlobalTrafficPolicy{"c1": {gtp1, gtp2}}, identity: identity1, - env: env_stage, + env: envStage, expectedGtp: gtp2, }, { name: "Should return the gtp recently created from another cluster", - gtps: map[string][]*v13.GlobalTrafficPolicy{"c1": {gtp, gtp2}, "c2": {gtp3}}, + gtps: map[string][]*v13.GlobalTrafficPolicy{"c1": {gtp1, gtp2}, "c2": {gtp3}}, identity: identity1, - env: env_stage, + env: envStage, expectedGtp: gtp3, }, { name: "Should return the existing priority gtp within the cluster", - gtps: map[string][]*v13.GlobalTrafficPolicy{"c1": {gtp, gtp2, gtp7}}, + gtps: map[string][]*v13.GlobalTrafficPolicy{"c1": {gtp1, gtp2, gtp7}}, identity: identity1, - env: env_stage, + env: envStage, expectedGtp: gtp7, }, { name: "Should return the recently created priority gtp within the cluster", - gtps: map[string][]*v13.GlobalTrafficPolicy{"c1": {gtp5, gtp4, gtp, gtp2}}, + gtps: map[string][]*v13.GlobalTrafficPolicy{"c1": {gtp5, gtp4, gtp1, gtp2}}, identity: identity1, - env: env_stage, - expectedGtp: gtp4, + env: envStage, + expectedGtp: gtp5, }, { name: "Should return the recently created priority gtp from another cluster", - gtps: map[string][]*v13.GlobalTrafficPolicy{"c1": {gtp, gtp2, gtp4, gtp5, gtp7}, "c2": {gtp6}, "c3": {gtp3}}, + gtps: map[string][]*v13.GlobalTrafficPolicy{"c1": {gtp1, gtp2, gtp4, gtp5, gtp7}, "c2": {gtp6}, "c3": {gtp3}}, identity: identity1, - env: env_stage, + env: envStage, expectedGtp: gtp6, }, } diff --git a/admiral/pkg/clusters/testdata/fake.config b/admiral/pkg/clusters/testdata/fake.config index ab5da600..3fc12dd2 100644 --- a/admiral/pkg/clusters/testdata/fake.config +++ b/admiral/pkg/clusters/testdata/fake.config @@ -1,7 +1,6 @@ apiVersion: v1 clusters: - cluster: - server: https://192.168.99.121:8443 name: kube contexts: diff --git a/admiral/pkg/clusters/types.go b/admiral/pkg/clusters/types.go index c4bfa717..a5f329b4 100644 --- a/admiral/pkg/clusters/types.go +++ b/admiral/pkg/clusters/types.go @@ -268,11 +268,13 @@ type routingPolicyFilterCache struct { func (r *routingPolicyFilterCache) Get(identityEnvKey string) (filters map[string]map[string]string) { defer r.mutex.Unlock() r.mutex.Lock() + fmt.Printf("r.filterCache: %+v", r.filterCache) return r.filterCache[identityEnvKey] } func (r *routingPolicyFilterCache) Put(identityEnvKey string, clusterId string, filterName string) { defer r.mutex.Unlock() + fmt.Printf("identityEnvKey: %v\n", identityEnvKey) r.mutex.Lock() if r.filterCache[identityEnvKey] == nil { r.filterCache[identityEnvKey] = make(map[string]map[string]string) @@ -295,7 +297,9 @@ func (r *routingPolicyFilterCache) Delete(identityEnvKey string) { } } func (r RoutingPolicyHandler) Added(ctx context.Context, obj *v1.RoutingPolicy) { + fmt.Println("comes inside Added") if common.GetEnableRoutingPolicy() { + fmt.Println("routing policy is enabled") if common.ShouldIgnoreResource(obj.ObjectMeta) { log.Infof(LogFormat, "success", "routingpolicy", obj.Name, "", "Ignored the RoutingPolicy because of the annotation") return @@ -305,7 +309,7 @@ func (r RoutingPolicyHandler) Added(ctx context.Context, obj *v1.RoutingPolicy) log.Info("No dependents found for Routing Policy - ", obj.Name) return } - r.processroutingPolicy(ctx, dependents, obj, admiral.Add) + r.processRoutingPolicy(ctx, dependents, obj, admiral.Add) log.Infof(LogFormat, admiral.Add, "routingpolicy", obj.Name, "", "finished processing routing policy") } else { @@ -313,10 +317,10 @@ func (r RoutingPolicyHandler) Added(ctx context.Context, obj *v1.RoutingPolicy) } } -func (r RoutingPolicyHandler) processroutingPolicy(ctx context.Context, dependents map[string]string, routingPolicy *v1.RoutingPolicy, eventType admiral.EventType) { +func (r RoutingPolicyHandler) processRoutingPolicy(ctx context.Context, dependents map[string]string, routingPolicy *v1.RoutingPolicy, eventType admiral.EventType) { for _, remoteController := range r.RemoteRegistry.remoteControllers { for _, dependent := range dependents { - + fmt.Printf("dependent: %v\n", dependent) // Check if the dependent exists in this remoteCluster. If so, we create an envoyFilter with dependent identity as workload selector if _, ok := r.RemoteRegistry.AdmiralCache.IdentityClusterCache.Get(dependent).Copy()[remoteController.ClusterID]; ok { selectors := r.RemoteRegistry.AdmiralCache.WorkloadSelectorCache.Get(dependent + remoteController.ClusterID).Copy() @@ -348,7 +352,7 @@ func (r RoutingPolicyHandler) Updated(ctx context.Context, obj *v1.RoutingPolicy if len(dependents) == 0 { return } - r.processroutingPolicy(ctx, dependents, obj, admiral.Update) + r.processRoutingPolicy(ctx, dependents, obj, admiral.Update) log.Infof(LogFormat, admiral.Update, "routingpolicy", obj.Name, "", "updated routing policy") } else { diff --git a/admiral/pkg/clusters/types_test.go b/admiral/pkg/clusters/types_test.go index 36dd36f6..cc5645f5 100644 --- a/admiral/pkg/clusters/types_test.go +++ b/admiral/pkg/clusters/types_test.go @@ -276,7 +276,7 @@ func TestHandleEventForGlobalTrafficPolicy(t *testing.T) { } func TestRoutingPolicyHandler(t *testing.T) { - setupForTypeTests() + common.ResetSync() p := common.AdmiralParams{ KubeconfigPath: "testdata/fake.config", LabelSet: &common.LabelSet{}, diff --git a/admiral/pkg/controller/common/config.go b/admiral/pkg/controller/common/config.go index d4afaaa3..29fa0a39 100644 --- a/admiral/pkg/controller/common/config.go +++ b/admiral/pkg/controller/common/config.go @@ -1,16 +1,22 @@ package common import ( - log "github.com/sirupsen/logrus" - "sync" "time" + + "github.com/matryer/resync" + + log "github.com/sirupsen/logrus" ) var admiralParams = AdmiralParams{ LabelSet: &LabelSet{}, } -var once sync.Once +var once resync.Once + +func ResetSync() { + once.Reset() +} func InitializeConfig(params AdmiralParams) { var initHappened = false diff --git a/go.mod b/go.mod index 0543e668..19b16f62 100644 --- a/go.mod +++ b/go.mod @@ -53,6 +53,7 @@ require ( github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect + github.com/matryer/resync v0.0.0-20161211202428-d39c09a11215 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect diff --git a/go.sum b/go.sum index 581873f2..44b63ae6 100644 --- a/go.sum +++ b/go.sum @@ -235,6 +235,8 @@ github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.7.6 h1:8yTIVnZgCoiM1TgqoeTl+LfU5Jg6/xL3QhGQnimLYnA= github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/matryer/resync v0.0.0-20161211202428-d39c09a11215 h1:hDa3vAq/Zo5gjfJ46XMsGFbH+hTizpR4fUzQCk2nxgk= +github.com/matryer/resync v0.0.0-20161211202428-d39c09a11215/go.mod h1:LH+NgPY9AJpDfqAFtzyer01N9MYNsAKUf3DC9DV1xIY= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI= github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= From 955da30e168f55411ad5b73fb0b451abaafc2698 Mon Sep 17 00:00:00 2001 From: Anubhav Aeron Date: Mon, 19 Sep 2022 09:09:59 -0700 Subject: [PATCH 6/7] add more tests for exclude asset Signed-off-by: Anubhav Aeron --- admiral/pkg/clusters/handler.go | 3 - admiral/pkg/clusters/handler_test.go | 1 - admiral/pkg/clusters/registry_test.go | 1 + admiral/pkg/clusters/serviceentry.go | 21 +- admiral/pkg/clusters/serviceentry_test.go | 322 ++++++++++++++++++---- admiral/pkg/clusters/types.go | 5 - admiral/pkg/clusters/types_test.go | 1 + admiral/pkg/clusters/util_test.go | 125 ++++----- admiral/pkg/controller/common/config.go | 4 +- 9 files changed, 344 insertions(+), 139 deletions(-) diff --git a/admiral/pkg/clusters/handler.go b/admiral/pkg/clusters/handler.go index 6bdea47d..ba9f51c4 100644 --- a/admiral/pkg/clusters/handler.go +++ b/admiral/pkg/clusters/handler.go @@ -659,13 +659,10 @@ func createDestinationRuleSkeletion(dr v1alpha32.DestinationRule, name string, n } func getServiceForDeployment(rc *RemoteController, deployment *k8sAppsV1.Deployment) *k8sV1.Service { - if deployment == nil { return nil } - cachedServices := rc.ServiceController.Cache.Get(deployment.Namespace) - if cachedServices == nil { return nil } diff --git a/admiral/pkg/clusters/handler_test.go b/admiral/pkg/clusters/handler_test.go index 60999a8e..d2860d36 100644 --- a/admiral/pkg/clusters/handler_test.go +++ b/admiral/pkg/clusters/handler_test.go @@ -29,7 +29,6 @@ import ( ) func TestGetDependentClusters(t *testing.T) { - identityClusterCache := common.NewMapOfMaps() identityClusterCache.Put("id1", "dep1", "cl1") identityClusterCache.Put("id2", "dep2", "cl2") diff --git a/admiral/pkg/clusters/registry_test.go b/admiral/pkg/clusters/registry_test.go index 7bb94fdd..48a31b6e 100644 --- a/admiral/pkg/clusters/registry_test.go +++ b/admiral/pkg/clusters/registry_test.go @@ -28,6 +28,7 @@ var registryTestSingleton sync.Once func setupForRegistryTests() { registryTestSingleton.Do(func() { + common.ResetSync() p := common.AdmiralParams{ KubeconfigPath: "testdata/fake.config", LabelSet: &common.LabelSet{}, diff --git a/admiral/pkg/clusters/serviceentry.go b/admiral/pkg/clusters/serviceentry.go index f16a2e2c..71b6d4d1 100644 --- a/admiral/pkg/clusters/serviceentry.go +++ b/admiral/pkg/clusters/serviceentry.go @@ -55,7 +55,9 @@ func createServiceEntry(ctx context.Context, event admiral.EventType, rc *Remote return tmpSe } -func modifyServiceEntryForNewServiceOrPod(ctx context.Context, event admiral.EventType, env string, sourceIdentity string, remoteRegistry *RemoteRegistry) map[string]*networking.ServiceEntry { +func modifyServiceEntryForNewServiceOrPod( + ctx context.Context, event admiral.EventType, env string, sourceIdentity string, + remoteRegistry *RemoteRegistry) map[string]*networking.ServiceEntry { defer util.LogElapsedTime("modifyServiceEntryForNewServiceOrPod", sourceIdentity, env, "")() if CurrentAdmiralState.ReadOnly { log.Infof(LogFormat, event, env, sourceIdentity, "", "Processing skipped as Admiral is in Read-only mode") @@ -193,11 +195,12 @@ func modifyServiceEntryForNewServiceOrPod(ctx context.Context, event admiral.Eve for key, serviceEntry := range serviceEntries { if len(serviceEntry.Endpoints) == 0 { - AddServiceEntriesWithDr(ctx, remoteRegistry, map[string]string{sourceCluster: sourceCluster}, - + AddServiceEntriesWithDr( + ctx, remoteRegistry, map[string]string{sourceCluster: sourceCluster}, map[string]*networking.ServiceEntry{key: serviceEntry}) } - clusterIngress, _ := rc.ServiceController.Cache.GetLoadBalancer(common.GetAdmiralParams().LabelSet.GatewayApp, common.NamespaceIstioSystem) + clusterIngress, _ := rc.ServiceController.Cache.GetLoadBalancer( + common.GetAdmiralParams().LabelSet.GatewayApp, common.NamespaceIstioSystem) for _, ep := range serviceEntry.Endpoints { //replace istio ingress-gateway address with local fqdn, note that ingress-gateway can be empty (not provisoned, or is not up) if ep.Address == clusterIngress || ep.Address == "" { @@ -266,7 +269,6 @@ func modifyServiceEntryForNewServiceOrPod(ctx context.Context, event admiral.Eve //i) Picks the GTP that was created most recently from the passed in GTP list based on GTP priority label (GTPs from all clusters) //ii) Updates the global GTP cache with the selected GTP in i) func updateGlobalGtpCache(cache *AdmiralCache, identity, env string, gtps map[string][]*v1.GlobalTrafficPolicy) { - defer util.LogElapsedTime("updateGlobalGtpCache", identity, env, "")() gtpsOrdered := make([]*v1.GlobalTrafficPolicy, 0) for _, gtpsInCluster := range gtps { gtpsOrdered = append(gtpsOrdered, gtpsInCluster...) @@ -378,7 +380,10 @@ func modifySidecarForLocalClusterCommunication(ctx context.Context, sidecarNames return } - sidecar, _ := sidecarConfig.IstioClient.NetworkingV1alpha3().Sidecars(sidecarNamespace).Get(ctx, common.GetWorkloadSidecarName(), v12.GetOptions{}) + sidecar, err := sidecarConfig.IstioClient.NetworkingV1alpha3().Sidecars(sidecarNamespace).Get(ctx, common.GetWorkloadSidecarName(), v12.GetOptions{}) + if err != nil { + return + } if sidecar == nil || (sidecar.Spec.Egress == nil) { return @@ -735,7 +740,9 @@ func getUniqueAddress(ctx context.Context, admiralCache *AdmiralCache, globalFqd needsCacheUpdate := false for err == nil && counter < maxRetries { - address, needsCacheUpdate, err = GetLocalAddressForSe(ctx, getIstioResourceName(globalFqdn, "-se"), admiralCache.ServiceEntryAddressStore, admiralCache.ConfigMapController) + address, needsCacheUpdate, err = GetLocalAddressForSe( + ctx, getIstioResourceName(globalFqdn, "-se"), + admiralCache.ServiceEntryAddressStore, admiralCache.ConfigMapController) if err != nil { log.Errorf("Error getting local address for Service Entry. Err: %v", err) diff --git a/admiral/pkg/clusters/serviceentry_test.go b/admiral/pkg/clusters/serviceentry_test.go index f6f8e301..b802953a 100644 --- a/admiral/pkg/clusters/serviceentry_test.go +++ b/admiral/pkg/clusters/serviceentry_test.go @@ -19,15 +19,16 @@ import ( "github.com/istio-ecosystem/admiral/admiral/pkg/controller/common" "github.com/istio-ecosystem/admiral/admiral/pkg/controller/istio" "github.com/istio-ecosystem/admiral/admiral/pkg/test" + log "github.com/sirupsen/logrus" "github.com/stretchr/testify/assert" "google.golang.org/protobuf/testing/protocmp" "gopkg.in/yaml.v2" istioNetworkingV1Alpha3 "istio.io/api/networking/v1alpha3" "istio.io/client-go/pkg/apis/networking/v1alpha3" istiofake "istio.io/client-go/pkg/clientset/versioned/fake" + k8sAppsV1 "k8s.io/api/apps/v1" v14 "k8s.io/api/apps/v1" coreV1 "k8s.io/api/core/v1" - v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" v12 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/rest" @@ -35,26 +36,72 @@ import ( var serviceEntryTestSingleton sync.Once +func admiralParams() common.AdmiralParams { + return common.AdmiralParams{ + KubeconfigPath: "testdata/fake.config", + LabelSet: &common.LabelSet{ + GatewayApp: "gatewayapp", + WorkloadIdentityKey: "identity", + PriorityKey: "priority", + EnvKey: "env", + }, + EnableSAN: true, + SANPrefix: "prefix", + HostnameSuffix: "mesh", + SyncNamespace: "ns", + CacheRefreshDuration: 0, + ClusterRegistriesNamespace: "default", + DependenciesNamespace: "default", + WorkloadSidecarName: "default", + SecretResolver: "", + } +} + func setupForServiceEntryTests() { + var initHappened bool serviceEntryTestSingleton.Do(func() { - p := common.AdmiralParams{ - KubeconfigPath: "testdata/fake.config", - LabelSet: &common.LabelSet{}, - EnableSAN: true, - SANPrefix: "prefix", - HostnameSuffix: "mesh", - SyncNamespace: "ns", - CacheRefreshDuration: 0, - ClusterRegistriesNamespace: "default", - DependenciesNamespace: "default", - SecretResolver: "", - } - p.LabelSet.WorkloadIdentityKey = "identity" - p.LabelSet.GlobalTrafficDeploymentLabel = "identity" - p.LabelSet.PriorityKey = "priority" - p.LabelSet.EnvKey = "env" - common.InitializeConfig(p) + common.ResetSync() + initHappened = true + common.InitializeConfig(admiralParams()) }) + if !initHappened { + log.Warn("InitializeConfig was NOT called from setupForServiceEntryTests") + } else { + log.Info("InitializeConfig was called setupForServiceEntryTests") + } +} + +func makeTestDeployment(name, namespace, identityLabelValue string) *k8sAppsV1.Deployment { + return &k8sAppsV1.Deployment{ + ObjectMeta: metav1.ObjectMeta{ + Name: name, + Namespace: namespace, + Annotations: map[string]string{ + "env": "test", + "traffic.sidecar.istio.io/includeInboundPorts": "8090", + }, + }, + Spec: k8sAppsV1.DeploymentSpec{ + Template: coreV1.PodTemplateSpec{ + ObjectMeta: metav1.ObjectMeta{ + Annotations: map[string]string{ + "env": "test", + "traffic.sidecar.istio.io/includeInboundPorts": "8090", + }, + Labels: map[string]string{ + "identity": identityLabelValue, + }, + }, + Spec: coreV1.PodSpec{}, + }, + Selector: &v12.LabelSelector{ + MatchLabels: map[string]string{ + "identity": identityLabelValue, + "app": identityLabelValue, + }, + }, + }, + } } func makeTestRollout(name, namespace, identityLabelValue string) argo.Rollout { @@ -72,6 +119,7 @@ func makeTestRollout(name, namespace, identityLabelValue string) argo.Rollout { Labels: map[string]string{"identity": identityLabelValue}, Annotations: map[string]string{ "env": "test", + "traffic.sidecar.istio.io/includeInboundPorts": "8090", }, }, }, @@ -101,54 +149,162 @@ func makeTestRollout(name, namespace, identityLabelValue string) argo.Rollout { func TestModifyServiceEntryForNewServiceOrPodForExcludedAsset(t *testing.T) { setupForServiceEntryTests() var ( - env = "test" - stop = make(chan struct{}) - foobarMetadataName = "foobar" - foobarMetadataNamespace = "foobar-ns" - foobarRollout = makeTestRollout(foobarMetadataName, foobarMetadataNamespace, foobarMetadataName) - clusterID = "test-dev-k8s" - p = common.AdmiralParams{ - KubeconfigPath: "testdata/fake.config", - CacheRefreshDuration: 0, + env = "test" + stop = make(chan struct{}) + foobarMetadataName = "foobar" + foobarMetadataNamespace = "foobar-ns" + rollout1Identity = "rollout1" + deployment1Identity = "deployment1" + testRollout1 = makeTestRollout(foobarMetadataName, foobarMetadataNamespace, rollout1Identity) + testDeployment1 = makeTestDeployment(foobarMetadataName, foobarMetadataNamespace, deployment1Identity) + clusterID = "test-dev-k8s" + fakeIstioClient = istiofake.NewSimpleClientset() + config = rest.Config{Host: "localhost"} + expectedServiceEntriesForDeployment = map[string]*istioNetworkingV1Alpha3.ServiceEntry{ + "test." + deployment1Identity + ".mesh": &istioNetworkingV1Alpha3.ServiceEntry{ + Hosts: []string{"test." + deployment1Identity + ".mesh"}, + Addresses: []string{"127.0.0.1"}, + Ports: []*istioNetworkingV1Alpha3.Port{ + &istioNetworkingV1Alpha3.Port{ + Number: 80, + Protocol: "http", + Name: "http", + }, + }, + Location: istioNetworkingV1Alpha3.ServiceEntry_MESH_INTERNAL, + Resolution: istioNetworkingV1Alpha3.ServiceEntry_DNS, + Endpoints: []*istioNetworkingV1Alpha3.WorkloadEntry{ + &istioNetworkingV1Alpha3.WorkloadEntry{ + Address: "dummy.admiral.global", + Ports: map[string]uint32{ + "http": 0, + }, + Locality: "us-west-2", + }, + }, + SubjectAltNames: []string{"spiffe://prefix/" + deployment1Identity}, + }, } - config = rest.Config{Host: "localhost"} - foobarCanaryService = &coreV1.Service{ + /* + expectedServiceEntriesForRollout = map[string]*istioNetworkingV1Alpha3.ServiceEntry{ + "test." + deployment1Identity + ".mesh": &istioNetworkingV1Alpha3.ServiceEntry{ + Hosts: []string{"test." + rollout1Identity + ".mesh"}, + Addresses: []string{"127.0.0.1"}, + Ports: []*istioNetworkingV1Alpha3.Port{ + &istioNetworkingV1Alpha3.Port{ + Number: 80, + Protocol: "http", + Name: "http", + }, + }, + Location: istioNetworkingV1Alpha3.ServiceEntry_MESH_INTERNAL, + Resolution: istioNetworkingV1Alpha3.ServiceEntry_DNS, + Endpoints: []*istioNetworkingV1Alpha3.WorkloadEntry{ + &istioNetworkingV1Alpha3.WorkloadEntry{ + Address: "dummy.admiral.global", + Ports: map[string]uint32{ + "http": 0, + }, + Locality: "us-west-2", + }, + }, + SubjectAltNames: []string{"spiffe://prefix/" + rollout1Identity}, + }, + } + */ + serviceEntryAddressStore = &ServiceEntryAddressStore{ + EntryAddresses: map[string]string{ + "test." + deployment1Identity + ".mesh-se": "127.0.0.1", + "test." + rollout1Identity + ".mesh-se": "127.0.0.1", + }, + Addresses: []string{}, + } + serviceForRollout = &coreV1.Service{ ObjectMeta: v12.ObjectMeta{ - Name: foobarMetadataName + "-canary", + Name: foobarMetadataName + "-stable", Namespace: foobarMetadataNamespace, }, Spec: coreV1.ServiceSpec{ - Selector: map[string]string{"app": foobarMetadataName}, + Selector: map[string]string{"app": rollout1Identity}, + Ports: []coreV1.ServicePort{ + { + Name: "http", + Port: 8090, + }, + }, + }, + } + serviceForDeployment = &coreV1.Service{ + ObjectMeta: v12.ObjectMeta{ + Name: foobarMetadataName, + Namespace: foobarMetadataNamespace, + }, + Spec: coreV1.ServiceSpec{ + Selector: map[string]string{"app": deployment1Identity}, + Ports: []coreV1.ServicePort{ + { + Name: "http", + Port: 8090, + }, + }, }, } - rr1, _ = InitAdmiral(context.Background(), p) - rr2, _ = InitAdmiral(context.Background(), p) + rr1, _ = InitAdmiral(context.Background(), admiralParams()) + rr2, _ = InitAdmiral(context.Background(), admiralParams()) ) deploymentController, err := admiral.NewDeploymentController(clusterID, make(chan struct{}), &test.MockDeploymentHandler{}, &config, time.Second*time.Duration(300)) if err != nil { t.Fail() } + deploymentController.Cache.UpdateDeploymentToClusterCache(deployment1Identity, testDeployment1) rolloutController, err := admiral.NewRolloutsController(clusterID, make(chan struct{}), &test.MockRolloutHandler{}, &config, time.Second*time.Duration(300)) if err != nil { t.Fail() } - rolloutController.Cache.UpdateRolloutToClusterCache("foobar", &foobarRollout) + rolloutController.Cache.UpdateRolloutToClusterCache(rollout1Identity, &testRollout1) serviceController, err := admiral.NewServiceController(clusterID, stop, &test.MockServiceHandler{}, &config, time.Second*time.Duration(300)) if err != nil { t.Fatalf("%v", err) } - serviceController.Cache.Put(foobarCanaryService) + virtualServiceController, err := istio.NewVirtualServiceController(clusterID, make(chan struct{}), &test.MockVirtualServiceHandler{}, &config, time.Second*time.Duration(300)) + if err != nil { + t.Fatalf("%v", err) + } + gtpc, err := admiral.NewGlobalTrafficController("", make(chan struct{}), &test.MockGlobalTrafficHandler{}, &config, time.Second*time.Duration(300)) + if err != nil { + t.Fatalf("%v", err) + t.FailNow() + } + t.Logf("expectedServiceEntriesForDeployment: %v\n", expectedServiceEntriesForDeployment) + serviceController.Cache.Put(serviceForRollout) + serviceController.Cache.Put(serviceForDeployment) rc := &RemoteController{ - DeploymentController: deploymentController, - RolloutController: rolloutController, - ServiceController: serviceController, + ClusterID: clusterID, + DeploymentController: deploymentController, + RolloutController: rolloutController, + ServiceController: serviceController, + VirtualServiceController: virtualServiceController, + NodeController: &admiral.NodeController{ + Locality: &admiral.Locality{ + Region: "us-west-2", + }, + }, + ServiceEntryController: &istio.ServiceEntryController{ + IstioClient: fakeIstioClient, + }, + DestinationRuleController: &istio.DestinationRuleController{ + IstioClient: fakeIstioClient, + }, + GlobalTraffic: gtpc, } rr1.PutRemoteController(clusterID, rc) rr1.ExcludeAssetList = []string{"asset1"} rr1.StartTime = time.Now() + rr1.AdmiralCache.ServiceEntryAddressStore = serviceEntryAddressStore rr2.PutRemoteController(clusterID, rc) rr2.StartTime = time.Now() + rr2.AdmiralCache.ServiceEntryAddressStore = serviceEntryAddressStore testCases := []struct { name string @@ -157,24 +313,69 @@ func TestModifyServiceEntryForNewServiceOrPodForExcludedAsset(t *testing.T) { expectedServiceEntries map[string]*istioNetworkingV1Alpha3.ServiceEntry }{ { - name: "when asset is in the exclude list", + name: "Given asset is using a deployment," + + "And asset is in the exclude list, " + + "When modifyServiceEntryForNewServiceOrPod is called, " + + "Then, it should skip creating service entries, and return an empty map of service entries", assetIdentity: "asset1", remoteRegistry: rr1, expectedServiceEntries: nil, }, { - name: "when asset is NOT in the exclude list", - assetIdentity: "foobar", - remoteRegistry: rr2, + name: "Given asset is using a rollout," + + "And asset is in the exclude list, " + + "When modifyServiceEntryForNewServiceOrPod is called, " + + "Then, it should skip creating service entries, and return an empty map of service entries", + assetIdentity: "asset1", + remoteRegistry: rr1, expectedServiceEntries: nil, }, + { + name: "Given asset is using a deployment, " + + "And asset is NOT in the exclude list" + + "When modifyServiceEntryForNewServiceOrPod is called, " + + "Then, corresponding service entry should be created, " + + "And the function should return a map containing the created service entry", + assetIdentity: deployment1Identity, + remoteRegistry: rr2, + expectedServiceEntries: expectedServiceEntriesForDeployment, + }, + /* + { + name: "Given asset is using a rollout, " + + "And asset is NOT in the exclude list" + + "When modifyServiceEntryForNewServiceOrPod is called, " + + "Then, corresponding service entry should be created, " + + "And the function should return a map containing the created service entry", + assetIdentity: rollout1Identity, + remoteRegistry: rr2, + expectedServiceEntries: expectedServiceEntriesForRollout, + }, + */ } for _, c := range testCases { t.Run(c.name, func(t *testing.T) { - serviceEntries := modifyServiceEntryForNewServiceOrPod(context.Background(), admiral.Add, env, c.assetIdentity, c.remoteRegistry) + serviceEntries := modifyServiceEntryForNewServiceOrPod( + context.Background(), + admiral.Add, + env, + c.assetIdentity, + c.remoteRegistry, + ) if len(serviceEntries) != len(c.expectedServiceEntries) { t.Fatalf("expected service entries to be of length: %d, but got: %d", len(c.expectedServiceEntries), len(serviceEntries)) } + if len(c.expectedServiceEntries) > 0 { + for k := range c.expectedServiceEntries { + if serviceEntries[k] == nil { + t.Fatalf( + "expected service entries to contain service entry for: %s, "+ + "but did not find it. Got map: %v", + k, serviceEntries, + ) + } + } + } }) } } @@ -394,7 +595,10 @@ func TestCreateServiceEntryForNewServiceOrPod(t *testing.T) { p := common.AdmiralParams{ KubeconfigPath: "testdata/fake.config", } - rr, _ := InitAdmiral(context.Background(), p) + rr, err := InitAdmiral(context.Background(), p) + if err != nil { + t.Fatalf("unable to initialize admiral, err: %v", err) + } rr.StartTime = time.Now().Add(-60 * time.Second) config := rest.Config{ @@ -593,10 +797,10 @@ func TestMakeRemoteEndpointForServiceEntry(t *testing.T) { } } -func buildFakeConfigMapFromAddressStore(addressStore *ServiceEntryAddressStore, resourceVersion string) *v1.ConfigMap { +func buildFakeConfigMapFromAddressStore(addressStore *ServiceEntryAddressStore, resourceVersion string) *coreV1.ConfigMap { bytes, _ := yaml.Marshal(addressStore) - cm := v1.ConfigMap{ + cm := coreV1.ConfigMap{ Data: map[string]string{"serviceEntryAddressStore": string(bytes)}, } cm.Name = "se-address-configmap" @@ -660,6 +864,7 @@ func TestModifyExistingSidecarForLocalClusterCommunication(t *testing.T) { sidecarEgressMap := make(map[string]common.SidecarEgress) sidecarEgressMap["test-dependency-namespace"] = common.SidecarEgress{Namespace: "test-dependency-namespace", FQDN: "test-local-fqdn", CNAMEs: map[string]string{"test.myservice.global": "1"}} + time.Sleep(5 * time.Second) modifySidecarForLocalClusterCommunication(ctx, "test-sidecar-namespace", sidecarEgressMap, remoteController) updatedSidecar, err := sidecarController.IstioClient.NetworkingV1alpha3().Sidecars("test-sidecar-namespace").Get(ctx, "default", v12.GetOptions{}) @@ -695,6 +900,7 @@ func TestModifyExistingSidecarForLocalClusterCommunication(t *testing.T) { newHosts := matched.Hosts listener.Hosts = listener.Hosts[:0] matched.Hosts = matched.Hosts[:0] + t.Logf("old: %v, new: %v", oldHosts, newHosts) assert.ElementsMatch(t, oldHosts, newHosts, "hosts should match") if !cmp.Equal(listener, matched, protocmp.Transform()) { t.Fatalf("Listeners do not match. Details - %v", cmp.Diff(listener, matched)) @@ -997,9 +1203,11 @@ func TestCreateServiceEntryForNewServiceOrPodRolloutsUsecase(t *testing.T) { p = common.AdmiralParams{ KubeconfigPath: "testdata/fake.config", } - rr, _ = InitAdmiral(context.Background(), p) ) - + rr, err := InitAdmiral(context.Background(), p) + if err != nil { + t.Fatalf("unable to initialize admiral, err: %v", err) + } rr.StartTime = time.Now().Add(-60 * time.Second) d, err := admiral.NewDeploymentController("", make(chan struct{}), &test.MockDeploymentHandler{}, &config, time.Second*time.Duration(300)) if err != nil { @@ -1141,12 +1349,14 @@ func TestCreateServiceEntryForBlueGreenRolloutsUsecase(t *testing.T) { KubeconfigPath: "testdata/fake.config", PreviewHostnamePrefix: "preview", } - rr, _ = InitAdmiral(context.Background(), p) config = rest.Config{ Host: "localhost", } ) - + rr, err := InitAdmiral(context.Background(), p) + if err != nil { + t.Fatalf("unable to initialize admiral, err: %v", err) + } rr.StartTime = time.Now().Add(-60 * time.Second) d, err := admiral.NewDeploymentController("", make(chan struct{}), &test.MockDeploymentHandler{}, &config, time.Second*time.Duration(300)) if err != nil { @@ -1340,8 +1550,8 @@ func TestUpdateEndpointsForBlueGreen(t *testing.T) { } weightedServices := map[string]*WeightedService{ - activeService: {Service: &v1.Service{ObjectMeta: v12.ObjectMeta{Name: activeService, Namespace: namespace}}}, - previewService: {Service: &v1.Service{ObjectMeta: v12.ObjectMeta{Name: previewService, Namespace: namespace}}}, + activeService: {Service: &coreV1.Service{ObjectMeta: v12.ObjectMeta{Name: activeService, Namespace: namespace}}}, + previewService: {Service: &coreV1.Service{ObjectMeta: v12.ObjectMeta{Name: previewService, Namespace: namespace}}}, } activeWantedEndpoints := &istioNetworkingV1Alpha3.WorkloadEntry{ @@ -1411,12 +1621,12 @@ func TestUpdateEndpointsForWeightedServices(t *testing.T) { }, } weightedServices = map[string]*WeightedService{ - canaryService: {Weight: 10, Service: &v1.Service{ObjectMeta: v12.ObjectMeta{Name: canaryService, Namespace: namespace}}}, - stableService: {Weight: 90, Service: &v1.Service{ObjectMeta: v12.ObjectMeta{Name: stableService, Namespace: namespace}}}, + canaryService: {Weight: 10, Service: &coreV1.Service{ObjectMeta: v12.ObjectMeta{Name: canaryService, Namespace: namespace}}}, + stableService: {Weight: 90, Service: &coreV1.Service{ObjectMeta: v12.ObjectMeta{Name: stableService, Namespace: namespace}}}, } weightedServicesZeroWeight = map[string]*WeightedService{ - canaryService: {Weight: 0, Service: &v1.Service{ObjectMeta: v12.ObjectMeta{Name: canaryService, Namespace: namespace}}}, - stableService: {Weight: 100, Service: &v1.Service{ObjectMeta: v12.ObjectMeta{Name: stableService, Namespace: namespace}}}, + canaryService: {Weight: 0, Service: &coreV1.Service{ObjectMeta: v12.ObjectMeta{Name: canaryService, Namespace: namespace}}}, + stableService: {Weight: 100, Service: &coreV1.Service{ObjectMeta: v12.ObjectMeta{Name: stableService, Namespace: namespace}}}, } wantedEndpoints = []*istioNetworkingV1Alpha3.WorkloadEntry{ {Address: clusterIngress2, Weight: 10, Ports: map[string]uint32{"http": 15443}}, diff --git a/admiral/pkg/clusters/types.go b/admiral/pkg/clusters/types.go index a5f329b4..c45bf54a 100644 --- a/admiral/pkg/clusters/types.go +++ b/admiral/pkg/clusters/types.go @@ -268,13 +268,11 @@ type routingPolicyFilterCache struct { func (r *routingPolicyFilterCache) Get(identityEnvKey string) (filters map[string]map[string]string) { defer r.mutex.Unlock() r.mutex.Lock() - fmt.Printf("r.filterCache: %+v", r.filterCache) return r.filterCache[identityEnvKey] } func (r *routingPolicyFilterCache) Put(identityEnvKey string, clusterId string, filterName string) { defer r.mutex.Unlock() - fmt.Printf("identityEnvKey: %v\n", identityEnvKey) r.mutex.Lock() if r.filterCache[identityEnvKey] == nil { r.filterCache[identityEnvKey] = make(map[string]map[string]string) @@ -297,9 +295,7 @@ func (r *routingPolicyFilterCache) Delete(identityEnvKey string) { } } func (r RoutingPolicyHandler) Added(ctx context.Context, obj *v1.RoutingPolicy) { - fmt.Println("comes inside Added") if common.GetEnableRoutingPolicy() { - fmt.Println("routing policy is enabled") if common.ShouldIgnoreResource(obj.ObjectMeta) { log.Infof(LogFormat, "success", "routingpolicy", obj.Name, "", "Ignored the RoutingPolicy because of the annotation") return @@ -320,7 +316,6 @@ func (r RoutingPolicyHandler) Added(ctx context.Context, obj *v1.RoutingPolicy) func (r RoutingPolicyHandler) processRoutingPolicy(ctx context.Context, dependents map[string]string, routingPolicy *v1.RoutingPolicy, eventType admiral.EventType) { for _, remoteController := range r.RemoteRegistry.remoteControllers { for _, dependent := range dependents { - fmt.Printf("dependent: %v\n", dependent) // Check if the dependent exists in this remoteCluster. If so, we create an envoyFilter with dependent identity as workload selector if _, ok := r.RemoteRegistry.AdmiralCache.IdentityClusterCache.Get(dependent).Copy()[remoteController.ClusterID]; ok { selectors := r.RemoteRegistry.AdmiralCache.WorkloadSelectorCache.Get(dependent + remoteController.ClusterID).Copy() diff --git a/admiral/pkg/clusters/types_test.go b/admiral/pkg/clusters/types_test.go index cc5645f5..b22f92ff 100644 --- a/admiral/pkg/clusters/types_test.go +++ b/admiral/pkg/clusters/types_test.go @@ -28,6 +28,7 @@ var typeTestSingleton sync.Once func setupForTypeTests() { typeTestSingleton.Do(func() { + common.ResetSync() p := common.AdmiralParams{ KubeconfigPath: "testdata/fake.config", LabelSet: &common.LabelSet{}, diff --git a/admiral/pkg/clusters/util_test.go b/admiral/pkg/clusters/util_test.go index d418177f..e5d8dd01 100644 --- a/admiral/pkg/clusters/util_test.go +++ b/admiral/pkg/clusters/util_test.go @@ -2,56 +2,49 @@ package clusters import ( "errors" + "reflect" + "strconv" + "testing" + argo "github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1" "github.com/istio-ecosystem/admiral/admiral/pkg/controller/common" k8sAppsV1 "k8s.io/api/apps/v1" coreV1 "k8s.io/api/core/v1" k8sV1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" - "reflect" - "strconv" - "testing" ) func TestGetMeshPorts(t *testing.T) { - - annotatedPort := 8090 - annotatedSecondPort := 8091 - defaultServicePort := uint32(8080) - - defaultK8sSvcPortNoName := k8sV1.ServicePort{Port: int32(defaultServicePort)} - defaultK8sSvcPort := k8sV1.ServicePort{Name: "default", Port: int32(defaultServicePort)} - meshK8sSvcPort := k8sV1.ServicePort{Name: "mesh", Port: int32(annotatedPort)} - - serviceMeshPorts := []k8sV1.ServicePort{defaultK8sSvcPort, meshK8sSvcPort} - - serviceMeshPortsOnlyDefault := []k8sV1.ServicePort{defaultK8sSvcPortNoName} - - service := k8sV1.Service{ - ObjectMeta: v1.ObjectMeta{Name: "server", Labels: map[string]string{"asset": "Intuit.platform.mesh.server"}}, - Spec: k8sV1.ServiceSpec{Ports: serviceMeshPorts}, - } - deployment := k8sAppsV1.Deployment{ - Spec: k8sAppsV1.DeploymentSpec{Template: coreV1.PodTemplateSpec{ - ObjectMeta: v1.ObjectMeta{Annotations: map[string]string{common.SidecarEnabledPorts: strconv.Itoa(annotatedPort)}}, - }}} - - deploymentWithMultipleMeshPorts := k8sAppsV1.Deployment{ - Spec: k8sAppsV1.DeploymentSpec{Template: coreV1.PodTemplateSpec{ - ObjectMeta: v1.ObjectMeta{Annotations: map[string]string{common.SidecarEnabledPorts: strconv.Itoa(annotatedPort) + "," + strconv.Itoa(annotatedSecondPort)}}, - }}} - - ports := map[string]uint32{"http": uint32(annotatedPort)} - portsDiffTargetPort := map[string]uint32{"http": uint32(80)} - - grpcPorts := map[string]uint32{"grpc": uint32(annotatedPort)} - grpcWebPorts := map[string]uint32{"grpc-web": uint32(annotatedPort)} - http2Ports := map[string]uint32{"http2": uint32(annotatedPort)} - - portsFromDefaultSvcPort := map[string]uint32{"http": defaultServicePort} - - emptyPorts := map[string]uint32{} + var ( + annotatedPort = 8090 + annotatedSecondPort = 8091 + defaultServicePort = uint32(8080) + ports = map[string]uint32{"http": uint32(annotatedPort)} + portsDiffTargetPort = map[string]uint32{"http": uint32(80)} + grpcPorts = map[string]uint32{"grpc": uint32(annotatedPort)} + grpcWebPorts = map[string]uint32{"grpc-web": uint32(annotatedPort)} + http2Ports = map[string]uint32{"http2": uint32(annotatedPort)} + portsFromDefaultSvcPort = map[string]uint32{"http": defaultServicePort} + emptyPorts = map[string]uint32{} + defaultK8sSvcPortNoName = k8sV1.ServicePort{Port: int32(defaultServicePort)} + defaultK8sSvcPort = k8sV1.ServicePort{Name: "default", Port: int32(defaultServicePort)} + meshK8sSvcPort = k8sV1.ServicePort{Name: "mesh", Port: int32(annotatedPort)} + serviceMeshPorts = []k8sV1.ServicePort{defaultK8sSvcPort, meshK8sSvcPort} + serviceMeshPortsOnlyDefault = []k8sV1.ServicePort{defaultK8sSvcPortNoName} + service = k8sV1.Service{ + ObjectMeta: v1.ObjectMeta{Name: "server", Labels: map[string]string{"asset": "Intuit.platform.mesh.server"}}, + Spec: k8sV1.ServiceSpec{Ports: serviceMeshPorts}, + } + deployment = k8sAppsV1.Deployment{ + Spec: k8sAppsV1.DeploymentSpec{Template: coreV1.PodTemplateSpec{ + ObjectMeta: v1.ObjectMeta{Annotations: map[string]string{common.SidecarEnabledPorts: strconv.Itoa(annotatedPort)}}, + }}} + deploymentWithMultipleMeshPorts = k8sAppsV1.Deployment{ + Spec: k8sAppsV1.DeploymentSpec{Template: coreV1.PodTemplateSpec{ + ObjectMeta: v1.ObjectMeta{Annotations: map[string]string{common.SidecarEnabledPorts: strconv.Itoa(annotatedPort) + "," + strconv.Itoa(annotatedSecondPort)}}, + }}} + ) testCases := []struct { name string @@ -67,17 +60,17 @@ func TestGetMeshPorts(t *testing.T) { expected: ports, }, { - name: "should return a http port if no port name is specified", - service: k8sV1.Service{ + name: "should return a http port if no port name is specified", + service: k8sV1.Service{ ObjectMeta: v1.ObjectMeta{Name: "server", Labels: map[string]string{"asset": "Intuit.platform.mesh.server"}}, - Spec: k8sV1.ServiceSpec{Ports: []k8sV1.ServicePort{{Port: int32(80), TargetPort: intstr.FromInt(annotatedPort),}}}, + Spec: k8sV1.ServiceSpec{Ports: []k8sV1.ServicePort{{Port: int32(80), TargetPort: intstr.FromInt(annotatedPort)}}}, }, deployment: deployment, expected: portsDiffTargetPort, }, { - name: "should return a http port if the port name doesn't start with a protocol name", - service: k8sV1.Service{ + name: "should return a http port if the port name doesn't start with a protocol name", + service: k8sV1.Service{ ObjectMeta: v1.ObjectMeta{Name: "server", Labels: map[string]string{"asset": "Intuit.platform.mesh.server"}}, Spec: k8sV1.ServiceSpec{Ports: []k8sV1.ServicePort{{Name: "hello-grpc", Port: int32(annotatedPort)}}}, }, @@ -85,8 +78,8 @@ func TestGetMeshPorts(t *testing.T) { expected: ports, }, { - name: "should return a grpc port based on annotation", - service: k8sV1.Service{ + name: "should return a grpc port based on annotation", + service: k8sV1.Service{ ObjectMeta: v1.ObjectMeta{Name: "server", Labels: map[string]string{"asset": "Intuit.platform.mesh.server"}}, Spec: k8sV1.ServiceSpec{Ports: []k8sV1.ServicePort{{Name: "grpc-service", Port: int32(annotatedPort)}}}, }, @@ -94,8 +87,8 @@ func TestGetMeshPorts(t *testing.T) { expected: grpcPorts, }, { - name: "should return a grpc-web port based on annotation", - service: k8sV1.Service{ + name: "should return a grpc-web port based on annotation", + service: k8sV1.Service{ ObjectMeta: v1.ObjectMeta{Name: "server", Labels: map[string]string{"asset": "Intuit.platform.mesh.server"}}, Spec: k8sV1.ServiceSpec{Ports: []k8sV1.ServicePort{{Name: "grpc-web", Port: int32(annotatedPort)}}}, }, @@ -103,8 +96,8 @@ func TestGetMeshPorts(t *testing.T) { expected: grpcWebPorts, }, { - name: "should return a http2 port based on annotation", - service: k8sV1.Service{ + name: "should return a http2 port based on annotation", + service: k8sV1.Service{ ObjectMeta: v1.ObjectMeta{Name: "server", Labels: map[string]string{"asset": "Intuit.platform.mesh.server"}}, Spec: k8sV1.ServiceSpec{Ports: []k8sV1.ServicePort{{Name: "http2", Port: int32(annotatedPort)}}}, }, @@ -136,10 +129,10 @@ func TestGetMeshPorts(t *testing.T) { expected: emptyPorts, }, { - name: "should return a http port if the port name doesn't start with a protocol name", - service: k8sV1.Service{ + name: "should return a http port if the port name doesn't start with a protocol name", + service: k8sV1.Service{ ObjectMeta: v1.ObjectMeta{Name: "server", Labels: map[string]string{"asset": "Intuit.platform.mesh.server"}}, - Spec: k8sV1.ServiceSpec{Ports: []k8sV1.ServicePort{{Name: "http", Port: int32(annotatedPort)}, + Spec: k8sV1.ServiceSpec{Ports: []k8sV1.ServicePort{{Name: "http", Port: int32(annotatedPort)}, {Name: "grpc", Port: int32(annotatedSecondPort)}}}, }, deployment: deploymentWithMultipleMeshPorts, @@ -216,51 +209,51 @@ func TestValidateConfigmapBeforePutting(t *testing.T) { func TestGetServiceSelector(t *testing.T) { - selector := map[string]string {"app":"test1"} + selector := map[string]string{"app": "test1"} testCases := []struct { name string clusterName string service k8sV1.Service expected map[string]string - }{ + }{ { name: "should return a selectors based on service", clusterName: "test-cluster", - service: k8sV1.Service{ + service: k8sV1.Service{ ObjectMeta: v1.ObjectMeta{Name: "server", Labels: map[string]string{"asset": "Intuit.platform.mesh.server"}}, - Spec: k8sV1.ServiceSpec{Selector: selector}, + Spec: k8sV1.ServiceSpec{Selector: selector}, }, - expected: selector, + expected: selector, }, { name: "should return empty selectors", clusterName: "test-cluster", - service: k8sV1.Service{ + service: k8sV1.Service{ ObjectMeta: v1.ObjectMeta{Name: "server", Labels: map[string]string{"asset": "Intuit.platform.mesh.server"}}, Spec: k8sV1.ServiceSpec{Selector: map[string]string{}}, }, - expected: nil, + expected: nil, }, { name: "should return nil", clusterName: "test-cluster", - service: k8sV1.Service{ + service: k8sV1.Service{ ObjectMeta: v1.ObjectMeta{Name: "server", Labels: map[string]string{"asset": "Intuit.platform.mesh.server"}}, Spec: k8sV1.ServiceSpec{Selector: nil}, }, - expected: nil, + expected: nil, }, } for _, c := range testCases { t.Run(c.name, func(t *testing.T) { - selectors := GetServiceSelector(c.clusterName,&c.service) + selectors := GetServiceSelector(c.clusterName, &c.service) if selectors == nil { if c.expected != nil { t.Errorf("Wanted selectors: %v, got: %v", c.expected, selectors) } - }else if !reflect.DeepEqual(selectors.Copy(), c.expected) { + } else if !reflect.DeepEqual(selectors.Copy(), c.expected) { t.Errorf("Wanted selectors: %v, got: %v", c.expected, selectors) } }) diff --git a/admiral/pkg/controller/common/config.go b/admiral/pkg/controller/common/config.go index 29fa0a39..0d26534a 100644 --- a/admiral/pkg/controller/common/config.go +++ b/admiral/pkg/controller/common/config.go @@ -25,7 +25,9 @@ func InitializeConfig(params AdmiralParams) { initHappened = true InitializeMetrics() }) - if !initHappened { + if initHappened { + log.Info("InitializeConfig was called.") + } else { log.Warn("InitializeConfig was called but didn't take effect. It can only be called once, and thus has already been initialized. Please ensure you aren't re-initializing the config.") } } From a4441e674a62658bdea4348d318cce5c8aff989b Mon Sep 17 00:00:00 2001 From: Anubhav Aeron Date: Mon, 19 Sep 2022 12:59:16 -0700 Subject: [PATCH 7/7] fix tests --- admiral/pkg/clusters/handler.go | 5 ----- admiral/pkg/clusters/handler_test.go | 4 ---- admiral/pkg/clusters/serviceentry_test.go | 18 +++--------------- admiral/pkg/clusters/types_test.go | 6 ------ 4 files changed, 3 insertions(+), 30 deletions(-) diff --git a/admiral/pkg/clusters/handler.go b/admiral/pkg/clusters/handler.go index 4b7a1f8d..24f46e63 100644 --- a/admiral/pkg/clusters/handler.go +++ b/admiral/pkg/clusters/handler.go @@ -9,16 +9,12 @@ import ( "time" argo "github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1" - "github.com/golang/protobuf/ptypes/duration" - "github.com/golang/protobuf/ptypes/wrappers" - "github.com/google/go-cmp/cmp" "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/model" v1 "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/v1" "github.com/istio-ecosystem/admiral/admiral/pkg/controller/admiral" "github.com/istio-ecosystem/admiral/admiral/pkg/controller/common" "github.com/istio-ecosystem/admiral/admiral/pkg/controller/util" - argo "github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1" "github.com/golang/protobuf/ptypes/duration" "github.com/golang/protobuf/ptypes/wrappers" "github.com/google/go-cmp/cmp" @@ -91,7 +87,6 @@ func getDestinationRule(se *v1alpha32.ServiceEntry, locality string, gtpTrafficP dr = &v1alpha32.DestinationRule{} ) dr.Host = se.Hosts[0] - processGtp := true dr.TrafficPolicy = &v1alpha32.TrafficPolicy{ Tls: &v1alpha32.ClientTLSSettings{ Mode: v1alpha32.ClientTLSSettings_ISTIO_MUTUAL, diff --git a/admiral/pkg/clusters/handler_test.go b/admiral/pkg/clusters/handler_test.go index f52d234f..8fcdb36e 100644 --- a/admiral/pkg/clusters/handler_test.go +++ b/admiral/pkg/clusters/handler_test.go @@ -17,10 +17,6 @@ import ( "github.com/istio-ecosystem/admiral/admiral/pkg/controller/istio" "github.com/istio-ecosystem/admiral/admiral/pkg/test" - argo "github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1" - "github.com/golang/protobuf/ptypes/duration" - "github.com/golang/protobuf/ptypes/wrappers" - "github.com/google/go-cmp/cmp" "github.com/stretchr/testify/assert" "google.golang.org/protobuf/testing/protocmp" "istio.io/api/networking/v1alpha3" diff --git a/admiral/pkg/clusters/serviceentry_test.go b/admiral/pkg/clusters/serviceentry_test.go index 60ec64c3..f1e51b4b 100644 --- a/admiral/pkg/clusters/serviceentry_test.go +++ b/admiral/pkg/clusters/serviceentry_test.go @@ -405,9 +405,9 @@ func TestAddServiceEntriesWithDr(t *testing.T) { Endpoints: []*istioNetworkingV1Alpha3.WorkloadEntry{}, } - dummyEndpointSe := istionetworkingv1alpha3.ServiceEntry{ + dummyEndpointSe := istioNetworkingV1Alpha3.ServiceEntry{ Hosts: []string{"dev.dummy.global"}, - Endpoints: []*istionetworkingv1alpha3.WorkloadEntry{ + Endpoints: []*istioNetworkingV1Alpha3.WorkloadEntry{ {Address: "dummy.admiral.global", Ports: map[string]uint32{"https": 80}, Labels: map[string]string{}, Network: "mesh1", Locality: "us-west", Weight: 100}, }, } @@ -447,7 +447,7 @@ func TestAddServiceEntriesWithDr(t *testing.T) { rr.AdmiralCache = &admiralCache AddServiceEntriesWithDr(ctx, rr, map[string]string{"cl1": "cl1"}, map[string]*istioNetworkingV1Alpha3.ServiceEntry{"se1": &se}) AddServiceEntriesWithDr(ctx, rr, map[string]string{"cl1": "cl1"}, map[string]*istioNetworkingV1Alpha3.ServiceEntry{"se1": &emptyEndpointSe}) - AddServiceEntriesWithDr(ctx, rr, map[string]string{"cl1": "cl1"}, map[string]*istioNetworkingV1Alpha3.ServiceEntry{"dummySe": &dummyEndpointSe}) + AddServiceEntriesWithDr(ctx, rr, map[string]string{"cl1": "cl1"}, map[string]*istioNetworkingV1Alpha3.ServiceEntry{"dummySe": &dummyEndpointSe}) } func TestCreateSeAndDrSetFromGtp(t *testing.T) { @@ -836,14 +836,7 @@ func TestModifyNonExistingSidecarForLocalClusterCommunication(t *testing.T) { remoteController.SidecarController = sidecarController sidecarEgressMap["test-dependency-namespace"] = common.SidecarEgress{Namespace: "test-dependency-namespace", FQDN: "test-local-fqdn"} - ctx := context.Background() - modifySidecarForLocalClusterCommunication(ctx, "test-sidecar-namespace", sidecarEgressMap, remoteController) - sidecarObj, err := sidecarController.IstioClient.NetworkingV1alpha3().Sidecars("test-sidecar-namespace").Get(ctx, common.GetWorkloadSidecarName(), v12.GetOptions{}) - if err == nil { - t.Errorf("expected 404 not found error but got nil") - } - sidecarObj, err := sidecarController.IstioClient.NetworkingV1alpha3().Sidecars("test-sidecar-namespace").Get(ctx, common.GetWorkloadSidecarName(), v12.GetOptions{}) if err == nil { t.Errorf("expected 404 not found error but got nil") @@ -880,11 +873,6 @@ func TestModifyExistingSidecarForLocalClusterCommunication(t *testing.T) { t.Error(err) } - ctx := context.Background() - createdSidecar, err := sidecarController.IstioClient.NetworkingV1alpha3().Sidecars("test-sidecar-namespace").Create(ctx, existingSidecarObj, v12.CreateOptions{}) - if err != nil { - t.Error(err) - } if createdSidecar != nil { sidecarEgressMap := make(map[string]common.SidecarEgress) sidecarEgressMap["test-dependency-namespace"] = common.SidecarEgress{Namespace: "test-dependency-namespace", FQDN: "test-local-fqdn", CNAMEs: map[string]string{"test.myservice.global": "1"}} diff --git a/admiral/pkg/clusters/types_test.go b/admiral/pkg/clusters/types_test.go index c6038c08..128c4a68 100644 --- a/admiral/pkg/clusters/types_test.go +++ b/admiral/pkg/clusters/types_test.go @@ -54,9 +54,6 @@ func setupForTypeTests() { func TestDeploymentHandler(t *testing.T) { setupForTypeTests() ctx := context.Background() - - ctx := context.Background() - p := common.AdmiralParams{ KubeconfigPath: "testdata/fake.config", } @@ -138,9 +135,6 @@ func TestDeploymentHandler(t *testing.T) { func TestRolloutHandler(t *testing.T) { setupForTypeTests() ctx := context.Background() - - ctx := context.Background() - p := common.AdmiralParams{ KubeconfigPath: "testdata/fake.config", }