From 3d1348053c6ccf4dcdeddb2066a3c128928a0d91 Mon Sep 17 00:00:00 2001 From: sa Date: Tue, 19 Jul 2022 11:35:29 +0530 Subject: [PATCH] Revert "Add metric for total events processed (#211) (#124)" This reverts commit ca731ffde560ca0beb2d58c358b8c6b685cf3c09. --- admiral/pkg/clusters/handler_test.go | 10 +- admiral/pkg/clusters/registry.go | 29 +++-- admiral/pkg/clusters/registry_test.go | 12 +- admiral/pkg/clusters/serviceentry_test.go | 26 ++-- admiral/pkg/controller/admiral/controller.go | 34 +---- .../pkg/controller/admiral/controller_test.go | 54 -------- admiral/pkg/controller/admiral/dependency.go | 3 +- admiral/pkg/controller/admiral/deployment.go | 17 +-- .../pkg/controller/admiral/deployment_test.go | 20 +-- .../pkg/controller/admiral/globaltraffic.go | 25 ++-- .../controller/admiral/globaltraffic_test.go | 107 ++++++++-------- admiral/pkg/controller/admiral/node.go | 5 +- admiral/pkg/controller/admiral/node_test.go | 4 +- admiral/pkg/controller/admiral/rollouts.go | 12 +- .../pkg/controller/admiral/rollouts_test.go | 20 +-- admiral/pkg/controller/admiral/service.go | 5 +- .../pkg/controller/admiral/service_test.go | 2 +- admiral/pkg/controller/common/config.go | 1 - admiral/pkg/controller/common/metrics.go | 89 ++----------- admiral/pkg/controller/common/metrics_test.go | 121 ++---------------- .../pkg/controller/istio/destinationrule.go | 5 +- .../controller/istio/destinationrule_test.go | 2 +- admiral/pkg/controller/istio/serviceentry.go | 6 +- .../pkg/controller/istio/serviceentry_test.go | 2 +- admiral/pkg/controller/istio/sidecar.go | 5 +- admiral/pkg/controller/istio/sidecar_test.go | 2 +- .../pkg/controller/istio/virtualservice.go | 5 +- .../controller/istio/virtualservice_test.go | 2 +- .../pkg/controller/secret/secretcontroller.go | 8 +- go.mod | 1 - go.sum | 6 +- .../sample/overlays/deployment/greeting.yaml | 1 - install/sample/overlays/grpc/grpc-server.yaml | 1 - .../overlays/rollout-bluegreen/greeting.yaml | 1 - .../overlays/rollout-canary/greeting.yaml | 1 - 35 files changed, 197 insertions(+), 447 deletions(-) delete mode 100644 admiral/pkg/controller/admiral/controller_test.go diff --git a/admiral/pkg/clusters/handler_test.go b/admiral/pkg/clusters/handler_test.go index 3d8195a6..e2a5d76c 100644 --- a/admiral/pkg/clusters/handler_test.go +++ b/admiral/pkg/clusters/handler_test.go @@ -677,8 +677,8 @@ func TestGetServiceForRolloutCanary(t *testing.T) { } stop := make(chan struct{}) - s, e := admiral.NewServiceController("test", stop, &test.MockServiceHandler{}, &config, time.Second*time.Duration(300)) - r, e := admiral.NewRolloutsController("test", stop, &test.MockRolloutHandler{}, &config, time.Second*time.Duration(300)) + s, e := admiral.NewServiceController(stop, &test.MockServiceHandler{}, &config, time.Second*time.Duration(300)) + r, e := admiral.NewRolloutsController(stop, &test.MockRolloutHandler{}, &config, time.Second*time.Duration(300)) fakeIstioClient := istiofake.NewSimpleClientset() @@ -1105,10 +1105,10 @@ func TestGetServiceForRolloutBlueGreen(t *testing.T) { } stop := make(chan struct{}) - s, e := admiral.NewServiceController("test", stop, &test.MockServiceHandler{}, &config, time.Second*time.Duration(300)) - r, e := admiral.NewRolloutsController("test", stop, &test.MockRolloutHandler{}, &config, time.Second*time.Duration(300)) + s, e := admiral.NewServiceController(stop, &test.MockServiceHandler{}, &config, time.Second*time.Duration(300)) + r, e := admiral.NewRolloutsController(stop, &test.MockRolloutHandler{}, &config, time.Second*time.Duration(300)) - emptyCacheService, e := admiral.NewServiceController("test", stop, &test.MockServiceHandler{}, &config, time.Second*time.Duration(300)) + emptyCacheService, e := admiral.NewServiceController(stop, &test.MockServiceHandler{}, &config, time.Second*time.Duration(300)) if e != nil { t.Fatalf("Inititalization failed") diff --git a/admiral/pkg/clusters/registry.go b/admiral/pkg/clusters/registry.go index 46c85fe0..b8dcb5ae 100644 --- a/admiral/pkg/clusters/registry.go +++ b/admiral/pkg/clusters/registry.go @@ -17,7 +17,7 @@ import ( const ( LogFormat = "op=%s type=%v name=%v cluster=%s message=%s" - LogFormatAdv = "op=%s type=%v name=%v namespace=%s cluster=%s message=%s" + LogFormatAdv = "op=%s type=%v name=%v namespace=%s cluster=%s message=%s" LogErrFormat = "op=%s type=%v name=%v cluster=%s, e=%v" ) @@ -27,13 +27,13 @@ func InitAdmiral(ctx context.Context, params common.AdmiralParams) (*RemoteRegis common.InitializeConfig(params) - as := AdmiralState{ReadOnlyEnabled} - startAdmiralStateChecker(ctx, params, &as) + as:= AdmiralState{ReadOnlyEnabled} + startAdmiralStateChecker(ctx,params,&as) w := RemoteRegistry{ - ctx: ctx, + ctx: ctx, AdmiralState: &as, - StartTime: time.Now(), + StartTime: time.Now(), } wd := DependencyHandler{ @@ -128,7 +128,7 @@ func (r *RemoteRegistry) createCacheController(clientConfig *rest.Config, cluste var err error log.Infof("starting service controller clusterID: %v", clusterID) - rc.ServiceController, err = admiral.NewServiceController(clusterID, stop, &ServiceHandler{RemoteRegistry: r, ClusterID: clusterID}, clientConfig, 0) + rc.ServiceController, err = admiral.NewServiceController(stop, &ServiceHandler{RemoteRegistry: r, ClusterID: clusterID}, clientConfig, 0) if err != nil { return fmt.Errorf("error with ServiceController controller init: %v", err) @@ -136,48 +136,49 @@ func (r *RemoteRegistry) createCacheController(clientConfig *rest.Config, cluste log.Infof("starting global traffic policy controller custerID: %v", clusterID) - rc.GlobalTraffic, err = admiral.NewGlobalTrafficController(clusterID, stop, &GlobalTrafficHandler{RemoteRegistry: r, ClusterID: clusterID}, clientConfig, 0) + rc.GlobalTraffic, err = admiral.NewGlobalTrafficController(stop, &GlobalTrafficHandler{RemoteRegistry: r, ClusterID: clusterID}, clientConfig, 0) if err != nil { return fmt.Errorf("error with GlobalTrafficController controller init: %v", err) } + log.Infof("starting node controller clusterID: %v", clusterID) - rc.NodeController, err = admiral.NewNodeController(clusterID, stop, &NodeHandler{RemoteRegistry: r, ClusterID: clusterID}, clientConfig) + rc.NodeController, err = admiral.NewNodeController(stop, &NodeHandler{RemoteRegistry: r, ClusterID: clusterID}, clientConfig) if err != nil { return fmt.Errorf("error with NodeController controller init: %v", err) } log.Infof("starting service entry controller for custerID: %v", clusterID) - rc.ServiceEntryController, err = istio.NewServiceEntryController(clusterID, stop, &ServiceEntryHandler{RemoteRegistry: r, ClusterID: clusterID}, clientConfig, 0) + rc.ServiceEntryController, err = istio.NewServiceEntryController(stop, &ServiceEntryHandler{RemoteRegistry: r, ClusterID: clusterID}, clientConfig, 0) if err != nil { return fmt.Errorf("error with ServiceEntryController init: %v", err) } log.Infof("starting destination rule controller for custerID: %v", clusterID) - rc.DestinationRuleController, err = istio.NewDestinationRuleController(clusterID, stop, &DestinationRuleHandler{RemoteRegistry: r, ClusterID: clusterID}, clientConfig, 0) + rc.DestinationRuleController, err = istio.NewDestinationRuleController(stop, &DestinationRuleHandler{RemoteRegistry: r, ClusterID: clusterID}, clientConfig, 0) if err != nil { return fmt.Errorf("error with DestinationRuleController init: %v", err) } log.Infof("starting virtual service controller for custerID: %v", clusterID) - rc.VirtualServiceController, err = istio.NewVirtualServiceController(clusterID, stop, &VirtualServiceHandler{RemoteRegistry: r, ClusterID: clusterID}, clientConfig, 0) + rc.VirtualServiceController, err = istio.NewVirtualServiceController(stop, &VirtualServiceHandler{RemoteRegistry: r, ClusterID: clusterID}, clientConfig, 0) if err != nil { return fmt.Errorf("error with VirtualServiceController init: %v", err) } - rc.SidecarController, err = istio.NewSidecarController(clusterID, stop, &SidecarHandler{RemoteRegistry: r, ClusterID: clusterID}, clientConfig, 0) + rc.SidecarController, err = istio.NewSidecarController(stop, &SidecarHandler{RemoteRegistry: r, ClusterID: clusterID}, clientConfig, 0) if err != nil { return fmt.Errorf("error with DestinationRuleController init: %v", err) } log.Infof("starting deployment controller clusterID: %v", clusterID) - rc.DeploymentController, err = admiral.NewDeploymentController(clusterID, stop, &DeploymentHandler{RemoteRegistry: r, ClusterID: clusterID}, clientConfig, resyncPeriod) + rc.DeploymentController, err = admiral.NewDeploymentController(stop, &DeploymentHandler{RemoteRegistry: r, ClusterID: clusterID}, clientConfig, resyncPeriod) if err != nil { return fmt.Errorf("error with DeploymentController controller init: %v", err) @@ -187,7 +188,7 @@ func (r *RemoteRegistry) createCacheController(clientConfig *rest.Config, cluste log.Warn("admiral cache was nil!") } else if r.AdmiralCache.argoRolloutsEnabled { log.Infof("starting rollout controller clusterID: %v", clusterID) - rc.RolloutController, err = admiral.NewRolloutsController(clusterID, stop, &RolloutHandler{RemoteRegistry: r, ClusterID: clusterID}, clientConfig, resyncPeriod) + rc.RolloutController, err = admiral.NewRolloutsController(stop, &RolloutHandler{RemoteRegistry: r, ClusterID: clusterID}, clientConfig, resyncPeriod) if err != nil { return fmt.Errorf("error with Rollout controller init: %v", err) diff --git a/admiral/pkg/clusters/registry_test.go b/admiral/pkg/clusters/registry_test.go index 2d877b42..1076eeab 100644 --- a/admiral/pkg/clusters/registry_test.go +++ b/admiral/pkg/clusters/registry_test.go @@ -138,7 +138,7 @@ func TestCreateDestinationRuleForLocalNoDeployLabel(t *testing.T) { Host: "localhost", } - d, e := admiral.NewDeploymentController("", make(chan struct{}), &test.MockDeploymentHandler{}, &config, time.Second*time.Duration(300)) + d, e := admiral.NewDeploymentController(make(chan struct{}), &test.MockDeploymentHandler{}, &config, time.Second*time.Duration(300)) if e != nil { t.Fail() @@ -186,10 +186,10 @@ func createMockRemoteController(f func(interface{})) (*RemoteController, error) Host: "localhost", } stop := make(chan struct{}) - d, e := admiral.NewDeploymentController("", stop, &test.MockDeploymentHandler{}, &config, time.Second*time.Duration(300)) - s, e := admiral.NewServiceController("test", stop, &test.MockServiceHandler{}, &config, time.Second*time.Duration(300)) - n, e := admiral.NewNodeController("", stop, &test.MockNodeHandler{}, &config) - r, e := admiral.NewRolloutsController("test", stop, &test.MockRolloutHandler{}, &config, time.Second*time.Duration(300)) + d, e := admiral.NewDeploymentController(stop, &test.MockDeploymentHandler{}, &config, time.Second*time.Duration(300)) + s, e := admiral.NewServiceController(stop, &test.MockServiceHandler{}, &config, time.Second*time.Duration(300)) + n, e := admiral.NewNodeController(stop, &test.MockNodeHandler{}, &config) + r, e := admiral.NewRolloutsController(stop, &test.MockRolloutHandler{}, &config, time.Second*time.Duration(300)) if e != nil { return nil, e @@ -446,7 +446,7 @@ func TestUpdateCacheController(t *testing.T) { t.Run(c.name, func(t *testing.T) { hook := logTest.NewGlobal() rr.RemoteControllers[c.clusterId].ApiServer = c.oldConfig.Host - d, err := admiral.NewDeploymentController("", make(chan struct{}), &test.MockDeploymentHandler{}, c.oldConfig, time.Second*time.Duration(300)) + d, err := admiral.NewDeploymentController(make(chan struct{}), &test.MockDeploymentHandler{}, c.oldConfig, time.Second*time.Duration(300)) if err != nil { t.Fatalf("Unexpected error creating controller %v", err) } diff --git a/admiral/pkg/clusters/serviceentry_test.go b/admiral/pkg/clusters/serviceentry_test.go index b67e726b..a54a8aa1 100644 --- a/admiral/pkg/clusters/serviceentry_test.go +++ b/admiral/pkg/clusters/serviceentry_test.go @@ -295,9 +295,9 @@ func TestCreateServiceEntryForNewServiceOrPod(t *testing.T) { Host: "localhost", } - d, e := admiral.NewDeploymentController("", make(chan struct{}), &test.MockDeploymentHandler{}, &config, time.Second*time.Duration(300)) + 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)) + r, e := admiral.NewRolloutsController(make(chan struct{}), &test.MockRolloutHandler{}, &config, time.Second*time.Duration(300)) if e != nil { t.Fail() @@ -595,7 +595,7 @@ func TestCreateServiceEntry(t *testing.T) { Host: "localhost", } stop := make(chan struct{}) - s, e := admiral.NewServiceController("test", stop, &test.MockServiceHandler{}, &config, time.Second*time.Duration(300)) + s, e := admiral.NewServiceController(stop, &test.MockServiceHandler{}, &config, time.Second*time.Duration(300)) if e != nil { t.Fatalf("%v", e) @@ -882,17 +882,17 @@ func TestCreateServiceEntryForNewServiceOrPodRolloutsUsecase(t *testing.T) { Host: "localhost", } - d, e := admiral.NewDeploymentController("", make(chan struct{}), &test.MockDeploymentHandler{}, &config, time.Second*time.Duration(300)) + 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)) + r, e := admiral.NewRolloutsController(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 { t.Fail() } - s, e := admiral.NewServiceController("test", make(chan struct{}), &test.MockServiceHandler{}, &config, time.Second*time.Duration(300)) + s, e := admiral.NewServiceController(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)) + 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"}, @@ -1018,16 +1018,16 @@ func TestCreateServiceEntryForBlueGreenRolloutsUsecase(t *testing.T) { } rr.StartTime = time.Now().Add(-60*time.Second) - d, e := admiral.NewDeploymentController("", make(chan struct{}), &test.MockDeploymentHandler{}, &config, time.Second*time.Duration(300)) + 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)) + r, e := admiral.NewRolloutsController(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 { 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)) + s, e := admiral.NewServiceController(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{ diff --git a/admiral/pkg/controller/admiral/controller.go b/admiral/pkg/controller/admiral/controller.go index 558b1365..33fc427e 100644 --- a/admiral/pkg/controller/admiral/controller.go +++ b/admiral/pkg/controller/admiral/controller.go @@ -2,15 +2,14 @@ package admiral import ( "fmt" - "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" "k8s.io/client-go/tools/cache" "k8s.io/client-go/util/workqueue" + "time" ) const ( @@ -49,7 +48,7 @@ type Controller struct { func NewController(name string, stopCh <-chan struct{}, delegator Delegator, informer cache.SharedIndexInformer) Controller { controller := Controller{ - name: name, + name: name, informer: informer, delegator: delegator, queue: workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()), @@ -146,32 +145,3 @@ func (c *Controller) processItem(informerCacheObj InformerCacheObj) error { } return nil } - -type MonitoredDelegator struct { - clusterID string - objectType string - d Delegator -} - -func NewMonitoredDelegator(d Delegator, clusterID string, objectType string) *MonitoredDelegator { - return &MonitoredDelegator{ - clusterID: clusterID, - objectType: objectType, - d: d, - } -} - -func (s *MonitoredDelegator) Added(obj interface{}) { - common.EventsProcessed.With(s.clusterID, s.objectType, common.AddEventLabelValue).Inc() - s.d.Added(obj) -} - -func (s *MonitoredDelegator) Updated(obj interface{}, oldObj interface{}) { - common.EventsProcessed.With(s.clusterID, s.objectType, common.UpdateEventLabelValue).Inc() - s.d.Updated(obj, oldObj) -} - -func (s *MonitoredDelegator) Deleted(obj interface{}) { - common.EventsProcessed.With(s.clusterID, s.objectType, common.DeleteEventLabelValue).Inc() - s.d.Deleted(obj) -} diff --git a/admiral/pkg/controller/admiral/controller_test.go b/admiral/pkg/controller/admiral/controller_test.go deleted file mode 100644 index ff0e81ba..00000000 --- a/admiral/pkg/controller/admiral/controller_test.go +++ /dev/null @@ -1,54 +0,0 @@ -package admiral - -import ( - "github.com/stretchr/testify/assert" - "testing" -) - -func TestMonitoredDelegator_Added(t *testing.T) { - td := &TestDelegator{} - d := NewMonitoredDelegator(td, "test", "test") - d.Added(nil) - - assert.True(t, td.AddedInvoked) - assert.False(t, td.DeleteInvoked) - assert.False(t, td.UpdatedInvoked) -} - -func TestMonitoredDelegator_Deleted(t *testing.T) { - td := &TestDelegator{} - d := NewMonitoredDelegator(td, "test", "test") - d.Deleted(nil) - - assert.False(t, td.AddedInvoked) - assert.True(t, td.DeleteInvoked) - assert.False(t, td.UpdatedInvoked) -} - -func TestMonitoredDelegator_Updated(t *testing.T) { - td := &TestDelegator{} - d := NewMonitoredDelegator(td, "test", "test") - d.Updated(nil, nil) - - assert.False(t, td.AddedInvoked) - assert.False(t, td.DeleteInvoked) - assert.True(t, td.UpdatedInvoked) -} - -type TestDelegator struct { - AddedInvoked bool - UpdatedInvoked bool - DeleteInvoked bool -} - -func (t *TestDelegator) Added(obj interface{}) { - t.AddedInvoked = true -} - -func (t *TestDelegator) Updated(obj interface{}, oldObj interface{}) { - t.UpdatedInvoked = true -} - -func (t *TestDelegator) Deleted(obj interface{}) { - t.DeleteInvoked = true -} diff --git a/admiral/pkg/controller/admiral/dependency.go b/admiral/pkg/controller/admiral/dependency.go index 5949f9bb..77bd3848 100644 --- a/admiral/pkg/controller/admiral/dependency.go +++ b/admiral/pkg/controller/admiral/dependency.go @@ -84,8 +84,7 @@ func NewDependencyController(stopCh <-chan struct{}, handler DepHandler, configP cache.Indexers{}, ) - mcd := NewMonitoredDelegator(&depController, "primary", "dependency") - NewController("dependency-ctrl-"+namespace, stopCh, mcd, depController.informer) + NewController("dependency-ctrl-" + namespace, stopCh, &depController, depController.informer) return &depController, nil } diff --git a/admiral/pkg/controller/admiral/deployment.go b/admiral/pkg/controller/admiral/deployment.go index 5b23d25d..97306da5 100644 --- a/admiral/pkg/controller/admiral/deployment.go +++ b/admiral/pkg/controller/admiral/deployment.go @@ -2,15 +2,13 @@ package admiral import ( "fmt" - "time" - "github.com/istio-ecosystem/admiral/admiral/pkg/controller/common" "github.com/istio-ecosystem/admiral/admiral/pkg/controller/util" - "github.com/sirupsen/logrus" k8sAppsV1 "k8s.io/api/apps/v1" k8sAppsinformers "k8s.io/client-go/informers/apps/v1" "k8s.io/client-go/rest" + "time" log "github.com/sirupsen/logrus" meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -81,7 +79,7 @@ func (p *deploymentCache) DeleteFromDeploymentClusterCache(key string, deploymen } } -func NewDeploymentController(clusterID string, stopCh <-chan struct{}, handler DeploymentHandler, config *rest.Config, resyncPeriod time.Duration) (*DeploymentController, error) { +func NewDeploymentController(stopCh <-chan struct{}, handler DeploymentHandler, config *rest.Config, resyncPeriod time.Duration) (*DeploymentController, error) { deploymentController := DeploymentController{} deploymentController.DeploymentHandler = handler @@ -106,15 +104,14 @@ func NewDeploymentController(clusterID string, stopCh <-chan struct{}, handler D cache.Indexers{}, ) - wc := NewMonitoredDelegator(&deploymentController, clusterID, "deployment") - NewController("deployment-ctrl-"+config.Host, stopCh, wc, deploymentController.informer) + NewController("deployment-ctrl-" + config.Host , stopCh, &deploymentController, deploymentController.informer) return &deploymentController, nil } -func NewDeploymentControllerWithLabelOverride(clusterID string, stopCh <-chan struct{}, handler DeploymentHandler, config *rest.Config, resyncPeriod time.Duration, labelSet *common.LabelSet) (*DeploymentController, error) { +func NewDeploymentControllerWithLabelOverride(stopCh <-chan struct{}, handler DeploymentHandler, config *rest.Config, resyncPeriod time.Duration, labelSet *common.LabelSet) (*DeploymentController, error) { - dc, err := NewDeploymentController(clusterID, stopCh, handler, config, resyncPeriod) + dc, err := NewDeploymentController(stopCh, handler, config, resyncPeriod) dc.labelSet = labelSet return dc, err } @@ -130,7 +127,7 @@ func (d *DeploymentController) Updated(obj interface{}, oldObj interface{}) { func HandleAddUpdateDeployment(ojb interface{}, d *DeploymentController) { deployment := ojb.(*k8sAppsV1.Deployment) key := d.Cache.getKey(deployment) - defer util.LogElapsedTime("HandleAddUpdateRollout", key, deployment.Name+"_"+deployment.Namespace, "") + defer util.LogElapsedTime("HandleAddUpdateRollout", key, deployment.Name + "_" + deployment.Namespace, "") if len(key) > 0 { if !d.shouldIgnoreBasedOnLabels(deployment) { d.Cache.UpdateDeploymentToClusterCache(key, deployment) @@ -189,7 +186,7 @@ func (d *DeploymentController) GetDeploymentBySelectorInNamespace(serviceSelecto return []k8sAppsV1.Deployment{} } - filteredDeployments := make([]k8sAppsV1.Deployment, 0) + filteredDeployments := make ([]k8sAppsV1.Deployment, 0) for _, deployment := range matchedDeployments.Items { if common.IsServiceMatch(serviceSelector, deployment.Spec.Selector) { diff --git a/admiral/pkg/controller/admiral/deployment_test.go b/admiral/pkg/controller/admiral/deployment_test.go index 1be4db11..b11dc3b3 100644 --- a/admiral/pkg/controller/admiral/deployment_test.go +++ b/admiral/pkg/controller/admiral/deployment_test.go @@ -143,19 +143,19 @@ func TestDeploymentController_Deleted(t *testing.T) { deployment.Spec.Template.Annotations = map[string]string{"sidecar.istio.io/inject": "true"} testCases := []struct { - name string - deployment *k8sAppsV1.Deployment - expectedDeployment *k8sAppsV1.Deployment + name string + deployment *k8sAppsV1.Deployment + expectedDeployment *k8sAppsV1.Deployment }{ { - name: "Expects deployment to be deleted from the cache when the correct label is present", - deployment: &deployment, - expectedDeployment: nil, + name: "Expects deployment to be deleted from the cache when the correct label is present", + deployment: &deployment, + expectedDeployment: nil, }, { - name: "Expects no error thrown if calling delete on an deployment not exist in cache", - deployment: &deployment, - expectedDeployment: nil, + name: "Expects no error thrown if calling delete on an deployment not exist in cache", + deployment: &deployment, + expectedDeployment: nil, }, } @@ -190,7 +190,7 @@ func TestNewDeploymentController(t *testing.T) { stop := make(chan struct{}) depHandler := test.MockDeploymentHandler{} - depCon, err := NewDeploymentController("", stop, &depHandler, config, time.Duration(1000)) + depCon, err := NewDeploymentController(stop, &depHandler, config, time.Duration(1000)) if depCon == nil { t.Errorf("Deployment controller should not be nil") diff --git a/admiral/pkg/controller/admiral/globaltraffic.go b/admiral/pkg/controller/admiral/globaltraffic.go index d2b626b1..d7c88d0a 100644 --- a/admiral/pkg/controller/admiral/globaltraffic.go +++ b/admiral/pkg/controller/admiral/globaltraffic.go @@ -25,7 +25,7 @@ type GlobalTrafficHandler interface { type GlobalTrafficController struct { CrdClient clientset.Interface GlobalTrafficHandler GlobalTrafficHandler - Cache *gtpCache + Cache *gtpCache informer cache.SharedIndexInformer } @@ -47,7 +47,7 @@ func (p *gtpCache) Put(obj *v1.GlobalTrafficPolicy) { if namespaceGtps == nil { namespaceGtps = make(map[string]*v1.GlobalTrafficPolicy) } - if common.ShouldIgnoreResource(obj.ObjectMeta) { + if common.ShouldIgnoreResource(obj.ObjectMeta){ delete(namespaceGtps, obj.Name) } else { namespaceGtps[obj.Name] = obj @@ -84,18 +84,18 @@ func (p *gtpCache) Get(key, namespace string) []*v1.GlobalTrafficPolicy { namespacesWithGtp := p.cache[key] matchedGtps := make([]*v1.GlobalTrafficPolicy, 0) for ns, gtps := range namespacesWithGtp { - if namespace == ns { - for _, gtp := range gtps { - logrus.Debugf("GTP match for identity=%s, from namespace=%v", key, ns) - //make a copy for safer iterations elsewhere - matchedGtps = append(matchedGtps, gtp.DeepCopy()) - } - } + if namespace == ns { + for _, gtp := range gtps { + logrus.Debugf("GTP match for identity=%s, from namespace=%v", key, ns) + //make a copy for safer iterations elsewhere + matchedGtps = append(matchedGtps, gtp.DeepCopy()) + } + } } return matchedGtps } -func NewGlobalTrafficController(clusterID string, stopCh <-chan struct{}, handler GlobalTrafficHandler, configPath *rest.Config, resyncPeriod time.Duration) (*GlobalTrafficController, error) { +func NewGlobalTrafficController(stopCh <-chan struct{}, handler GlobalTrafficHandler, configPath *rest.Config, resyncPeriod time.Duration) (*GlobalTrafficController, error) { globalTrafficController := GlobalTrafficController{} @@ -121,8 +121,7 @@ func NewGlobalTrafficController(clusterID string, stopCh <-chan struct{}, handle cache.Indexers{}, ) - mcd := NewMonitoredDelegator(&globalTrafficController, clusterID, "globaltrafficpolicy") - NewController("gtp-ctrl-"+configPath.Host, stopCh, mcd, globalTrafficController.informer) + NewController("gtp-ctrl-" + configPath.Host, stopCh, &globalTrafficController, globalTrafficController.informer) return &globalTrafficController, nil } @@ -143,4 +142,4 @@ func (d *GlobalTrafficController) Deleted(ojb interface{}) { gtp := ojb.(*v1.GlobalTrafficPolicy) d.Cache.Delete(gtp) d.GlobalTrafficHandler.Deleted(gtp) -} +} \ No newline at end of file diff --git a/admiral/pkg/controller/admiral/globaltraffic_test.go b/admiral/pkg/controller/admiral/globaltraffic_test.go index a0da26a8..5799ad82 100644 --- a/admiral/pkg/controller/admiral/globaltraffic_test.go +++ b/admiral/pkg/controller/admiral/globaltraffic_test.go @@ -22,7 +22,7 @@ func TestNewGlobalTrafficController(t *testing.T) { stop := make(chan struct{}) handler := test.MockGlobalTrafficHandler{} - globalTrafficController, err := NewGlobalTrafficController("", stop, &handler, config, time.Duration(1000)) + globalTrafficController, err := NewGlobalTrafficController(stop, &handler, config, time.Duration(1000)) if err != nil { t.Errorf("Unexpected err %v", err) @@ -41,7 +41,7 @@ func TestGlobalTrafficAddUpdateDelete(t *testing.T) { stop := make(chan struct{}) handler := test.MockGlobalTrafficHandler{} - globalTrafficController, err := NewGlobalTrafficController("", stop, &handler, config, time.Duration(1000)) + globalTrafficController, err := NewGlobalTrafficController(stop, &handler, config, time.Duration(1000)) if err != nil { t.Errorf("Unexpected err %v", err) @@ -80,41 +80,43 @@ func TestGlobalTrafficAddUpdateDelete(t *testing.T) { func TestGlobalTrafficController_Updated(t *testing.T) { var ( - gth = test.MockGlobalTrafficHandler{} + + gth = test.MockGlobalTrafficHandler{} cache = gtpCache{ cache: make(map[string]map[string]map[string]*v1.GlobalTrafficPolicy), mutex: &sync.Mutex{}, } gtpController = GlobalTrafficController{ GlobalTrafficHandler: >h, - Cache: &cache, + Cache: &cache, } gtp = v1.GlobalTrafficPolicy{ObjectMeta: v12.ObjectMeta{Name: "gtp", Namespace: "namespace1", Labels: map[string]string{"identity": "id", "admiral.io/env": "stage"}}, Spec: model.GlobalTrafficPolicy{ - Policy: []*model.TrafficPolicy{{DnsPrefix: "hello"}}, - }} + Policy: []*model.TrafficPolicy {{DnsPrefix: "hello"}}, + },} gtpUpdated = v1.GlobalTrafficPolicy{ObjectMeta: v12.ObjectMeta{Name: "gtp", Namespace: "namespace1", Labels: map[string]string{"identity": "id", "admiral.io/env": "stage"}}, Spec: model.GlobalTrafficPolicy{ - Policy: []*model.TrafficPolicy{{DnsPrefix: "helloUpdated"}}, - }} + Policy: []*model.TrafficPolicy {{DnsPrefix: "helloUpdated"}}, + },} 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"}}} + ) //add the base object to cache gtpController.Added(>p) testCases := []struct { - name string - gtp *v1.GlobalTrafficPolicy - expectedGtps []*v1.GlobalTrafficPolicy + name string + gtp *v1.GlobalTrafficPolicy + expectedGtps []*v1.GlobalTrafficPolicy }{ { - name: "Gtp with should be updated", - gtp: >pUpdated, - expectedGtps: []*v1.GlobalTrafficPolicy{>pUpdated}, + name: "Gtp with should be updated", + gtp: >pUpdated, + expectedGtps: []*v1.GlobalTrafficPolicy{>pUpdated}, }, { - name: "Should remove gtp from cache when update with Ignore annotation", - gtp: >pUpdatedToIgnore, - expectedGtps: []*v1.GlobalTrafficPolicy{}, + name: "Should remove gtp from cache when update with Ignore annotation", + gtp: >pUpdatedToIgnore, + expectedGtps: []*v1.GlobalTrafficPolicy{}, }, } for _, c := range testCases { @@ -132,26 +134,26 @@ func TestGlobalTrafficController_Updated(t *testing.T) { func TestGlobalTrafficController_Deleted(t *testing.T) { var ( - gth = test.MockGlobalTrafficHandler{} + gth = test.MockGlobalTrafficHandler{} cache = gtpCache{ cache: make(map[string]map[string]map[string]*v1.GlobalTrafficPolicy), mutex: &sync.Mutex{}, } gtpController = GlobalTrafficController{ GlobalTrafficHandler: >h, - Cache: &cache, + Cache: &cache, } gtp = v1.GlobalTrafficPolicy{ObjectMeta: v12.ObjectMeta{Name: "gtp", Namespace: "namespace1", Labels: map[string]string{"identity": "id", "admiral.io/env": "stage"}}, Spec: model.GlobalTrafficPolicy{ - Policy: []*model.TrafficPolicy{{DnsPrefix: "hello"}}, - }} + Policy: []*model.TrafficPolicy {{DnsPrefix: "hello"}}, + },} gtp2 = v1.GlobalTrafficPolicy{ObjectMeta: v12.ObjectMeta{Name: "gtp2", Namespace: "namespace1", Labels: map[string]string{"identity": "id", "admiral.io/env": "stage"}}, Spec: model.GlobalTrafficPolicy{ - Policy: []*model.TrafficPolicy{{DnsPrefix: "hellogtp2"}}, - }} + Policy: []*model.TrafficPolicy {{DnsPrefix: "hellogtp2"}}, + },} gtp3 = v1.GlobalTrafficPolicy{ObjectMeta: v12.ObjectMeta{Name: "gtp3", Namespace: "namespace2", Labels: map[string]string{"identity": "id2", "admiral.io/env": "stage"}}, Spec: model.GlobalTrafficPolicy{ - Policy: []*model.TrafficPolicy{{DnsPrefix: "hellogtp3"}}, - }} + Policy: []*model.TrafficPolicy {{DnsPrefix: "hellogtp3"}}, + },} ) //add the base object to cache @@ -159,19 +161,19 @@ func TestGlobalTrafficController_Deleted(t *testing.T) { gtpController.Added(>p2) testCases := []struct { - name string - gtp *v1.GlobalTrafficPolicy - expectedGtps []*v1.GlobalTrafficPolicy + name string + gtp *v1.GlobalTrafficPolicy + expectedGtps []*v1.GlobalTrafficPolicy }{ { - name: "Should delete gtp", - gtp: >p, - expectedGtps: []*v1.GlobalTrafficPolicy{>p2}, + name: "Should delete gtp", + gtp: >p, + expectedGtps: []*v1.GlobalTrafficPolicy{>p2}, }, { - name: "Deleting non existing gtp should be a no-op", - gtp: >p3, - expectedGtps: []*v1.GlobalTrafficPolicy{}, + name: "Deleting non existing gtp should be a no-op", + gtp: >p3, + expectedGtps: []*v1.GlobalTrafficPolicy{}, }, } for _, c := range testCases { @@ -189,16 +191,17 @@ func TestGlobalTrafficController_Deleted(t *testing.T) { func TestGlobalTrafficController_Added(t *testing.T) { var ( - gth = test.MockGlobalTrafficHandler{} + + gth = test.MockGlobalTrafficHandler{} cache = gtpCache{ cache: make(map[string]map[string]map[string]*v1.GlobalTrafficPolicy), mutex: &sync.Mutex{}, } gtpController = GlobalTrafficController{ GlobalTrafficHandler: >h, - Cache: &cache, + Cache: &cache, } - gtp = v1.GlobalTrafficPolicy{ObjectMeta: v12.ObjectMeta{Name: "gtp", Namespace: "namespace1", Labels: map[string]string{"identity": "id", "admiral.io/env": "stage"}}} + gtp = v1.GlobalTrafficPolicy{ObjectMeta: v12.ObjectMeta{Name: "gtp", Namespace: "namespace1", Labels: map[string]string{"identity": "id", "admiral.io/env": "stage"}},} gtpWithIgnoreLabels = v1.GlobalTrafficPolicy{ObjectMeta: v12.ObjectMeta{Name: "gtpWithIgnoreLabels", Namespace: "namespace2", Labels: map[string]string{"identity": "id2", "admiral.io/env": "stage"}, Annotations: map[string]string{"admiral.io/ignore": "true"}}} gtp2 = v1.GlobalTrafficPolicy{ObjectMeta: v12.ObjectMeta{Name: "gtp2", Namespace: "namespace1", Labels: map[string]string{"identity": "id", "admiral.io/env": "stage"}}} @@ -207,29 +210,29 @@ func TestGlobalTrafficController_Added(t *testing.T) { ) testCases := []struct { - name string - gtp *v1.GlobalTrafficPolicy - expectedGtps []*v1.GlobalTrafficPolicy + name string + gtp *v1.GlobalTrafficPolicy + expectedGtps []*v1.GlobalTrafficPolicy }{ { - name: "Gtp should be added to the cache", - gtp: >p, - expectedGtps: []*v1.GlobalTrafficPolicy{>p}, + name: "Gtp should be added to the cache", + gtp: >p, + expectedGtps: []*v1.GlobalTrafficPolicy{>p}, }, { - name: "Gtp with ignore annotation should not be added to the cache", - gtp: >pWithIgnoreLabels, - expectedGtps: []*v1.GlobalTrafficPolicy{}, + name: "Gtp with ignore annotation should not be added to the cache", + gtp: >pWithIgnoreLabels, + expectedGtps: []*v1.GlobalTrafficPolicy{}, }, { - name: "Should cache multiple gtps in a namespace", - gtp: >p2, - expectedGtps: []*v1.GlobalTrafficPolicy{>p, >p2}, + name: "Should cache multiple gtps in a namespace", + gtp: >p2, + expectedGtps: []*v1.GlobalTrafficPolicy{>p, >p2}, }, { - name: "Should cache gtps in from multiple namespaces", - gtp: >p3, - expectedGtps: []*v1.GlobalTrafficPolicy{>p3}, + name: "Should cache gtps in from multiple namespaces", + gtp: >p3, + expectedGtps: []*v1.GlobalTrafficPolicy{>p3}, }, } for _, c := range testCases { diff --git a/admiral/pkg/controller/admiral/node.go b/admiral/pkg/controller/admiral/node.go index 81479785..317c2a79 100644 --- a/admiral/pkg/controller/admiral/node.go +++ b/admiral/pkg/controller/admiral/node.go @@ -26,7 +26,7 @@ type Locality struct { Region string } -func NewNodeController(clusterID string, stopCh <-chan struct{}, handler NodeHandler, config *rest.Config) (*NodeController, error) { +func NewNodeController(stopCh <-chan struct{}, handler NodeHandler, config *rest.Config) (*NodeController, error) { nodeController := NodeController{} nodeController.NodeHandler = handler @@ -44,8 +44,7 @@ func NewNodeController(clusterID string, stopCh <-chan struct{}, handler NodeHan cache.Indexers{}, ) - mcd := NewMonitoredDelegator(&nodeController, clusterID, "node") - NewController("node-ctrl-"+config.Host, stopCh, mcd, nodeController.informer) + NewController("node-ctrl-" + config.Host, stopCh, &nodeController, nodeController.informer) return &nodeController, nil } diff --git a/admiral/pkg/controller/admiral/node_test.go b/admiral/pkg/controller/admiral/node_test.go index a1c9fa27..edc8fc2b 100644 --- a/admiral/pkg/controller/admiral/node_test.go +++ b/admiral/pkg/controller/admiral/node_test.go @@ -17,7 +17,7 @@ func TestNewNodeController(t *testing.T) { stop := make(chan struct{}) handler := test.MockNodeHandler{} - nodeController, err := NewNodeController("", stop, &handler, config) + nodeController, err := NewNodeController(stop, &handler, config) if err != nil { t.Errorf("Unexpected err %v", err) @@ -36,7 +36,7 @@ func TestNodeAddUpdateDelete(t *testing.T) { stop := make(chan struct{}) handler := test.MockNodeHandler{} - nodeController, err := NewNodeController("", stop, &handler, config) + nodeController, err := NewNodeController(stop, &handler, config) if err != nil { t.Errorf("Unexpected err %v", err) diff --git a/admiral/pkg/controller/admiral/rollouts.go b/admiral/pkg/controller/admiral/rollouts.go index 35cbf681..56bfdced 100644 --- a/admiral/pkg/controller/admiral/rollouts.go +++ b/admiral/pkg/controller/admiral/rollouts.go @@ -126,10 +126,11 @@ func (d *RolloutController) shouldIgnoreBasedOnLabelsForRollout(rollout *argo.Ro return false //labels are fine, we should not ignore } -func NewRolloutsController(clusterID string, stopCh <-chan struct{}, handler RolloutHandler, config *rest.Config, resyncPeriod time.Duration) (*RolloutController, error) { +func NewRolloutsController(stopCh <-chan struct{}, handler RolloutHandler, config *rest.Config, resyncPeriod time.Duration) (*RolloutController, error) { roController := RolloutController{} roController.RolloutHandler = handler + roController.labelSet = common.GetLabelSet() rolloutCache := rolloutCache{} rolloutCache.cache = make(map[string]*RolloutClusterEntry) @@ -158,11 +159,16 @@ func NewRolloutsController(clusterID string, stopCh <-chan struct{}, handler Rol //Initialize informer roController.informer = argoRolloutsInformerFactory.Argoproj().V1alpha1().Rollouts().Informer() - mcd := NewMonitoredDelegator(&roController, clusterID, "rollout") - NewController("rollouts-ctrl-"+clusterID, stopCh, mcd, roController.informer) + NewController("rollouts-ctrl-" + config.Host , stopCh, &roController, roController.informer) return &roController, nil } +func NewRolloutsControllerWithLabelOverride(stopCh <-chan struct{}, handler RolloutHandler, config *rest.Config, resyncPeriod time.Duration, labelSet *common.LabelSet) (*RolloutController, error) { + rc, err := NewRolloutsController(stopCh, handler, config, resyncPeriod) + rc.labelSet = labelSet + return rc, err +} + func (roc *RolloutController) Added(ojb interface{}) { HandleAddUpdateRollout(ojb, roc) } diff --git a/admiral/pkg/controller/admiral/rollouts_test.go b/admiral/pkg/controller/admiral/rollouts_test.go index a84d76e1..2640dad0 100644 --- a/admiral/pkg/controller/admiral/rollouts_test.go +++ b/admiral/pkg/controller/admiral/rollouts_test.go @@ -25,7 +25,7 @@ func TestNewRolloutController(t *testing.T) { stop := make(chan struct{}) rolHandler := test.MockRolloutHandler{} - depCon, err := NewRolloutsController("test", stop, &rolHandler, config, time.Duration(1000)) + depCon, err := NewRolloutsController(stop, &rolHandler, config, time.Duration(1000)) if depCon == nil { t.Errorf("Rollout controller should not be nil") @@ -155,19 +155,19 @@ func TestRolloutController_Deleted(t *testing.T) { rollout.Spec.Template.Annotations = map[string]string{"sidecar.istio.io/inject": "true"} testCases := []struct { - name string - rollout *argo.Rollout - expectedRollout *argo.Rollout + name string + rollout *argo.Rollout + expectedRollout *argo.Rollout }{ { - name: "Expects rollout to be deleted from the cache when the correct label is present", - rollout: &rollout, - expectedRollout: nil, + name: "Expects rollout to be deleted from the cache when the correct label is present", + rollout: &rollout, + expectedRollout: nil, }, { - name: "Expects no error thrown if calling delete on an rollout not exist in cache", - rollout: &rollout, - expectedRollout: nil, + name: "Expects no error thrown if calling delete on an rollout not exist in cache", + rollout: &rollout, + expectedRollout: nil, }, } diff --git a/admiral/pkg/controller/admiral/service.go b/admiral/pkg/controller/admiral/service.go index 0f998c52..d47f2082 100644 --- a/admiral/pkg/controller/admiral/service.go +++ b/admiral/pkg/controller/admiral/service.go @@ -147,7 +147,7 @@ func (s *serviceCache) GetLoadBalancer(key string, namespace string) (string, in return lb, lbPort } -func NewServiceController(clusterID string, stopCh <-chan struct{}, handler ServiceHandler, config *rest.Config, resyncPeriod time.Duration) (*ServiceController, error) { +func NewServiceController(stopCh <-chan struct{}, handler ServiceHandler, config *rest.Config, resyncPeriod time.Duration) (*ServiceController, error) { serviceController := ServiceController{} serviceController.ServiceHandler = handler @@ -176,8 +176,7 @@ func NewServiceController(clusterID string, stopCh <-chan struct{}, handler Serv &k8sV1.Service{}, resyncPeriod, cache.Indexers{}, ) - mcd := NewMonitoredDelegator(&serviceController, clusterID, "service") - NewController("service-ctrl-"+config.Host, stopCh, mcd, serviceController.informer) + NewController("service-ctrl-"+config.Host, stopCh, &serviceController, serviceController.informer) return &serviceController, nil } diff --git a/admiral/pkg/controller/admiral/service_test.go b/admiral/pkg/controller/admiral/service_test.go index fb2cd30f..c24fd813 100644 --- a/admiral/pkg/controller/admiral/service_test.go +++ b/admiral/pkg/controller/admiral/service_test.go @@ -25,7 +25,7 @@ func TestNewServiceController(t *testing.T) { stop := make(chan struct{}) handler := test.MockServiceHandler{} - serviceController, err := NewServiceController("test", stop, &handler, config, time.Duration(1000)) + serviceController, err := NewServiceController(stop, &handler, config, time.Duration(1000)) if err != nil { t.Errorf("Unexpected err %v", err) diff --git a/admiral/pkg/controller/common/config.go b/admiral/pkg/controller/common/config.go index 49352d92..5832fbae 100644 --- a/admiral/pkg/controller/common/config.go +++ b/admiral/pkg/controller/common/config.go @@ -17,7 +17,6 @@ func InitializeConfig(params AdmiralParams) { once.Do(func() { admiralParams = params initHappened = true - InitializeMetrics() }) if !initHappened { 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.") diff --git a/admiral/pkg/controller/common/metrics.go b/admiral/pkg/controller/common/metrics.go index c022cfcf..213ad99c 100644 --- a/admiral/pkg/controller/common/metrics.go +++ b/admiral/pkg/controller/common/metrics.go @@ -1,100 +1,31 @@ package common -import ( - "github.com/prometheus/client_golang/prometheus" - "sync" -) +import "github.com/prometheus/client_golang/prometheus" -const ( - ClustersMonitoredMetricName = "clusters_monitored" - EventsProcessedTotalMetricName = "events_processed_total" - - AddEventLabelValue = "add" - UpdateEventLabelValue = "update" - DeleteEventLabelValue = "delete" -) - -var ( - metricsOnce sync.Once - RemoteClustersMetric Gauge - EventsProcessed Counter -) +const ClustersMonitoredMetricName = "clusters_monitored" type Gauge interface { - With(labelValues ...string) Gauge Set(value float64) } -type Counter interface { - With(labelValues ...string) Counter - Inc() -} - -/* -InitializeMetrics depends on AdmiralParams for metrics enablement. -*/ -func InitializeMetrics() { - metricsOnce.Do(func() { - RemoteClustersMetric = NewGaugeFrom(ClustersMonitoredMetricName, "Gauge for the clusters monitored by Admiral", []string{}) - EventsProcessed = NewCounterFrom(EventsProcessedTotalMetricName, "Counter for the events processed by Admiral", []string{"cluster", "object_type", "event_type"}) - }) -} - -func NewGaugeFrom(name string, help string, labelNames []string) Gauge { +func NewGaugeFrom(name string, help string) Gauge { if !GetMetricsEnabled() { - return &NoopGauge{} + return &Noop{} } opts := prometheus.GaugeOpts{Name: name, Help: help} - g := prometheus.NewGaugeVec(opts, labelNames) + g := prometheus.NewGauge(opts) prometheus.MustRegister(g) - return &PromGauge{g, labelNames} + return &PromGauge{g} } -func NewCounterFrom(name string, help string, labelNames []string) Counter { - if !GetMetricsEnabled() { - return &NoopCounter{} - } - opts := prometheus.CounterOpts{Name: name, Help: help} - c := prometheus.NewCounterVec(opts, labelNames) - prometheus.MustRegister(c) - return &PromCounter{c, labelNames} -} - -type NoopGauge struct{} -type NoopCounter struct{} +type Noop struct{} type PromGauge struct { - g *prometheus.GaugeVec - lvs []string -} - -type PromCounter struct { - c *prometheus.CounterVec - lvs []string -} - -func (g *PromGauge) With(labelValues ...string) Gauge { - g.lvs = append([]string{}, labelValues...) - - return g + g prometheus.Gauge } func (g *PromGauge) Set(value float64) { - g.g.WithLabelValues(g.lvs...).Set(value) -} - -func (c *PromCounter) With(labelValues ...string) Counter { - c.lvs = append([]string{}, labelValues...) - - return c + g.g.Set(value) } -func (c *PromCounter) Inc() { - c.c.WithLabelValues(c.lvs...).Inc() -} - -func (g *NoopGauge) Set(float64) {} -func (g *NoopGauge) With(...string) Gauge { return g } - -func (g *NoopCounter) Inc() {} -func (g *NoopCounter) With(...string) Counter { return g } +func (g *Noop) Set(value float64) {} diff --git a/admiral/pkg/controller/common/metrics_test.go b/admiral/pkg/controller/common/metrics_test.go index 0f881246..081adc42 100644 --- a/admiral/pkg/controller/common/metrics_test.go +++ b/admiral/pkg/controller/common/metrics_test.go @@ -2,131 +2,38 @@ package common import ( "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/stretchr/testify/assert" - "io/ioutil" - "net/http" - "net/http/httptest" - "regexp" - "strconv" "testing" ) func TestNewGaugeFrom(t *testing.T) { type args struct { - prom bool - name string - help string - value int64 - labelNames []string - labelValues []string + prom bool + Name string + Help string } tc := []struct { - name string - args args - wantMetric bool - wantValue int64 + name string + args args + want Gauge }{ { - name: "Should return a Prometheus gauge", - args: args{true, "mygauge", "", 10, []string{"l1", "l2"}, []string{"v1", "v2"}}, - wantMetric: true, - wantValue: 10, + "Should return a Prometheus gauge", + args{true, "gauge", ""}, + &PromGauge{prometheus.NewGauge(prometheus.GaugeOpts{Name: "gauge", Help: ""})}, }, { - name: "Should return a Noop gauge", - args: args{false, "mygauge", "", 10, []string{}, []string{}}, - wantMetric: false, + "Should return a Noop gauge", + args{false, "gauge", ""}, + &Noop{}, }, } for _, tt := range tc { t.Run(tt.name, func(t *testing.T) { SetEnablePrometheus(tt.args.prom) - - // exercise metric - actual := NewGaugeFrom(tt.args.name, tt.args.help, tt.args.labelNames) - actual.With(tt.args.labelValues...).Set(float64(tt.args.value)) - - // query metrics endpoint - s := httptest.NewServer(promhttp.HandlerFor(prometheus.DefaultGatherer, promhttp.HandlerOpts{})) - defer s.Close() - - // parse response - resp, _ := http.Get(s.URL) - buf, _ := ioutil.ReadAll(resp.Body) - actualString := string(buf) - - // verify - if tt.wantMetric { - pattern := tt.args.name + `{l1="v1",l2="v2"} ([0-9]+)` - re := regexp.MustCompile(pattern) - matches := re.FindStringSubmatch(actualString) - f, _ := strconv.ParseInt(matches[1], 0, 64) - assert.Equal(t, tt.wantValue, f) - } - assert.Equal(t, 200, resp.StatusCode) - }) - } -} - -func TestNewCounterFrom(t *testing.T) { - type args struct { - prom bool - name string - help string - value int64 - labelNames []string - labelValues []string - } - tc := []struct { - name string - args args - wantMetric bool - wantValue int64 - }{ - { - name: "Should return a Noop counter", - args: args{false, "mycounter", "", 10, []string{}, []string{}}, - wantMetric: false, - }, - { - name: "Should return a Prometheus counter", - args: args{true, "mycounter", "", 1, []string{"l1", "l2"}, []string{"v1", "v2"}}, - wantMetric: true, - wantValue: 1, - }, - } - - for _, tt := range tc { - t.Run(tt.name, func(t *testing.T) { - SetEnablePrometheus(tt.args.prom) - - // exercise metric - actual := NewCounterFrom(tt.args.name, tt.args.help, tt.args.labelNames) - var i int64 - for i = 0; i < tt.args.value; i++ { - actual.With(tt.args.labelValues...).Inc() - } - - // query metrics endpoint - s := httptest.NewServer(promhttp.HandlerFor(prometheus.DefaultGatherer, promhttp.HandlerOpts{})) - defer s.Close() - - // parse response - resp, _ := http.Get(s.URL) - buf, _ := ioutil.ReadAll(resp.Body) - actualString := string(buf) - - // verify - if tt.wantMetric { - pattern := tt.args.name + `{l1="v1",l2="v2"} ([0-9]+)` - re := regexp.MustCompile(pattern) - s2 := re.FindStringSubmatch(actualString)[1] - f, _ := strconv.ParseInt(s2, 0, 64) - assert.Equal(t, tt.wantValue, f) - } - assert.Equal(t, 200, resp.StatusCode) + actual := NewGaugeFrom(tt.args.Name, tt.args.Help) + assert.Equal(t, tt.want, actual, "want: %#v, got: %#v", tt.want, actual) }) } } diff --git a/admiral/pkg/controller/istio/destinationrule.go b/admiral/pkg/controller/istio/destinationrule.go index 467f8e65..0aa0b221 100644 --- a/admiral/pkg/controller/istio/destinationrule.go +++ b/admiral/pkg/controller/istio/destinationrule.go @@ -31,7 +31,7 @@ type DestinationRuleController struct { informer cache.SharedIndexInformer } -func NewDestinationRuleController(clusterID string, stopCh <-chan struct{}, handler DestinationRuleHandler, config *rest.Config, resyncPeriod time.Duration) (*DestinationRuleController, error) { +func NewDestinationRuleController(stopCh <-chan struct{}, handler DestinationRuleHandler, config *rest.Config, resyncPeriod time.Duration) (*DestinationRuleController, error) { drController := DestinationRuleController{} drController.DestinationRuleHandler = handler @@ -47,8 +47,7 @@ func NewDestinationRuleController(clusterID string, stopCh <-chan struct{}, hand drController.informer = informers.NewDestinationRuleInformer(ic, k8sV1.NamespaceAll, resyncPeriod, cache.Indexers{}) - mcd := admiral.NewMonitoredDelegator(&drController, clusterID, "destinationrule") - admiral.NewController("destinationrule-ctrl-"+config.Host, stopCh, mcd, drController.informer) + admiral.NewController("destinationrule-ctrl-" + config.Host, stopCh, &drController, drController.informer) return &drController, nil } diff --git a/admiral/pkg/controller/istio/destinationrule_test.go b/admiral/pkg/controller/istio/destinationrule_test.go index 82e08c5e..8a79a41b 100644 --- a/admiral/pkg/controller/istio/destinationrule_test.go +++ b/admiral/pkg/controller/istio/destinationrule_test.go @@ -19,7 +19,7 @@ func TestNewDestinationRuleController(t *testing.T) { stop := make(chan struct{}) handler := test.MockDestinationRuleHandler{} - destinationRuleController, err := NewDestinationRuleController("", stop, &handler, config, time.Duration(1000)) + destinationRuleController, err := NewDestinationRuleController(stop, &handler, config, time.Duration(1000)) if err != nil { t.Errorf("Unexpected err %v", err) diff --git a/admiral/pkg/controller/istio/serviceentry.go b/admiral/pkg/controller/istio/serviceentry.go index 7d98cf37..fd17dde0 100644 --- a/admiral/pkg/controller/istio/serviceentry.go +++ b/admiral/pkg/controller/istio/serviceentry.go @@ -31,7 +31,7 @@ type ServiceEntryController struct { informer cache.SharedIndexInformer } -func NewServiceEntryController(clusterID string, stopCh <-chan struct{}, handler ServiceEntryHandler, config *rest.Config, resyncPeriod time.Duration) (*ServiceEntryController, error) { +func NewServiceEntryController(stopCh <-chan struct{}, handler ServiceEntryHandler, config *rest.Config, resyncPeriod time.Duration) (*ServiceEntryController, error) { seController := ServiceEntryController{} seController.ServiceEntryHandler = handler @@ -47,8 +47,7 @@ func NewServiceEntryController(clusterID string, stopCh <-chan struct{}, handler seController.informer = informers.NewServiceEntryInformer(ic, k8sV1.NamespaceAll, resyncPeriod, cache.Indexers{}) - mcd := admiral.NewMonitoredDelegator(&seController, clusterID, "serviceentry") - admiral.NewController("serviceentry-ctrl-"+config.Host, stopCh, mcd, seController.informer) + admiral.NewController("serviceentry-ctrl-" + config.Host, stopCh, &seController, seController.informer) return &seController, nil } @@ -66,4 +65,5 @@ func (sec *ServiceEntryController) Updated(ojb interface{}, oldObj interface{}) func (sec *ServiceEntryController) Deleted(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..f7567192 100644 --- a/admiral/pkg/controller/istio/serviceentry_test.go +++ b/admiral/pkg/controller/istio/serviceentry_test.go @@ -19,7 +19,7 @@ func TestNewServiceEntryController(t *testing.T) { stop := make(chan struct{}) handler := test.MockServiceEntryHandler{} - serviceEntryController, err := NewServiceEntryController("test", stop, &handler, config, time.Duration(1000)) + serviceEntryController, err := NewServiceEntryController(stop, &handler, config, time.Duration(1000)) if err != nil { t.Errorf("Unexpected err %v", err) diff --git a/admiral/pkg/controller/istio/sidecar.go b/admiral/pkg/controller/istio/sidecar.go index 86068f04..ee35997c 100644 --- a/admiral/pkg/controller/istio/sidecar.go +++ b/admiral/pkg/controller/istio/sidecar.go @@ -31,7 +31,7 @@ type SidecarController struct { informer cache.SharedIndexInformer } -func NewSidecarController(clusterID string, stopCh <-chan struct{}, handler SidecarHandler, config *rest.Config, resyncPeriod time.Duration) (*SidecarController, error) { +func NewSidecarController(stopCh <-chan struct{}, handler SidecarHandler, config *rest.Config, resyncPeriod time.Duration) (*SidecarController, error) { sidecarController := SidecarController{} sidecarController.SidecarHandler = handler @@ -47,8 +47,7 @@ func NewSidecarController(clusterID string, stopCh <-chan struct{}, handler Side sidecarController.informer = informers.NewSidecarInformer(ic, k8sV1.NamespaceAll, resyncPeriod, cache.Indexers{}) - mcd := admiral.NewMonitoredDelegator(&sidecarController, clusterID, "sidecar") - admiral.NewController("sidecar-ctrl-"+config.Host, stopCh, mcd, sidecarController.informer) + admiral.NewController("sidecar-ctrl-" + config.Host, stopCh, &sidecarController, sidecarController.informer) return &sidecarController, nil } diff --git a/admiral/pkg/controller/istio/sidecar_test.go b/admiral/pkg/controller/istio/sidecar_test.go index 09bb0509..40ae8eb7 100644 --- a/admiral/pkg/controller/istio/sidecar_test.go +++ b/admiral/pkg/controller/istio/sidecar_test.go @@ -19,7 +19,7 @@ func TestNewSidecarController(t *testing.T) { stop := make(chan struct{}) handler := test.MockSidecarHandler{} - sidecarController, err := NewSidecarController("", stop, &handler, config, time.Duration(1000)) + sidecarController, err := NewSidecarController(stop, &handler, config, time.Duration(1000)) if err != nil { t.Errorf("Unexpected err %v", err) diff --git a/admiral/pkg/controller/istio/virtualservice.go b/admiral/pkg/controller/istio/virtualservice.go index 2e0fa2b8..1c8a8650 100644 --- a/admiral/pkg/controller/istio/virtualservice.go +++ b/admiral/pkg/controller/istio/virtualservice.go @@ -26,7 +26,7 @@ type VirtualServiceController struct { informer cache.SharedIndexInformer } -func NewVirtualServiceController(clusterID string, stopCh <-chan struct{}, handler VirtualServiceHandler, config *rest.Config, resyncPeriod time.Duration) (*VirtualServiceController, error) { +func NewVirtualServiceController(stopCh <-chan struct{}, handler VirtualServiceHandler, config *rest.Config, resyncPeriod time.Duration) (*VirtualServiceController, error) { drController := VirtualServiceController{} drController.VirtualServiceHandler = handler @@ -42,8 +42,7 @@ func NewVirtualServiceController(clusterID string, stopCh <-chan struct{}, handl drController.informer = informers.NewVirtualServiceInformer(ic, k8sV1.NamespaceAll, resyncPeriod, cache.Indexers{}) - mcd := admiral.NewMonitoredDelegator(&drController, clusterID, "virtualservice") - admiral.NewController("virtualservice-ctrl-"+config.Host, stopCh, mcd, drController.informer) + admiral.NewController("virtualservice-ctrl-" + config.Host, stopCh, &drController, drController.informer) return &drController, nil } diff --git a/admiral/pkg/controller/istio/virtualservice_test.go b/admiral/pkg/controller/istio/virtualservice_test.go index 868e0af1..3352ba31 100644 --- a/admiral/pkg/controller/istio/virtualservice_test.go +++ b/admiral/pkg/controller/istio/virtualservice_test.go @@ -19,7 +19,7 @@ func TestNewVirtualServiceController(t *testing.T) { stop := make(chan struct{}) handler := test.MockVirtualServiceHandler{} - virtualServiceController, err := NewVirtualServiceController("", stop, &handler, config, time.Duration(1000)) + virtualServiceController, err := NewVirtualServiceController(stop, &handler, config, time.Duration(1000)) if err != nil { t.Errorf("Unexpected err %v", err) diff --git a/admiral/pkg/controller/secret/secretcontroller.go b/admiral/pkg/controller/secret/secretcontroller.go index dd4c180e..7847210f 100644 --- a/admiral/pkg/controller/secret/secretcontroller.go +++ b/admiral/pkg/controller/secret/secretcontroller.go @@ -46,6 +46,8 @@ const ( // DO NOT USE - TEST ONLY. var LoadKubeConfig = clientcmd.Load +var remoteClustersMetric common.Gauge + // addSecretCallback prototype for the add secret callback function. type addSecretCallback func(config *rest.Config, dataKey string, resyncPeriod time.Duration) error @@ -167,6 +169,8 @@ func NewController( } }, }) + + remoteClustersMetric = common.NewGaugeFrom(common.ClustersMonitoredMetricName, "Gauge for the clusters monitored by Admiral") return controller } @@ -333,7 +337,7 @@ func (c *Controller) addMemberCluster(secretName string, s *corev1.Secret) { } } - common.RemoteClustersMetric.Set(float64(len(c.Cs.RemoteClusters))) + remoteClustersMetric.Set(float64(len(c.Cs.RemoteClusters))) log.Infof("Number of remote clusters: %d", len(c.Cs.RemoteClusters)) } @@ -348,6 +352,6 @@ func (c *Controller) deleteMemberCluster(secretName string) { delete(c.Cs.RemoteClusters, clusterID) } } - common.RemoteClustersMetric.Set(float64(len(c.Cs.RemoteClusters))) + remoteClustersMetric.Set(float64(len(c.Cs.RemoteClusters))) log.Infof("Number of remote clusters: %d", len(c.Cs.RemoteClusters)) } diff --git a/go.mod b/go.mod index cb153ece..d5318ef3 100644 --- a/go.mod +++ b/go.mod @@ -63,7 +63,6 @@ require ( github.intuit.com/idps/idps-go-sdk/v3 v3.83.3 golang.org/x/crypto v0.0.0-20191108234033-bd318be0434a // indirect golang.org/x/net v0.0.0-20200301022130-244492dfa37a // indirect - golang.org/x/sys v0.0.0-20220712014510-0a85c31ab51e // 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 diff --git a/go.sum b/go.sum index 8aea1f5b..4bd1e501 100644 --- a/go.sum +++ b/go.sum @@ -49,6 +49,7 @@ github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk5 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/aws/aws-sdk-go v1.16.26 h1:GWkl3rkRO/JGRTWoLLIqwf7AWC4/W/1hMOUZqmX0js4= github.com/antonmedv/expr v1.4.2/go.mod h1:xesgliOuukGf21740qhh8PvFdN66yZ9lJJ/PzSFAmzI= github.com/argoproj/argo-rollouts v0.7.2 h1:eUtsstL3DWNv+SxjnwJEBOHH2KOF5lu5G/zF5yKgC3A= github.com/argoproj/argo-rollouts v0.7.2/go.mod h1:zjMEXhycwvFGimOzpeiSmt/Cv58I63nGgVuROKFIfB8= @@ -63,7 +64,6 @@ github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:l github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/aslakhellesoy/gox v1.0.100/go.mod h1:AJl542QsKKG96COVsv0N74HHzVQgDIQPceVUh1aeU2M= 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 h1:GWkl3rkRO/JGRTWoLLIqwf7AWC4/W/1hMOUZqmX0js4= github.com/aws/aws-sdk-go v1.16.26/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.24.0 h1:TtQCY3HaFXeo1yg2JAdfSbpN/Nsd9V5SCfDksEf2nSE= github.com/aws/aws-sdk-go v1.24.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= @@ -771,8 +771,6 @@ golang.org/x/sys v0.0.0-20191105231009-c1f44814a5cd h1:3x5uuvBgE6oaXJjCOvpCC1Ipg golang.org/x/sys v0.0.0-20191105231009-c1f44814a5cd/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-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20220712014510-0a85c31ab51e h1:NHvCuwuS43lGnYhten69ZWqi2QOj/CiDNcKbVqwVoew= -golang.org/x/sys v0.0.0-20220712014510-0a85c31ab51e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 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/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -967,4 +965,4 @@ 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/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck= 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= +vbom.ml/util v0.0.0-20160121211510-db5cfe13f5cc/go.mod h1:so/NYdZXCz+E3ZpW0uAoCj6uzU2+8OWDFv/HxUSs7kI= \ No newline at end of file diff --git a/install/sample/overlays/deployment/greeting.yaml b/install/sample/overlays/deployment/greeting.yaml index 2a146fb1..2c8593d9 100644 --- a/install/sample/overlays/deployment/greeting.yaml +++ b/install/sample/overlays/deployment/greeting.yaml @@ -22,7 +22,6 @@ spec: spec: containers: - image: nginx - imagePullPolicy: IfNotPresent name: greeting ports: - containerPort: 80 diff --git a/install/sample/overlays/grpc/grpc-server.yaml b/install/sample/overlays/grpc/grpc-server.yaml index cad92273..1a98fef1 100644 --- a/install/sample/overlays/grpc/grpc-server.yaml +++ b/install/sample/overlays/grpc/grpc-server.yaml @@ -20,7 +20,6 @@ spec: containers: - name: grpc-server image: buoyantio/strest-grpc:latest - imagePullPolicy: IfNotPresent args: - "server" - "--address=:11111" diff --git a/install/sample/overlays/rollout-bluegreen/greeting.yaml b/install/sample/overlays/rollout-bluegreen/greeting.yaml index 19622bd0..4a340c2b 100644 --- a/install/sample/overlays/rollout-bluegreen/greeting.yaml +++ b/install/sample/overlays/rollout-bluegreen/greeting.yaml @@ -21,7 +21,6 @@ spec: spec: containers: - image: nginx - imagePullPolicy: IfNotPresent name: greeting ports: - containerPort: 80 diff --git a/install/sample/overlays/rollout-canary/greeting.yaml b/install/sample/overlays/rollout-canary/greeting.yaml index cf9059fd..ab8987fb 100644 --- a/install/sample/overlays/rollout-canary/greeting.yaml +++ b/install/sample/overlays/rollout-canary/greeting.yaml @@ -20,7 +20,6 @@ spec: spec: containers: - image: nginx - imagePullPolicy: IfNotPresent name: greeting ports: - containerPort: 80