From daa15a9d4772c29198e15489d7528c79a32a7ebe Mon Sep 17 00:00:00 2001 From: Punakshi Chaand Date: Tue, 11 Feb 2025 09:17:18 -0800 Subject: [PATCH] MESH-6122: Remove redundant logging statements across the codebase (#866) * MESH-6122: Remove redundant logging statements across the codebase * MESH-6122: Add error logging for failed sidecar updates in serviceentry.go --- .../admiralIgnoreIdentityStateChecker.go | 2 - .../admiralReadWriteLeaseStateChecker.go | 1 - admiral/pkg/clusters/admiralStateChecker.go | 3 - .../clientconnectionconfig_handler.go | 12 ---- .../pkg/clusters/clientdiscovery_handler.go | 7 -- admiral/pkg/clusters/dependency_handler.go | 2 - admiral/pkg/clusters/deployment_handler.go | 5 -- .../pkg/clusters/destinationrule_handler.go | 34 --------- admiral/pkg/clusters/dynamoDB.go | 1 - admiral/pkg/clusters/envoyfilter.go | 6 -- admiral/pkg/clusters/globaltraffic_handler.go | 5 -- admiral/pkg/clusters/handler.go | 24 +++++-- .../pkg/clusters/outlierdetection_handler.go | 6 -- admiral/pkg/clusters/rollout_handler.go | 3 - admiral/pkg/clusters/routingpolicy_handler.go | 3 - admiral/pkg/clusters/service_handler.go | 16 ----- admiral/pkg/clusters/serviceentry.go | 72 ++----------------- admiral/pkg/clusters/serviceentry_handler.go | 33 --------- admiral/pkg/clusters/util.go | 6 -- .../pkg/clusters/virtualservice_handler.go | 10 --- admiral/pkg/controller/common/common.go | 1 - .../pkg/controller/istio/destinationrule.go | 1 - admiral/pkg/controller/istio/serviceentry.go | 1 - 23 files changed, 22 insertions(+), 232 deletions(-) diff --git a/admiral/pkg/clusters/admiralIgnoreIdentityStateChecker.go b/admiral/pkg/clusters/admiralIgnoreIdentityStateChecker.go index cc59c4843..318241859 100644 --- a/admiral/pkg/clusters/admiralIgnoreIdentityStateChecker.go +++ b/admiral/pkg/clusters/admiralIgnoreIdentityStateChecker.go @@ -87,7 +87,6 @@ func (checker *ignoreIdentityStateChecker) shouldRunOnIndependentGoRoutine() boo func (checker *ignoreIdentityStateChecker) runStateCheck(ctx context.Context) { period := time.Duration(checker.admiralConfig.IgnoreIdentityList.StateCheckerPeriodInSeconds) * time.Second - log.Infof("op=ignoreIdentityStateChecker message=starting ticker to fetch ignore list every %v seconds", period) ticker := time.NewTicker(period) defer ticker.Stop() state, err := checker.getState() @@ -99,7 +98,6 @@ func (checker *ignoreIdentityStateChecker) runStateCheck(ctx context.Context) { for { select { case <-ctx.Done(): - log.Infof("op=ignoreIdentityStateChecker message=context done stopping ticker") return case <-ticker.C: state, err := checker.getState() diff --git a/admiral/pkg/clusters/admiralReadWriteLeaseStateChecker.go b/admiral/pkg/clusters/admiralReadWriteLeaseStateChecker.go index ebeb4b2a1..26b2c54db 100644 --- a/admiral/pkg/clusters/admiralReadWriteLeaseStateChecker.go +++ b/admiral/pkg/clusters/admiralReadWriteLeaseStateChecker.go @@ -110,7 +110,6 @@ func ExecuteStateCheck(ctx context.Context, dynamoDBConfig DynamoDBConfig, dynam dynamodbClient.updatedReadWriteLease(readWriteLease, dynamoDBConfig.TableName) //Not updating read-write mode until we confirm this pod has the lease } else if skipLeaseCheckPodName == readWriteLease.LeaseOwner { - log.Info("DynamoDR: Lease held by skip lease check pod. Setting Admiral to read only mode") commonUtil.CurrentAdmiralState.ReadOnly = ReadOnlyEnabled commonUtil.CurrentAdmiralState.IsStateInitialized = StateInitialized } else if remoteRegistry != nil && podIdentifier == readWriteLease.LeaseOwner && IsCacheWarmupTime(remoteRegistry) { diff --git a/admiral/pkg/clusters/admiralStateChecker.go b/admiral/pkg/clusters/admiralStateChecker.go index fbcb4ca01..b740367ac 100644 --- a/admiral/pkg/clusters/admiralStateChecker.go +++ b/admiral/pkg/clusters/admiralStateChecker.go @@ -21,12 +21,9 @@ Utility function to start Admiral DR checks. DR checks can be run either on the main go routine or a new go routine */ func RunAdmiralStateCheck(ctx context.Context, stateChecker string, asc AdmiralStateChecker) { - log.Infof("Starting %s state checker", stateChecker) if asc.shouldRunOnIndependentGoRoutine() { - log.Infof("Starting %s state checker on a new Go Routine", stateChecker) go asc.runStateCheck(ctx) } else { - log.Infof("Starting %s state checker on existing Go Routine", stateChecker) asc.runStateCheck(ctx) } } diff --git a/admiral/pkg/clusters/clientconnectionconfig_handler.go b/admiral/pkg/clusters/clientconnectionconfig_handler.go index 2b2c2f16e..ac41b8a00 100644 --- a/admiral/pkg/clusters/clientconnectionconfig_handler.go +++ b/admiral/pkg/clusters/clientconnectionconfig_handler.go @@ -9,7 +9,6 @@ import ( v1 "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/v1alpha1" "github.com/istio-ecosystem/admiral/admiral/pkg/controller/admiral" "github.com/istio-ecosystem/admiral/admiral/pkg/controller/common" - log "github.com/sirupsen/logrus" ) type ClientConnectionConfigHandler struct { @@ -52,10 +51,6 @@ func (c *clientConnectionSettingsCache) Put(clientConnectionSettings *v1.ClientC var clientConnectionSettingsIdentity = common.GetClientConnectionConfigIdentity(clientConnectionSettings) var clientConnectionSettingsEnv = common.GetClientConnectionConfigEnv(clientConnectionSettings) - log.Infof( - "adding clientConnectionSettings with name %v to clientConnectionSettingsCache. LabelMatch=%v env=%v", - clientConnectionSettings.Name, clientConnectionSettingsIdentity, clientConnectionSettingsEnv) - key := common.ConstructKeyWithEnvAndIdentity(clientConnectionSettingsEnv, clientConnectionSettingsIdentity) c.identityCache[key] = clientConnectionSettings return nil @@ -66,7 +61,6 @@ func (c *clientConnectionSettingsCache) Delete(identity string, environment stri defer c.mutex.Unlock() key := common.ConstructKeyWithEnvAndIdentity(environment, identity) if _, ok := c.identityCache[key]; ok { - log.Infof("deleting clientConnectionSettings with key=%s from clientConnectionSettingsCache", key) delete(c.identityCache, key) return nil } @@ -75,8 +69,6 @@ func (c *clientConnectionSettingsCache) Delete(identity string, environment stri func (c *ClientConnectionConfigHandler) Added(ctx context.Context, clientConnectionSettings *v1.ClientConnectionConfig) error { - log.Infof( - LogFormat, common.Add, common.ClientConnectionConfig, clientConnectionSettings.Name, c.ClusterID, "received") err := HandleEventForClientConnectionConfig( ctx, admiral.Add, clientConnectionSettings, c.RemoteRegistry, c.ClusterID, modifyServiceEntryForNewServiceOrPod) if err != nil { @@ -88,8 +80,6 @@ func (c *ClientConnectionConfigHandler) Added(ctx context.Context, func (c *ClientConnectionConfigHandler) Updated( ctx context.Context, clientConnectionSettings *v1.ClientConnectionConfig) error { - log.Infof( - LogFormat, common.Update, common.ClientConnectionConfig, clientConnectionSettings.Name, c.ClusterID, common.ReceivedStatus) err := HandleEventForClientConnectionConfig( ctx, admiral.Update, clientConnectionSettings, c.RemoteRegistry, c.ClusterID, modifyServiceEntryForNewServiceOrPod) if err != nil { @@ -101,8 +91,6 @@ func (c *ClientConnectionConfigHandler) Updated( func (c *ClientConnectionConfigHandler) Deleted( ctx context.Context, clientConnectionSettings *v1.ClientConnectionConfig) error { - log.Infof( - LogFormat, common.Delete, common.ClientConnectionConfig, clientConnectionSettings.Name, c.ClusterID, common.ReceivedStatus) err := HandleEventForClientConnectionConfig( ctx, admiral.Update, clientConnectionSettings, c.RemoteRegistry, c.ClusterID, modifyServiceEntryForNewServiceOrPod) if err != nil { diff --git a/admiral/pkg/clusters/clientdiscovery_handler.go b/admiral/pkg/clusters/clientdiscovery_handler.go index ca443d22f..9f1850d36 100644 --- a/admiral/pkg/clusters/clientdiscovery_handler.go +++ b/admiral/pkg/clusters/clientdiscovery_handler.go @@ -24,14 +24,11 @@ func (cdh *ClientDiscoveryHandler) Added(ctx context.Context, obj *common.K8sObj func HandleEventForClientDiscovery(ctx context.Context, event admiral.EventType, obj *common.K8sObject, remoteRegistry *RemoteRegistry, clusterName string) error { - log.Infof(LogFormat, event, obj.Type, obj.Name, clusterName, common.ReceivedStatus) globalIdentifier := common.GetGlobalIdentifier(obj.Annotations, obj.Labels) originalIdentifier := common.GetOriginalIdentifier(obj.Annotations, obj.Labels) if len(globalIdentifier) == 0 { - log.Infof(LogFormat, event, obj.Type, obj.Name, clusterName, "Skipped as '"+common.GetWorkloadIdentifier()+" was not found', namespace="+obj.Namespace) return nil } - ctxLogger := common.GetCtxLogger(ctx, globalIdentifier, "") ctx = context.WithValue(ctx, "clusterName", clusterName) ctx = context.WithValue(ctx, "eventResourceType", obj.Type) @@ -54,18 +51,15 @@ func HandleEventForClientDiscovery(ctx context.Context, event admiral.EventType, } if commonUtil.IsAdmiralReadOnly() { - ctxLogger.Infof(common.CtxLogFormat, event, "", "", "", "processing skipped as Admiral is in Read-only mode") return nil } if IsCacheWarmupTime(remoteRegistry) { - ctxLogger.Infof(common.CtxLogFormat, event, "", "", "", "processing skipped during cache warm up state") return fmt.Errorf(common.CtxLogFormat, event, obj.Name, obj.Namespace, clusterName, "processing skipped during cache warm up state for env="+" identity="+globalIdentifier) } //if we have a deployment/rollout in this namespace skip processing to save some cycles if DeploymentOrRolloutExistsInNamespace(remoteRegistry, globalIdentifier, clusterName, obj.Namespace) { - log.Infof(LogFormatAdv, "Process", obj.Type, obj.Name, obj.Namespace, clusterName, "Skipping client discovery as Deployment/Rollout already present in namespace for client="+globalIdentifier) return nil } @@ -73,7 +67,6 @@ func HandleEventForClientDiscovery(ctx context.Context, event admiral.EventType, depRecord := remoteRegistry.DependencyController.Cache.Get(globalIdentifier) if depRecord == nil { - log.Warnf(LogFormatAdv, "Process", obj.Type, obj.Name, obj.Namespace, clusterName, "Skipping client discovery as no dependency record found for client="+globalIdentifier) return nil } err := remoteRegistry.DependencyController.DepHandler.Added(ctx, depRecord) diff --git a/admiral/pkg/clusters/dependency_handler.go b/admiral/pkg/clusters/dependency_handler.go index de59ab7c1..76ff19ad9 100644 --- a/admiral/pkg/clusters/dependency_handler.go +++ b/admiral/pkg/clusters/dependency_handler.go @@ -47,7 +47,6 @@ func (dh *DependencyHandler) HandleDependencyRecord(ctx context.Context, obj *v1 remoteRegistry *RemoteRegistry, eventType admiral.EventType) error { sourceIdentity := obj.Spec.Source if len(sourceIdentity) == 0 { - log.Infof(LogFormat, string(eventType), common.DependencyResourceType, obj.Name, "", "No identity found namespace="+obj.Namespace) return nil } @@ -117,7 +116,6 @@ func (d *ProcessDestinationService) Process(ctx context.Context, dependency *v1. // the rollout/deployment event hasn't gone through yet. // This can be ignored, and not be added back to the dependency controller queue // because it will be processed by the rollout/deployment controller - ctxLogger.Infof(LogFormat, string(eventType), common.DependencyResourceType, dependency.Name, "", fmt.Sprintf("identity: %s, does not have any clusters. Skipping calling modifySE", dependency.Spec.Source)) return nil } diff --git a/admiral/pkg/clusters/deployment_handler.go b/admiral/pkg/clusters/deployment_handler.go index a4d668a32..f24db067c 100644 --- a/admiral/pkg/clusters/deployment_handler.go +++ b/admiral/pkg/clusters/deployment_handler.go @@ -40,14 +40,10 @@ type HandleEventForDeploymentFunc func( func HandleEventForDeployment(ctx context.Context, event admiral.EventType, obj *k8sAppsV1.Deployment, remoteRegistry *RemoteRegistry, clusterName string) error { - log.Infof(LogFormat, event, common.DeploymentResourceType, obj.Name, clusterName, common.ReceivedStatus) globalIdentifier := common.GetDeploymentGlobalIdentifier(obj) - log.Infof(LogFormat, event, common.DeploymentResourceType, obj.Name, clusterName, "globalIdentifier is "+globalIdentifier) originalIdentifier := common.GetDeploymentOriginalIdentifier(obj) - log.Infof(LogFormat, event, common.DeploymentResourceType, obj.Name, clusterName, "originalIdentifier is "+originalIdentifier) if len(globalIdentifier) == 0 { - log.Infof(LogFormat, event, common.DeploymentResourceType, obj.Name, clusterName, "Skipped as '"+common.GetWorkloadIdentifier()+" was not found', namespace="+obj.Namespace) return nil } @@ -66,7 +62,6 @@ func HandleEventForDeployment(ctx context.Context, event admiral.EventType, obj } if remoteRegistry.AdmiralCache.PartitionIdentityCache != nil && len(common.GetDeploymentIdentityPartition(obj)) > 0 { remoteRegistry.AdmiralCache.PartitionIdentityCache.Put(globalIdentifier, originalIdentifier) - log.Infof(LogFormat, event, common.DeploymentResourceType, obj.Name, clusterName, "PartitionIdentityCachePut "+globalIdentifier+" for "+originalIdentifier) } } } diff --git a/admiral/pkg/clusters/destinationrule_handler.go b/admiral/pkg/clusters/destinationrule_handler.go index eb7446cfa..cc0478f1f 100644 --- a/admiral/pkg/clusters/destinationrule_handler.go +++ b/admiral/pkg/clusters/destinationrule_handler.go @@ -106,19 +106,6 @@ func getDestinationRule(se *networkingV1Alpha3.ServiceEntry, locality string, gt dr.TrafficPolicy.LoadBalancer = loadBalancerSettings } - if dr.TrafficPolicy.LoadBalancer.LocalityLbSetting != nil { - if dr.TrafficPolicy.LoadBalancer.LocalityLbSetting.Distribute != nil { - ctxLogger.Infof(common.CtxLogFormat, - "getDestinationRule", dr.Host, "", "", "Running in Active-Passive Mode") - } else { - ctxLogger.Infof(common.CtxLogFormat, - "getDestinationRule", dr.Host, "", "", "Running in Active-Active Mode") - } - } else { - ctxLogger.Infof(common.CtxLogFormat, - "getDestinationRule", dr.Host, "", "", "Running in Active-Active Mode") - } - derivedOutlierDetection := getOutlierDetection(se, locality, gtpTrafficPolicy, outlierDetection, common.DisableDefaultAutomaticFailover()) if derivedOutlierDetection != nil { dr.TrafficPolicy.OutlierDetection = derivedOutlierDetection @@ -246,11 +233,8 @@ func getOutlierDetection( outlierDetectionCrd *v1.OutlierDetection, disableDefaultAutomaticFailover bool) *networkingV1Alpha3.OutlierDetection { if disableDefaultAutomaticFailover { - log.Infoln("default automatic failover is disabled. outlier detection " + - "will be configured only if OutlierDetection OR GTP resource is present") if (outlierDetectionCrd == nil || (outlierDetectionCrd.Spec.OutlierConfig == nil)) && (gtpTrafficPolicy == nil || gtpTrafficPolicy.OutlierDetection == nil) { - log.Infoln("Neither outlier not GTP configured, will not set outlier configuration") return &networkingV1Alpha3.OutlierDetection{ ConsecutiveGatewayErrors: &wrappers.UInt32Value{Value: 0}, Consecutive_5XxErrors: &wrappers.UInt32Value{Value: 0}, @@ -272,12 +256,10 @@ func getOutlierDetection( outlierDetection := getOutlierDetectionSkeleton(disableDefaultAutomaticFailover) //Give priority to outlier detection crd than GTP. Eventually support for outlier detection via GTP will be stopped. if outlierDetectionCrd != nil && outlierDetectionCrd.Spec.OutlierConfig != nil { - log.Infof("Using outlier detection config from Admiral Outlier Detection CRD. Hosts - %s", se.Hosts) outlierDetection.ConsecutiveGatewayErrors = &wrappers.UInt32Value{Value: outlierDetectionCrd.Spec.OutlierConfig.ConsecutiveGatewayErrors} outlierDetection.Interval = &duration.Duration{Seconds: outlierDetectionCrd.Spec.OutlierConfig.Interval} outlierDetection.BaseEjectionTime = &duration.Duration{Seconds: outlierDetectionCrd.Spec.OutlierConfig.BaseEjectionTime} } else if gtpTrafficPolicy != nil && gtpTrafficPolicy.OutlierDetection != nil { - log.Infof("Using outlier detection config from Admiral Global Traffic Policy CRD. Hosts - %s", se.Hosts) setDefaultValuesOfOutlierDetection(outlierDetection) if gtpTrafficPolicy.OutlierDetection.BaseEjectionTime > 0 { outlierDetection.BaseEjectionTime = &duration.Duration{ @@ -333,14 +315,9 @@ func setDefaultValuesOfOutlierDetection(outlierDetection *networkingV1Alpha3.Out func (dh *DestinationRuleHandler) Added(ctx context.Context, obj *v1alpha3.DestinationRule) error { if commonUtil.IsAdmiralReadOnly() { - log.Infof(LogFormat, "Add", "DestinationRule", obj.Name, dh.ClusterID, "Admiral is in read-only mode. Skipping resource from namespace="+obj.Namespace) return nil } if IgnoreIstioResource(obj.Spec.ExportTo, obj.Annotations, obj.Namespace) { - log.Infof(LogFormat, "Add", "DestinationRule", obj.Name, dh.ClusterID, "Skipping resource from namespace="+obj.Namespace) - if len(obj.Annotations) > 0 && obj.Annotations[common.AdmiralIgnoreAnnotation] == "true" { - log.Infof(LogFormat, "admiralIoIgnoreAnnotationCheck", "DestinationRule", obj.Name, dh.ClusterID, "Value=true namespace="+obj.Namespace) - } return nil } txId := common.FetchTxIdOrGenNew(ctx) @@ -354,14 +331,9 @@ func (dh *DestinationRuleHandler) Added(ctx context.Context, obj *v1alpha3.Desti func (dh *DestinationRuleHandler) Updated(ctx context.Context, obj *v1alpha3.DestinationRule) error { if commonUtil.IsAdmiralReadOnly() { - log.Infof(LogFormat, "Update", "DestinationRule", obj.Name, dh.ClusterID, "Admiral is in read-only mode. Skipping resource from namespace="+obj.Namespace) return nil } if IgnoreIstioResource(obj.Spec.ExportTo, obj.Annotations, obj.Namespace) { - log.Infof(LogFormat, "Update", "DestinationRule", obj.Name, dh.ClusterID, "Skipping resource from namespace="+obj.Namespace) - if len(obj.Annotations) > 0 && obj.Annotations[common.AdmiralIgnoreAnnotation] == "true" { - log.Infof(LogFormat, "admiralIoIgnoreAnnotationCheck", "DestinationRule", obj.Name, dh.ClusterID, "Value=true namespace="+obj.Namespace) - } return nil } txId := common.FetchTxIdOrGenNew(ctx) @@ -375,14 +347,9 @@ func (dh *DestinationRuleHandler) Updated(ctx context.Context, obj *v1alpha3.Des func (dh *DestinationRuleHandler) Deleted(ctx context.Context, obj *v1alpha3.DestinationRule) error { if commonUtil.IsAdmiralReadOnly() { - log.Infof(LogFormat, "Delete", "DestinationRule", obj.Name, dh.ClusterID, "Admiral is in read-only mode. Skipping resource from namespace="+obj.Namespace) return nil } if IgnoreIstioResource(obj.Spec.ExportTo, obj.Annotations, obj.Namespace) { - log.Infof(LogFormat, "Delete", "DestinationRule", obj.Name, dh.ClusterID, "Skipping resource from namespace="+obj.Namespace) - if len(obj.Annotations) > 0 && obj.Annotations[common.AdmiralIgnoreAnnotation] == "true" { - log.Infof(LogFormat, "admiralIoIgnoreAnnotationCheck", "DestinationRule", obj.Name, dh.ClusterID, "Value=true namespace="+obj.Namespace) - } return nil } txId := common.FetchTxIdOrGenNew(ctx) @@ -406,7 +373,6 @@ func handleDestinationRuleEvent(ctxLogger *log.Entry, ctx context.Context, obj * ) if len(dependentClusters) > 0 { - log.Infof(LogFormat, "Event", resourceType, obj.Name, clusterId, "Processing") util.MapCopy(allDependentClusters, dependentClusters) allDependentClusters[clusterId] = clusterId for _, dependentCluster := range allDependentClusters { diff --git a/admiral/pkg/clusters/dynamoDB.go b/admiral/pkg/clusters/dynamoDB.go index 20f69fd23..6417b2578 100644 --- a/admiral/pkg/clusters/dynamoDB.go +++ b/admiral/pkg/clusters/dynamoDB.go @@ -203,7 +203,6 @@ func (client *DynamoClient) getWorkloadDataItemByIdentityAndEnv(env, identity, t } if items == nil { - log.Infof("workload items came as nil for given env %s and identity %s in table %s", env, identity, tableName) return workloadDataItems, nil } diff --git a/admiral/pkg/clusters/envoyfilter.go b/admiral/pkg/clusters/envoyfilter.go index dd16e2585..4d7b71e27 100644 --- a/admiral/pkg/clusters/envoyfilter.go +++ b/admiral/pkg/clusters/envoyfilter.go @@ -69,8 +69,6 @@ func createOrUpdateEnvoyFilter(ctx context.Context, rc *RemoteController, routin envoyFilterName := fmt.Sprintf("%s-dr-%s-%s-%s", strings.ToLower(routingPolicy.Spec.Plugin), routingPolicyNameSha, dependentIdentitySha, version) envoyfilterSpec := constructEnvoyFilterStruct(routingPolicy, GetWorkloadSelectorLabels(workloadIdentityKey), version, envoyFilterName) - log.Infof(LogFormat, eventType, envoyFilter, envoyFilterName, rc.ClusterID, "version +"+version) - envoyfilter := &networking.EnvoyFilter{ TypeMeta: metaV1.TypeMeta{ Kind: "EnvoyFilter", @@ -99,11 +97,9 @@ func createOrUpdateEnvoyFilter(ctx context.Context, rc *RemoteController, routin EnvoyFilters(filterNamespace).Get(ctx, envoyFilterName, metaV1.GetOptions{}) if k8sErrors.IsNotFound(err1) { - log.Infof(LogFormat, eventType, envoyFilter, envoyFilterName, rc.ClusterID, "creating the envoy filter") filter, err2 = rc.RoutingPolicyController.IstioClient.NetworkingV1alpha3(). EnvoyFilters(filterNamespace).Create(ctx, envoyfilter, metaV1.CreateOptions{}) } else if err1 == nil { - log.Infof(LogFormat, eventType, envoyFilter, envoyFilterName, rc.ClusterID, "updating existing envoy filter") envoyfilter.ResourceVersion = filter.ResourceVersion filter, err2 = rc.RoutingPolicyController.IstioClient.NetworkingV1alpha3(). EnvoyFilters(filterNamespace).Update(ctx, envoyfilter, metaV1.UpdateOptions{}) @@ -154,8 +150,6 @@ func constructEnvoyFilterStruct(routingPolicy *v1.RoutingPolicy, workloadSelecto envoyFilterStringConfig += getHosts(routingPolicy) + "\n" envoyFilterStringConfig += getPlugin(routingPolicy) - log.Infof("msg=%s type=routingpolicy name=%s", "adding config", routingPolicy.Name) - configuration := structPb.Struct{ Fields: map[string]*structPb.Value{ "@type": {Kind: &structPb.Value_StringValue{StringValue: "type.googleapis.com/google.protobuf.StringValue"}}, diff --git a/admiral/pkg/clusters/globaltraffic_handler.go b/admiral/pkg/clusters/globaltraffic_handler.go index 7fac9a131..f82d8943f 100644 --- a/admiral/pkg/clusters/globaltraffic_handler.go +++ b/admiral/pkg/clusters/globaltraffic_handler.go @@ -46,7 +46,6 @@ func (g *globalTrafficCache) Put(gtp *v1.GlobalTrafficPolicy) error { var gtpIdentity = common.GetGtpIdentity(gtp) var gtpEnv = common.GetGtpEnv(gtp) - log.Infof("adding GTP with name %v to GTP cache. LabelMatch=%v env=%v", gtp.Name, gtpIdentity, gtpEnv) key := common.ConstructKeyWithEnvAndIdentity(gtpEnv, gtpIdentity) g.identityCache[key] = gtp return nil @@ -57,7 +56,6 @@ func (g *globalTrafficCache) Delete(identity string, environment string) error { defer g.mutex.Unlock() key := common.ConstructKeyWithEnvAndIdentity(environment, identity) if _, ok := g.identityCache[key]; ok { - log.Infof("deleting gtp with key=%s from global GTP cache", key) delete(g.identityCache, key) return nil } @@ -65,7 +63,6 @@ func (g *globalTrafficCache) Delete(identity string, environment string) error { } func (gtp *GlobalTrafficHandler) Added(ctx context.Context, obj *v1.GlobalTrafficPolicy) error { - log.Infof(LogFormat, "Added", "globaltrafficpolicy", obj.Name, gtp.ClusterID, "received") log.Infof(LogFormat, "Added", "globaltrafficpolicy", obj.Name, gtp.ClusterID, fmt.Sprintf("received gtp: %v", obj)) err := HandleEventForGlobalTrafficPolicy(ctx, admiral.Add, obj, gtp.RemoteRegistry, gtp.ClusterID, modifyServiceEntryForNewServiceOrPod) if err != nil { @@ -75,7 +72,6 @@ func (gtp *GlobalTrafficHandler) Added(ctx context.Context, obj *v1.GlobalTraffi } func (gtp *GlobalTrafficHandler) Updated(ctx context.Context, obj *v1.GlobalTrafficPolicy) error { - log.Infof(LogFormat, "Updated", "globaltrafficpolicy", obj.Name, gtp.ClusterID, "received") log.Infof(LogFormat, "Updated", "globaltrafficpolicy", obj.Name, gtp.ClusterID, fmt.Sprintf("received gtp: %v", obj)) err := HandleEventForGlobalTrafficPolicy(ctx, admiral.Update, obj, gtp.RemoteRegistry, gtp.ClusterID, modifyServiceEntryForNewServiceOrPod) if err != nil { @@ -85,7 +81,6 @@ func (gtp *GlobalTrafficHandler) Updated(ctx context.Context, obj *v1.GlobalTraf } func (gtp *GlobalTrafficHandler) Deleted(ctx context.Context, obj *v1.GlobalTrafficPolicy) error { - log.Infof(LogFormat, "Deleted", "globaltrafficpolicy", obj.Name, gtp.ClusterID, "received") err := HandleEventForGlobalTrafficPolicy(ctx, admiral.Delete, obj, gtp.RemoteRegistry, gtp.ClusterID, modifyServiceEntryForNewServiceOrPod) if err != nil { return fmt.Errorf(LogErrFormat, "Deleted", "globaltrafficpolicy", obj.Name, gtp.ClusterID, err.Error()) diff --git a/admiral/pkg/clusters/handler.go b/admiral/pkg/clusters/handler.go index 281f8d6c4..adc5b3c2c 100644 --- a/admiral/pkg/clusters/handler.go +++ b/admiral/pkg/clusters/handler.go @@ -15,6 +15,7 @@ import ( appsV1 "k8s.io/api/apps/v1" coreV1 "k8s.io/api/core/v1" metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v12 "k8s.io/apimachinery/pkg/apis/meta/v1" ) const ( @@ -45,7 +46,6 @@ func getIstioResourceName(host string, suffix string) string { func IgnoreIstioResource(exportTo []string, annotations map[string]string, namespace string) bool { if len(annotations) > 0 && annotations[common.AdmiralIgnoreAnnotation] == "true" { - log.Infof(LogFormat, "admiralIoIgnoreAnnotationCheck", "", "", "", "Value=true namespace="+namespace) return true } @@ -128,7 +128,6 @@ func getServiceForRollout(ctx context.Context, rc *RemoteController, rollout *ro } if rollout.Spec.Selector == nil || rollout.Spec.Selector.MatchLabels == nil { - log.Infof("No selector for rollout=%s in namespace=%s and cluster=%s", rollout.Name, rollout.Namespace, rc.ClusterID) return nil } @@ -196,7 +195,6 @@ func getServiceForRollout(ctx context.Context, rc *RemoteController, rollout *ro for _, route := range vs.Http { if route.Name == virtualServiceRouteName { httpRoute = route - log.Infof("VirtualService route referenced in rollout found, for rollout with name=%s route=%s in namespace=%s and cluster=%s", rollout.Name, virtualServiceRouteName, rollout.Namespace, rc.ClusterID) break } else { log.Debugf("Argo rollout VirtualService route name didn't match with a route, for rollout with name=%s route=%s in namespace=%s and cluster=%s", rollout.Name, route.Name, rollout.Namespace, rc.ClusterID) @@ -240,7 +238,6 @@ func getServiceForRollout(ctx context.Context, rc *RemoteController, rollout *ro for _, service := range cachedServices { //skip services that are not referenced in the rollout if service.ObjectMeta.Name != stableService { - log.Infof("Skipping service=%s for rollout=%s in namespace=%s and cluster=%s", service.Name, rollout.Name, rollout.Namespace, rc.ClusterID) continue } match := common.IsServiceMatch(service.Spec.Selector, rollout.Spec.Selector) @@ -315,9 +312,12 @@ func getServiceForRollout(ctx context.Context, rc *RemoteController, rollout *ro return matchedServices } -func GetServiceWithSuffixMatch(suffix string, services []*coreV1.Service) string { +func GetServiceWithSuffixMatch(suffix string, services []*coreV1.Service, rolloutSelector *v12.LabelSelector) string { + if rolloutSelector == nil || services == nil { + return "" + } for _, service := range services { - if strings.HasSuffix(service.Name, suffix) { + if strings.HasSuffix(service.Name, suffix) && common.IsServiceMatch(service.Spec.Selector, rolloutSelector) { return service.Name } } @@ -339,6 +339,12 @@ func DeploymentOrRolloutExistsInNamespace(remoteRegistry *RemoteRegistry, global deployments := remoteRegistry.remoteControllers[clusterName].DeploymentController.Cache.GetByIdentity(globalIdentifier) for _, deployment := range deployments { + if deployment == nil { + continue + } + if deployment.Deployment == nil { + continue + } if deployment.Deployment.Namespace == namespace { return true } @@ -346,6 +352,12 @@ func DeploymentOrRolloutExistsInNamespace(remoteRegistry *RemoteRegistry, global rollouts := remoteRegistry.remoteControllers[clusterName].RolloutController.Cache.GetByIdentity(globalIdentifier) for _, rollout := range rollouts { + if rollout == nil { + continue + } + if rollout.Rollout == nil { + continue + } if rollout.Rollout.Namespace == namespace { return true } diff --git a/admiral/pkg/clusters/outlierdetection_handler.go b/admiral/pkg/clusters/outlierdetection_handler.go index 395d31d97..9707c4e61 100644 --- a/admiral/pkg/clusters/outlierdetection_handler.go +++ b/admiral/pkg/clusters/outlierdetection_handler.go @@ -9,7 +9,6 @@ import ( v1 "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/v1alpha1" "github.com/istio-ecosystem/admiral/admiral/pkg/controller/admiral" "github.com/istio-ecosystem/admiral/admiral/pkg/controller/common" - log "github.com/sirupsen/logrus" ) type OutlierDetectionHandler struct { @@ -47,7 +46,6 @@ func (cache *outlierDetectionCache) Put(od *v1.OutlierDetection) error { identity := common.GetODIdentity(od) env := common.GetODEnv(od) - log.Infof("Adding OutlierDetection with name=%s to OutlierDetectionCache. LabelMatch=%v env=%v", od.Name, identity, env) key := common.ConstructKeyWithEnvAndIdentity(env, identity) cache.identityCache[key] = od return nil @@ -58,7 +56,6 @@ func (cache *outlierDetectionCache) Delete(identity string, env string) error { defer cache.mutex.Unlock() key := common.ConstructKeyWithEnvAndIdentity(env, identity) if _, ok := cache.identityCache[key]; ok { - log.Infof("Deleting OutlierDetection with key=%s from OutlierDetection cache.", key) delete(cache.identityCache, key) } else { return fmt.Errorf("OutlierDetection with key %s not found in cache", key) @@ -67,7 +64,6 @@ func (cache *outlierDetectionCache) Delete(identity string, env string) error { } func (od OutlierDetectionHandler) Added(ctx context.Context, obj *v1.OutlierDetection) error { - log.Infof(LogFormat, common.Add, common.OutlierDetection, obj.Name, od.ClusterID, common.ReceivedStatus) err := HandleEventForOutlierDetection(ctx, admiral.EventType(common.Add), obj, od.RemoteRegistry, od.ClusterID, modifyServiceEntryForNewServiceOrPod) if err != nil { return fmt.Errorf(LogErrFormat, common.Add, common.OutlierDetection, obj.Name, od.ClusterID, err.Error()) @@ -76,7 +72,6 @@ func (od OutlierDetectionHandler) Added(ctx context.Context, obj *v1.OutlierDete } func (od OutlierDetectionHandler) Updated(ctx context.Context, obj *v1.OutlierDetection) error { - log.Infof(LogFormat, common.Update, common.OutlierDetection, obj.Name, od.ClusterID, common.ReceivedStatus) err := HandleEventForOutlierDetection(ctx, admiral.Update, obj, od.RemoteRegistry, od.ClusterID, modifyServiceEntryForNewServiceOrPod) if err != nil { return fmt.Errorf(LogErrFormat, common.Update, common.OutlierDetection, obj.Name, od.ClusterID, err.Error()) @@ -85,7 +80,6 @@ func (od OutlierDetectionHandler) Updated(ctx context.Context, obj *v1.OutlierDe } func (od OutlierDetectionHandler) Deleted(ctx context.Context, obj *v1.OutlierDetection) error { - log.Infof(LogFormat, common.Delete, common.OutlierDetection, obj.Name, od.ClusterID, common.ReceivedStatus) err := HandleEventForOutlierDetection(ctx, admiral.Update, obj, od.RemoteRegistry, od.ClusterID, modifyServiceEntryForNewServiceOrPod) if err != nil { return fmt.Errorf(LogErrFormat, common.Delete, common.OutlierDetection, obj.Name, od.ClusterID, err.Error()) diff --git a/admiral/pkg/clusters/rollout_handler.go b/admiral/pkg/clusters/rollout_handler.go index 80b8bbf9c..4ce09ed0e 100644 --- a/admiral/pkg/clusters/rollout_handler.go +++ b/admiral/pkg/clusters/rollout_handler.go @@ -24,7 +24,6 @@ func (rh *RolloutHandler) Added(ctx context.Context, obj *argo.Rollout) error { } func (rh *RolloutHandler) Updated(ctx context.Context, obj *argo.Rollout) error { - log.Infof(LogFormat, common.Update, common.RolloutResourceType, obj.Name, rh.ClusterID, common.ReceivedStatus) return nil } @@ -42,11 +41,9 @@ type HandleEventForRolloutFunc func(ctx context.Context, event admiral.EventType // 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) error { - log.Infof(LogFormat, event, common.RolloutResourceType, obj.Name, clusterName, common.ReceivedStatus) globalIdentifier := common.GetRolloutGlobalIdentifier(obj) originalIdentifier := common.GetRolloutOriginalIdentifier(obj) if len(globalIdentifier) == 0 { - log.Infof(LogFormat, event, common.RolloutResourceType, obj.Name, clusterName, "Skipped as '"+common.GetWorkloadIdentifier()+" was not found', namespace="+obj.Namespace) return nil } env := common.GetEnvForRollout(obj) diff --git a/admiral/pkg/clusters/routingpolicy_handler.go b/admiral/pkg/clusters/routingpolicy_handler.go index c830ffabb..b7df4fabf 100644 --- a/admiral/pkg/clusters/routingpolicy_handler.go +++ b/admiral/pkg/clusters/routingpolicy_handler.go @@ -80,7 +80,6 @@ func (r *RoutingPolicyService) ProcessDependency(ctx context.Context, eventType } if !common.IsDependencyProcessingEnabled() { - log.Infof(LogFormat, string(eventType), common.DependencyResourceType, dependency.Name, "", "dependency processing is disabled") return nil } newDestinations, _ := getDestinationsToBeProcessed(eventType, dependency, r.RemoteRegistry) @@ -221,7 +220,6 @@ func (r *RoutingPolicyCache) Put(identity string, env string, name string, rp *v func (r *RoutingPolicyCache) Delete(identity string, env string, name string) { if commonUtil.IsAdmiralReadOnly() { - log.Infof(LogFormat, admiral.Delete, "routingpolicy", fmt.Sprintf("%s.%s.%s", identity, env, name), "", "skipping read-only mode") return } if common.GetEnableRoutingPolicy() { @@ -274,7 +272,6 @@ func (r *routingPolicyFilterCache) Put(identityEnvKey string, clusterId string, func (r *routingPolicyFilterCache) Delete(identityEnvKey string) { if commonUtil.IsAdmiralReadOnly() { - log.Infof(LogFormat, admiral.Delete, "routingpolicy", identityEnvKey, "", "skipping read-only mode") return } if common.GetEnableRoutingPolicy() { diff --git a/admiral/pkg/clusters/service_handler.go b/admiral/pkg/clusters/service_handler.go index e2f3b3a48..8d1ac6701 100644 --- a/admiral/pkg/clusters/service_handler.go +++ b/admiral/pkg/clusters/service_handler.go @@ -7,7 +7,6 @@ import ( rolloutsV1Alpha1 "github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1" "github.com/istio-ecosystem/admiral/admiral/pkg/controller/admiral" "github.com/istio-ecosystem/admiral/admiral/pkg/controller/common" - log "github.com/sirupsen/logrus" appsV1 "k8s.io/api/apps/v1" coreV1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -19,7 +18,6 @@ type ServiceHandler struct { } func (sh *ServiceHandler) Added(ctx context.Context, obj *coreV1.Service) error { - log.Infof(LogFormat, common.Add, common.ServiceResourceType, obj.Name, sh.ClusterID, common.ReceivedStatus) ctx = context.WithValue(ctx, common.EventType, admiral.Add) err := handleEventForService(ctx, obj, sh.RemoteRegistry, sh.ClusterID) if err != nil { @@ -29,7 +27,6 @@ func (sh *ServiceHandler) Added(ctx context.Context, obj *coreV1.Service) error } func (sh *ServiceHandler) Updated(ctx context.Context, obj *coreV1.Service) error { - log.Infof(LogFormat, common.Update, common.ServiceResourceType, obj.Name, sh.ClusterID, common.ReceivedStatus) ctx = context.WithValue(ctx, common.EventType, admiral.Update) err := handleEventForService(ctx, obj, sh.RemoteRegistry, sh.ClusterID) if err != nil { @@ -39,7 +36,6 @@ func (sh *ServiceHandler) Updated(ctx context.Context, obj *coreV1.Service) erro } func (sh *ServiceHandler) Deleted(ctx context.Context, obj *coreV1.Service) error { - log.Infof(LogFormat, common.Delete, common.ServiceResourceType, obj.Name, sh.ClusterID, common.ReceivedStatus) ctx = context.WithValue(ctx, common.EventType, admiral.Delete) err := handleEventForService(ctx, obj, sh.RemoteRegistry, sh.ClusterID) if err != nil { @@ -108,14 +104,8 @@ func handleServiceEventForDeployment( // else it would delete all the SEs in the source and dependent clusters eventType = admiral.Update deployments = deployController.Cache.List() - log.Infof(LogFormat, "Event", "Deployment", "", clusterName, - fmt.Sprintf("updating %v deployments across the cluster for service %s", - len(deployments), svc.Name)) } else { deployments = deployController.GetDeploymentBySelectorInNamespace(ctx, svc.Spec.Selector, svc.Namespace) - log.Infof(LogFormat, "Event", "Deployment", "", clusterName, - fmt.Sprintf("updating %v deployments across namespace %s for service %s", - len(deployments), svc.Namespace, svc.Name)) } for _, deployment := range deployments { @@ -171,14 +161,8 @@ func handleServiceEventForRollout( // else it would delete all the SEs in the source and dependent clusters eventType = admiral.Update rollouts = rolloutController.Cache.List() - log.Infof(LogFormat, "Event", "Rollout", "", clusterName, - fmt.Sprintf("updating %v rollouts across the cluster for service %s", - len(rollouts), svc.Name)) } else { rollouts = rolloutController.GetRolloutBySelectorInNamespace(ctx, svc.Spec.Selector, svc.Namespace) - log.Infof(LogFormat, "Event", "Rollout", "", clusterName, - fmt.Sprintf("updating %v rollouts across namespace %s for service %s", - len(rollouts), svc.Namespace, svc.Name)) } for _, rollout := range rollouts { diff --git a/admiral/pkg/clusters/serviceentry.go b/admiral/pkg/clusters/serviceentry.go index fec6e26ed..595a81b2c 100644 --- a/admiral/pkg/clusters/serviceentry.go +++ b/admiral/pkg/clusters/serviceentry.go @@ -391,13 +391,6 @@ func modifyServiceEntryForNewServiceOrPod( common.CtxLogFormat, "populateClientConnectionConfigCache", deploymentOrRolloutName, deploymentOrRolloutNS, clusterId, err.Error()) } - ctxLogger.Infof( - common.CtxLogFormat, "populateClientConnectionConfigCache", deploymentOrRolloutName, - deploymentOrRolloutNS, clusterId, "Success") - } else { - ctxLogger.Infof( - common.CtxLogFormat, "populateClientConnectionConfigCache", deploymentOrRolloutName, - deploymentOrRolloutNS, clusterId, "Skipped as ClientConnectionConfig processing is disabled") } } @@ -439,7 +432,6 @@ func modifyServiceEntryForNewServiceOrPod( start = time.Now() gtpPreferenceRegion, err := updateGlobalGtpCacheAndGetGtpPreferenceRegion(remoteRegistry, partitionedIdentity, env, gtps, clusterName, ctxLogger) ctx = context.WithValue(ctx, common.GtpPreferenceRegion, gtpPreferenceRegion) - ctxLogger.Infof("GTP preference region is set to %v", ctx.Value(common.GtpPreferenceRegion)) if err != nil { modifySEerr = common.AppendError(modifySEerr, err) } @@ -468,18 +460,13 @@ func modifyServiceEntryForNewServiceOrPod( start = time.Now() sourceClusterKeys := orderSourceClusters(ctx, remoteRegistry, sourceServices) - ctxLogger.Infof(common.CtxLogFormat, "OrderSourceClusters", deploymentOrRolloutName, deploymentOrRolloutNS, "", "sourceClusterKeys="+strings.Join(sourceClusterKeys, ",")) for _, sourceCluster := range sourceClusterKeys { serviceInstance := sourceServices[sourceCluster] resourceLabels := fetchResourceLabel(sourceDeployments, sourceRollouts, sourceCluster) if resourceLabels != nil { // check if additional endpoint generation is required - ctxLogger.Infof(common.CtxLogFormat, "DoGenerateAdditionalEndpoints", - deploymentOrRolloutName, deploymentOrRolloutNS, "", "checking if we need additional endpoints. Resource label length:"+strconv.Itoa(len(resourceLabels))) isAdditionalEndpointGenerationEnabled = doGenerateAdditionalEndpoints(ctxLogger, resourceLabels, partitionedIdentity, remoteRegistry.AdmiralCache) - ctxLogger.Infof(common.CtxLogFormat, "DoGenerateAdditionalEndpoints", - deploymentOrRolloutName, deploymentOrRolloutNS, "", "additional endpoint generation is="+strconv.FormatBool(isAdditionalEndpointGenerationEnabled)) } else { ctxLogger.Warnf(common.CtxLogFormat, "Event", deploymentOrRolloutName, deploymentOrRolloutNS, sourceCluster, "unable to find label for rollout or deployment in source cluster: "+sourceCluster) } @@ -995,15 +982,10 @@ func updateGlobalClientConnectionConfigCache(ctxLogger *logrus.Entry, cache *Adm } if len(clientConnectionSettingsOrdered) == 0 { - ctxLogger.Infof(common.CtxLogFormat, "UpdateGlobalClientConnectionConfigCache", "", "", "", fmt.Sprintf( - "no %s found for identity=%s in env=%s. Deleting global cache entries if any", - common.ClientConnectionConfig, identity, env)) cache.ClientConnectionConfigCache.Delete(identity, env) return nil } if len(clientConnectionSettingsOrdered) > 1 { - ctxLogger.Infof(common.CtxLogFormat, "UpdateGlobalClientConnectionConfigCache", "", "", "", fmt.Sprintf( - "more than one %s found for identity=%s in env=%s.", common.ClientConnectionConfig, identity, env)) sortClientConnectionConfigByCreationTime(clientConnectionSettingsOrdered, identity, env) } @@ -1016,9 +998,6 @@ func updateGlobalClientConnectionConfigCache(ctxLogger *logrus.Entry, cache *Adm common.ClientConnectionConfig, mostRecentClientConnectionConfig.Name, mostRecentClientConnectionConfig.Namespace, identity, err) } - ctxLogger.Infof(common.CtxLogFormat, "UpdateGlobalClientConnectionConfigCache", "", "", "", - fmt.Sprintf("%s with name=%s in namespace=%s is actively used for identity=%s", - common.ClientConnectionConfig, mostRecentClientConnectionConfig.Name, mostRecentClientConnectionConfig.Namespace, identity)) return nil } @@ -1030,12 +1009,10 @@ func updateGlobalOutlierDetectionCache(ctxLogger *logrus.Entry, cache *AdmiralCa } if len(odOrder) == 0 { - ctxLogger.Infof("No %s found for identity=%s in env=%s. Deleting global cache entries if any", common.OutlierDetection, identity, env) cache.OutlierDetectionCache.Delete(identity, env) return } else if len(odOrder) > 0 { //TODO : Test with multiple outlier detection in use case of env alias qa, qa-west etc - ctxLogger.Infof("More than one %s found for identity=%s in env=%s.", common.OutlierDetection, identity, env) sortOutlierDetectionByCreationTime(odOrder, identity, env) } @@ -1046,11 +1023,7 @@ func updateGlobalOutlierDetectionCache(ctxLogger *logrus.Entry, cache *AdmiralCa if err != nil { ctxLogger.Errorf("Error in updating %s with name=%s in namespace=%s as actively used for identity=%s with err=%v", common.OutlierDetection, mostRecentOd.Name, mostRecentOd.Namespace, common.ConstructKeyWithEnvAndIdentity(common.GetODEnv(mostRecentOd), common.GetODIdentity(mostRecentOd)), err) - } else { - ctxLogger.Infof("%s with name=%s in namespace=%s is actively used for identity=%s", common.OutlierDetection, mostRecentOd.Name, mostRecentOd.Namespace, - common.ConstructKeyWithEnvAndIdentity(common.GetODEnv(mostRecentOd), common.GetODIdentity(mostRecentOd))) } - } // Does two things; @@ -1076,7 +1049,6 @@ func updateGlobalGtpCacheAndGetGtpPreferenceRegion(remoteRegistry *RemoteRegistr remoteRegistry.AdmiralCache.GlobalTrafficCache.Delete(identity, env) return "", nil } else if len(gtpsOrdered) > 1 { - ctxLogger.Infof("More than one GTP found for identity=%s in env=%s.", identity, env) //sort by creation time and priority, gtp with highest priority and most recent at the beginning common.SortGtpsByPriorityAndCreationTime(gtpsOrdered, identity, env) } @@ -1236,15 +1208,14 @@ func addUpdateSidecar(ctxLogger *logrus.Entry, ctx context.Context, obj *v1alpha exist.Annotations = obj.Annotations exist.Spec = obj.Spec if commonUtil.IsAdmiralReadOnly() { - ctxLogger.Infof(LogErrFormat, "Update", "Sidecar", obj.Name, rc.ClusterID, "Skipped as Admiral pod is in read only mode") return } _, err = rc.SidecarController.IstioClient.NetworkingV1alpha3().Sidecars(namespace).Update(ctx, obj, v12.UpdateOptions{}) if err != nil { - err = retryUpdatingSidecar(ctxLogger, ctx, obj, exist, namespace, rc, err, "Update") - ctxLogger.Infof(LogErrFormat, "Update", "Sidecar", obj.Name, rc.ClusterID, err) - } else { - ctxLogger.Infof(LogErrFormat, "Update", "Sidecar", obj.Name, rc.ClusterID, "Success") + err := retryUpdatingSidecar(ctxLogger, ctx, obj, exist, namespace, rc, err, "Update") + if err != nil { + ctxLogger.Infof(LogErrFormat, "Update", "Sidecar", obj.Name, rc.ClusterID, err) + } } } @@ -1257,11 +1228,9 @@ func retryUpdatingSidecar(ctxLogger *logrus.Entry, ctx context.Context, obj *v1a updatedSidecar, err := rc.SidecarController.IstioClient.NetworkingV1alpha3().Sidecars(namespace).Get(ctx, exist.Name, v12.GetOptions{}) // if old sidecar not found, just create a new sidecar instead if err != nil { - ctxLogger.Infof(common.CtxLogFormat, op, exist.Name, exist.Namespace, rc.ClusterID, err.Error()+fmt.Sprintf(". Error getting old sidecar")) continue } existingResourceVersion := updatedSidecar.GetResourceVersion() - ctxLogger.Infof(common.CtxLogFormat, op, obj.Name, obj.Namespace, rc.ClusterID, fmt.Sprintf("existingResourceVersion=%s resourceVersionUsedForUpdate=%s", updatedSidecar.ResourceVersion, obj.ResourceVersion)) updatedSidecar.Spec = obj.Spec updatedSidecar.Annotations = obj.Annotations updatedSidecar.Labels = obj.Labels @@ -1325,8 +1294,6 @@ func AddServiceEntriesWithDrToAllCluster(ctxLogger *logrus.Entry, ctx context.Co return fmt.Errorf("failed to process service entry for identity %s and env %s as it is nil or has empty hosts", identityId, env) } - ctxLogger.Infof("DependentClusterWorkerConcurrency: %v", common.DependentClusterWorkerConcurrency()) - for w := 1; w <= common.DependentClusterWorkerConcurrency(); w++ { go AddServiceEntriesWithDrWorker(ctxLogger, ctx, rr, isAdditionalEndpointsEnabled, isServiceEntryModifyCalledForSourceCluster, identityId, env, copyServiceEntry(se), clusters, errors) @@ -1592,7 +1559,6 @@ func AddServiceEntriesWithDrWorker( util.LogElapsedTimeSinceTask(ctxLogger, "AdmiralCacheSeClusterCachePut", "", "", cluster, "", start) // Create additional endpoints if necessary if isAdditionalEndpointsEnabled { - ctxLogger.Infof("gatewayAliases=%v", common.GetGatewayAssetAliases()) // build list of gateway clusters gwClusters := []string{} for _, gwAlias := range common.GetGatewayAssetAliases() { @@ -1610,7 +1576,6 @@ func AddServiceEntriesWithDrWorker( }) } } - ctxLogger.Infof("gatewayClusters=%v", gwClusters) vsDNSPrefix := getDNSPrefixFromServiceEntry(seDr) // if env contains -air suffix remove it else return original string trimmedAirEnv := strings.TrimSuffix(env, common.AIREnvSuffix) @@ -1632,8 +1597,6 @@ func AddServiceEntriesWithDrWorker( addSEorDRToAClusterError = common.AppendError(addSEorDRToAClusterError, err) } } - } else { - ctxLogger.Infof(LogFormat, "Create", "VirtualService", env+"."+identityId, cluster, "skipped creating additional endpoints through VirtualService in "+syncNamespace+" namespace") } //update workloadEndpoint entry to dynamoDB workloadData table only for source entry @@ -1645,8 +1608,6 @@ func AddServiceEntriesWithDrWorker( addSEorDRToAClusterError = common.AppendError(addSEorDRToAClusterError, err) ctxLogger.Errorf(LogErrFormat, "Create", "dynamoDbWorkloadData", env+"."+identityId, cluster, err.Error()) } - } else { - ctxLogger.Infof(LogFormat, "Create", "dynamoDbWorkloadData", env+"."+identityId, cluster, "skipped updating workload data as this is not source cluster") } } } @@ -1776,7 +1737,6 @@ func handleDynamoDbUpdateForOldGtp(oldGtp *v1.GlobalTrafficPolicy, remoteRegistr } if workloadData == nil { - ctxLogger.Infof("got nil workload data when get on admiral database client was called") return nil } @@ -1835,7 +1795,6 @@ func calculateShasumForWorkloadData(workloadData WorkloadData) []byte { func verifyIfEndpointRecordNeedsUpdate(ctxLogger *logrus.Entry, cache *AdmiralCache, serviceEntryHost string, newWorkloadDataShasum []byte) bool { existingShaSum, ok := cache.DynamoDbEndpointUpdateCache.Load(serviceEntryHost) if ok && (fmt.Sprint(existingShaSum) == fmt.Sprint(newWorkloadDataShasum)) { - ctxLogger.Infof("no diff between new workload data and existing data for endpoint %v, hence not updating dynamoDB record", serviceEntryHost) return false } return true @@ -1931,8 +1890,6 @@ func getGTPDetails(ctxLogger *logrus.Entry, serviceEntry *v1alpha3.ServiceEntry, break } } - } else { - ctxLogger.Infof("creating workload entry without gtp details, as gtp or gtp policy is not configured for asset - %v", serviceEntry.Annotations[common.GetWorkloadIdentifier()]) } return lbType, dnsPrefix, trafficDistribution, gtpManagedBy, gtpId, lastUpdatedAt @@ -1946,19 +1903,15 @@ func getGTPDetails(ctxLogger *logrus.Entry, serviceEntry *v1alpha3.ServiceEntry, func doGenerateAdditionalEndpoints(ctxLogger *logrus.Entry, labels map[string]string, identity string, admiralCache *AdmiralCache) bool { additionalEndpointSuffixes := common.GetAdditionalEndpointSuffixes() if len(additionalEndpointSuffixes) <= 0 { - ctxLogger.Infof(common.CtxLogFormat, "DoGenerateAdditionalEndpoints", "", "", "No additional endpoint suffixes found") return false } // Check if admiral configured allowed labels are in the passed labels map additionalEndpointAnnotationFilters := common.GetAdditionalEndpointLabelFilters() if util.Contains(additionalEndpointAnnotationFilters, "*") { - ctxLogger.Infof(common.CtxLogFormat, "DoGenerateAdditionalEndpoints", "", "", "additional endpoints contains *") return true } if doesContainLabel(ctxLogger, labels, additionalEndpointAnnotationFilters) { // Store it in the map only if the labels match - ctxLogger.Infof(common.CtxLogFormat, - "DoGenerateAdditionalEndpoints", "", "", fmt.Sprintf("labels contains additionalEndpointAnnotationFilters=%v", additionalEndpointAnnotationFilters)) admiralCache.IdentitiesWithAdditionalEndpoints.Store(identity, identity) return true } @@ -1971,13 +1924,10 @@ func doGenerateAdditionalEndpoints(ctxLogger *logrus.Entry, labels map[string]st for _, dependent := range dependents.GetKeys() { _, ok := admiralCache.IdentitiesWithAdditionalEndpoints.Load(dependent) if ok { - ctxLogger.Infof(common.CtxLogFormat, "DoGenerateAdditionalEndpoints", "", "", fmt.Sprintf("dependentAssetWithAdditionalEndpoints=%s", dependent)) return true } } } - ctxLogger.Infof(common.CtxLogFormat, - "DoGenerateAdditionalEndpoints", "", "", "no dependents found, additional endpoints creation=false") return false } @@ -1985,17 +1935,13 @@ func doGenerateAdditionalEndpoints(ctxLogger *logrus.Entry, labels map[string]st // resources's label's map func doesContainLabel(ctxLogger *logrus.Entry, labels map[string]string, allowedLabels []string) bool { if labels == nil { - ctxLogger.Infof(common.CtxLogFormat, "doesContainLabel", "", "", "", "no labels found") return false } for _, filter := range allowedLabels { if _, ok := labels[filter]; ok { - ctxLogger.Infof(common.CtxLogFormat, "doesContainLabel", "", "", "", "found matching label") return true } - ctxLogger.Infof(common.CtxLogFormat, "doesContainLabel", "", "", "", "labels does not contain filter="+filter) } - ctxLogger.Infof(common.CtxLogFormat, "doesContainLabel", "", "", "", "no matching label found") return false } @@ -2048,7 +1994,6 @@ func deleteAdditionalEndpoints(ctxLogger *logrus.Entry, ctx context.Context, rc ctxLogger.Errorf(LogErrFormat, "Delete", "VirtualService", vsToDelete.Name, rc.ClusterID, err) return err } - ctxLogger.Infof(LogFormat, "Delete", "VirtualService", vsToDelete.Name, rc.ClusterID, "Success") } return nil } @@ -2114,9 +2059,7 @@ func createAdditionalEndpoints( if existingVS != nil { if common.IsPresent(gatewayClusters, rc.ClusterID) && eventResourceType == common.Rollout && common.IsAirEnv(originalEnvLabel) { - ctxLogger.Infof(common.CtxLogFormat, "updateAdditionalEndpointInGWCluster", "admiral-sync", rc.ClusterID, "event for updating existing VS in Gateway cluster received. will be updating the VS.") } else { - ctxLogger.Infof("VirtualService for additional endpoint already exists, skipping. name=%s cluster=%s", defaultVSName, rc.ClusterID) return nil } } @@ -2146,7 +2089,6 @@ func createAdditionalEndpoints( if dependentClusterNamespaces != nil && dependentClusterNamespaces.Len() > 0 { for _, vshostname := range virtualServiceHostnames { rr.AdmiralCache.CnameDependentClusterNamespaceCache.PutMapofMaps(strings.ToLower(vshostname), dependentClusterNamespaces) - ctxLogger.Infof("clusterNamespaces for vs hostname %v was empty, replacing with clusterNamespaces for %v", vshostname, defaultCname) rr.AdmiralCache.CnameIdentityCache.Store(vshostname, partitionedIdentity) } } @@ -2224,11 +2166,6 @@ func createSeAndDrSetFromGtp(ctxLogger *logrus.Entry, ctx context.Context, env, if globalTrafficPolicy != nil { gtp := globalTrafficPolicy.Spec for _, gtpTrafficPolicy := range gtp.Policy { - ctxLogger.Infof("Processing dnsPrefix=%s, lbType=%s, "+ - "outlier_detection=%s on gtp=%s from namespace=%s for identity=%s in env=%s", - gtpTrafficPolicy.DnsPrefix, - gtpTrafficPolicy.LbType, gtpTrafficPolicy.OutlierDetection.String(), - globalTrafficPolicy.Name, globalTrafficPolicy.Namespace, common.GetGtpIdentity(globalTrafficPolicy), env) var modifiedSe = se var host = se.Hosts[0] var drName, seName = defaultDrName, defaultSeName @@ -2324,7 +2261,6 @@ func loadServiceEntryCacheData(ctxLogger *logrus.Entry, ctx context.Context, c a if entryCache != nil { *admiralCache.ServiceEntryAddressStore = *entryCache - ctxLogger.Infof("Successfully updated service entry cache state") } } diff --git a/admiral/pkg/clusters/serviceentry_handler.go b/admiral/pkg/clusters/serviceentry_handler.go index e7eef1459..b25f64b5b 100644 --- a/admiral/pkg/clusters/serviceentry_handler.go +++ b/admiral/pkg/clusters/serviceentry_handler.go @@ -6,8 +6,6 @@ import ( "fmt" "time" - commonUtil "github.com/istio-ecosystem/admiral/admiral/pkg/util" - "github.com/istio-ecosystem/admiral/admiral/pkg/controller/common" log "github.com/sirupsen/logrus" networkingv1alpha3 "istio.io/api/networking/v1alpha3" @@ -24,44 +22,14 @@ type ServiceEntryHandler struct { } func (se *ServiceEntryHandler) Added(obj *v1alpha3.ServiceEntry) error { - if commonUtil.IsAdmiralReadOnly() { - log.Infof(LogFormat, "Add", "ServiceEntry", obj.Name, se.ClusterID, "Admiral is in read-only mode. Skipping resource from namespace="+obj.Namespace) - return nil - } - if IgnoreIstioResource(obj.Spec.ExportTo, obj.Annotations, obj.Namespace) { - log.Infof(LogFormat, "Add", "ServiceEntry", obj.Name, se.ClusterID, "Skipping resource from namespace="+obj.Namespace) - if len(obj.Annotations) > 0 && obj.Annotations[common.AdmiralIgnoreAnnotation] == "true" { - log.Infof(LogFormat, "admiralIoIgnoreAnnotationCheck", "ServiceEntry", obj.Name, se.ClusterID, "Value=true namespace="+obj.Namespace) - } - } return nil } func (se *ServiceEntryHandler) Updated(obj *v1alpha3.ServiceEntry) error { - if commonUtil.IsAdmiralReadOnly() { - log.Infof(LogFormat, "Update", "ServiceEntry", obj.Name, se.ClusterID, "Admiral is in read-only mode. Skipping resource from namespace="+obj.Namespace) - return nil - } - if IgnoreIstioResource(obj.Spec.ExportTo, obj.Annotations, obj.Namespace) { - log.Infof(LogFormat, "Update", "ServiceEntry", obj.Name, se.ClusterID, "Skipping resource from namespace="+obj.Namespace) - if len(obj.Annotations) > 0 && obj.Annotations[common.AdmiralIgnoreAnnotation] == "true" { - log.Infof(LogFormat, "admiralIoIgnoreAnnotationCheck", "ServiceEntry", obj.Name, se.ClusterID, "Value=true namespace="+obj.Namespace) - } - } return nil } func (se *ServiceEntryHandler) Deleted(obj *v1alpha3.ServiceEntry) error { - if commonUtil.IsAdmiralReadOnly() { - log.Infof(LogFormat, "Delete", "ServiceEntry", obj.Name, se.ClusterID, "Admiral is in read-only mode. Skipping resource from namespace="+obj.Namespace) - return nil - } - if IgnoreIstioResource(obj.Spec.ExportTo, obj.Annotations, obj.Namespace) { - log.Infof(LogFormat, "Delete", "ServiceEntry", obj.Name, se.ClusterID, "Skipping resource from namespace="+obj.Namespace) - if len(obj.Annotations) > 0 && obj.Annotations[common.AdmiralIgnoreAnnotation] == "true" { - log.Debugf(LogFormat, "admiralIoIgnoreAnnotationCheck", "ServiceEntry", obj.Name, se.ClusterID, "Value=true namespace="+obj.Namespace) - } - } return nil } @@ -128,7 +96,6 @@ func addUpdateServiceEntry(ctxLogger *log.Entry, ctx context.Context, ctxLogger.Infof(LogFormat+" diff=%s", op, "ServiceEntry", obj.Name, rc.ClusterID, "Diff in update", diff) } if skipUpdate { - ctxLogger.Infof(LogFormat, op, "ServiceEntry", obj.Name, rc.ClusterID, "Update skipped as it was destructive during Admiral's bootup phase") return nil } else { //nolint diff --git a/admiral/pkg/clusters/util.go b/admiral/pkg/clusters/util.go index 6578d921c..713a4e358 100644 --- a/admiral/pkg/clusters/util.go +++ b/admiral/pkg/clusters/util.go @@ -47,14 +47,12 @@ func GetMeshPortsForRollout(clusterName string, destService *k8sV1.Service, func GetServiceSelector(clusterName string, destService *k8sV1.Service) *common.Map { var selectors = destService.Spec.Selector if len(selectors) == 0 { - logrus.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) } - logrus.Infof(LogFormat, "GetServiceLabels", "selectors present", destService.Name, clusterName, selectors) return tempMap } @@ -152,7 +150,6 @@ func GetAllServicesForRollout(rc *RemoteController, rollout *argo.Rollout) map[s } if rollout.Spec.Selector == nil || rollout.Spec.Selector.MatchLabels == nil { - logrus.Infof("no selector for rollout=%s in namespace=%s and cluster=%s", rollout.Name, rollout.Namespace, rc.ClusterID) return nil } @@ -190,7 +187,6 @@ func generateSECanary(ctxLogger *logrus.Entry, ctx context.Context, event admira // generating SE when disable_ip_generation=false. When disable_ip_generation=true, it still // checks for non-empty fqdn but allows for empty address. if len(fqdn) != 0 && (common.DisableIPGeneration() || len(address) != 0) { - logrus.Infof("se generated for canary fqdn - %v", fqdn) generateServiceEntry(ctxLogger, event, admiralCache, meshPorts, fqdn, rc, serviceEntries, address, san, common.Rollout) } return nil @@ -214,8 +210,6 @@ func filterClusters(sourceClusters, destinationClusters *common.Map) *common.Map sourceClusters.Range(func(k string, v string) { if destinationClusters != nil && !destinationClusters.CheckIfPresent(k) { filteredSourceClusters.Put(k, v) - } else { - logrus.Infof("Filtering out %v from sourceClusters list as it is present in destinationClusters", k) } }) return filteredSourceClusters diff --git a/admiral/pkg/clusters/virtualservice_handler.go b/admiral/pkg/clusters/virtualservice_handler.go index d1c8d7a33..82a17779e 100644 --- a/admiral/pkg/clusters/virtualservice_handler.go +++ b/admiral/pkg/clusters/virtualservice_handler.go @@ -77,14 +77,9 @@ type VirtualServiceHandler struct { func (vh *VirtualServiceHandler) Added(ctx context.Context, obj *v1alpha3.VirtualService) error { if commonUtil.IsAdmiralReadOnly() { - log.Infof(LogFormat, common.Add, "VirtualService", obj.Name, vh.clusterID, "Admiral is in read-only mode. Skipping resource from namespace="+obj.Namespace) return nil } if IgnoreIstioResource(obj.Spec.ExportTo, obj.Annotations, obj.Namespace) { - log.Infof(LogFormat, common.Add, "VirtualService", obj.Name, vh.clusterID, "Skipping resource from namespace="+obj.Namespace) - if len(obj.Annotations) > 0 && obj.Annotations[common.AdmiralIgnoreAnnotation] == "true" { - log.Infof(LogFormat, "admiralIoIgnoreAnnotationCheck", "VirtualService", obj.Name, vh.clusterID, "Value=true namespace="+obj.Namespace) - } return nil } return vh.handleVirtualServiceEvent(ctx, obj, common.Add) @@ -92,14 +87,9 @@ func (vh *VirtualServiceHandler) Added(ctx context.Context, obj *v1alpha3.Virtua func (vh *VirtualServiceHandler) Updated(ctx context.Context, obj *v1alpha3.VirtualService) error { if commonUtil.IsAdmiralReadOnly() { - log.Infof(LogFormat, common.Update, "VirtualService", obj.Name, vh.clusterID, "Admiral is in read-only mode. Skipping resource from namespace="+obj.Namespace) return nil } if IgnoreIstioResource(obj.Spec.ExportTo, obj.Annotations, obj.Namespace) { - log.Infof(LogFormat, common.Update, "VirtualService", obj.Name, vh.clusterID, "Skipping resource from namespace="+obj.Namespace) - if len(obj.Annotations) > 0 && obj.Annotations[common.AdmiralIgnoreAnnotation] == "true" { - log.Infof(LogFormat, "admiralIoIgnoreAnnotationCheck", "VirtualService", obj.Name, vh.clusterID, "Value=true namespace="+obj.Namespace) - } return nil } return vh.handleVirtualServiceEvent(ctx, obj, common.Update) diff --git a/admiral/pkg/controller/common/common.go b/admiral/pkg/controller/common/common.go index c268aaf33..780d592a0 100644 --- a/admiral/pkg/controller/common/common.go +++ b/admiral/pkg/controller/common/common.go @@ -224,7 +224,6 @@ func GetCname(deployment *k8sAppsV1.Deployment, identifier string, nameSuffix st } cname := GetCnameVal([]string{environment, alias, nameSuffix}) if deployment.Spec.Template.Annotations[AdmiralCnameCaseSensitive] == "true" { - log.Infof("admiral.io/cname-case-sensitive annotation enabled on deployment with name %v", deployment.Name) return cname } return strings.ToLower(cname) diff --git a/admiral/pkg/controller/istio/destinationrule.go b/admiral/pkg/controller/istio/destinationrule.go index 7c590f9e9..81b3e6970 100644 --- a/admiral/pkg/controller/istio/destinationrule.go +++ b/admiral/pkg/controller/istio/destinationrule.go @@ -93,7 +93,6 @@ func (d *DestinationRuleCache) Get(identity string, namespace string) *networkin return drItem.DestinationRule } - log.Infof("no destinationrule found in cache for identity=%s", identity) return nil } diff --git a/admiral/pkg/controller/istio/serviceentry.go b/admiral/pkg/controller/istio/serviceentry.go index b7a4415b6..e6a87717d 100644 --- a/admiral/pkg/controller/istio/serviceentry.go +++ b/admiral/pkg/controller/istio/serviceentry.go @@ -98,7 +98,6 @@ func (d *ServiceEntryCache) Get(identity string, cluster string) *networking.Ser return se.ServiceEntry } } - log.Infof("no service entry found in cache for identity=%s cluster=%s", identity, cluster) return nil }