diff --git a/pkg/monitor/azure/nsg/nsg.go b/pkg/monitor/azure/nsg/nsg.go index 0996711a491..ad6eae8b8b5 100644 --- a/pkg/monitor/azure/nsg/nsg.go +++ b/pkg/monitor/azure/nsg/nsg.go @@ -110,8 +110,11 @@ func (n *NSGMonitor) toSubnetConfig(ctx context.Context, subnetID string) (subne } func (n *NSGMonitor) Monitor(ctx context.Context) { + n.log.Info("NSGMonitor object Monitor has started") + n.log.Info("Parsing the master subnet ID: ", n.oc.Properties.MasterProfile.SubnetID) masterSubnet, err := n.toSubnetConfig(ctx, n.oc.Properties.MasterProfile.SubnetID) if err != nil { + n.log.Info("Unable to parse the masterSubnet: ", n.oc.Properties.MasterProfile.SubnetID) // FP has no access to the subnet n.done <- err return @@ -124,6 +127,7 @@ func (n *NSGMonitor) Monitor(ctx context.Context) { for _, wp := range workerProfiles { s, err := n.toSubnetConfig(ctx, wp.SubnetID) if err != nil { + n.log.Info("Unable to parse the workerSubnet: ", wp.SubnetID) // FP has no access to the subnet n.done <- err return @@ -136,9 +140,11 @@ func (n *NSGMonitor) Monitor(ctx context.Context) { nsgSet := map[string]*mgmtnetwork.SecurityGroup{ *masterSubnet.nsg.ID: masterSubnet.nsg, } + n.log.Info("nsgSet: ", nsgSet) for _, w := range workerSubnets { nsgSet[*w.nsg.ID] = w.nsg } + n.log.Info("nsgSet: ", nsgSet) for nsgID, nsg := range nsgSet { for _, rule := range *nsg.SecurityRules { @@ -153,9 +159,13 @@ func (n *NSGMonitor) Monitor(ctx context.Context) { continue } + n.log.Info("Rule Name ", *rule.Name) r := newRuleChecker(n.log, masterSubnet.prefix, workerPrefixes, &rule) if r.isInvalidDenyRule() { + // TODO remove after testing + n.log.Infof("%s is an invalid rule", *r.rule.Name) + dims := map[string]string{ DimClusterResourceID: n.oc.ID, DimLocation: n.oc.Location, diff --git a/pkg/monitor/cluster/cluster.go b/pkg/monitor/cluster/cluster.go index 06bd66558a3..9f81c5b496b 100644 --- a/pkg/monitor/cluster/cluster.go +++ b/pkg/monitor/cluster/cluster.go @@ -135,7 +135,7 @@ func getHiveClientSet(hiveRestConfig *rest.Config) (client.Client, error) { // Monitor checks the API server health of a cluster func (mon *Monitor) Monitor(ctx context.Context) (errs []error) { - mon.log.Debug("monitoring") + mon.log.Info("monitoring") if mon.hourlyRun { mon.emitGauge("cluster.provisioning", 1, map[string]string{ diff --git a/pkg/monitor/monitor.go b/pkg/monitor/monitor.go index f03005171e6..9b1723da074 100644 --- a/pkg/monitor/monitor.go +++ b/pkg/monitor/monitor.go @@ -83,6 +83,7 @@ func NewMonitor(log *logrus.Entry, dialer proxy.Dialer, dbMonitors database.Moni } func (mon *monitor) Run(ctx context.Context) error { + mon.baseLog.Info("Monitoring has started.") _, err := mon.dbMonitors.Create(ctx, &api.MonitorDocument{ ID: "master", }) diff --git a/pkg/monitor/worker.go b/pkg/monitor/worker.go index 319f9f80186..624c91ae115 100644 --- a/pkg/monitor/worker.go +++ b/pkg/monitor/worker.go @@ -248,7 +248,10 @@ func (mon *monitor) workOne(ctx context.Context, log *logrus.Entry, doc *api.Ope } var nsgMon *nsg.NSGMonitor - if doc.OpenShiftCluster.Properties.NetworkProfile.PreconfiguredNSG == api.PreconfiguredNSGEnabled && hourlyRun { + log.Info(doc.OpenShiftCluster.Properties.NetworkProfile.PreconfiguredNSG, hourlyRun) + if doc.OpenShiftCluster.Properties.NetworkProfile.PreconfiguredNSG == api.PreconfiguredNSGEnabled { + // TODO remove after testing + log.Info("NSG Monitoring is starting for ", doc.OpenShiftCluster.ID) fpAuthorizer, err := mon.env.FPAuthorizer(sub.Subscription.Properties.TenantID, mon.env.Environment().ResourceManagerEndpoint) if err != nil { @@ -262,6 +265,7 @@ func (mon *monitor) workOne(ctx context.Context, log *logrus.Entry, doc *api.Ope }) } else { nsgMon = nsg.NewNSGMonitor(log, doc.OpenShiftCluster, sub.ID, mon.env.Environment(), fpAuthorizer, mon.m) + log.Info("nsgMon obj", *nsgMon) go nsgMon.Monitor(ctx) } } @@ -281,6 +285,8 @@ func (mon *monitor) workOne(ctx context.Context, log *logrus.Entry, doc *api.Ope if err != nil { log.Error("Error occurred during NSG monitoring", err) } + // TODO remove after testing + log.Info("NSG monitoring completed successfully for ", doc.OpenShiftCluster.ID) case <-ctx.Done(): log.Info("NSG Monitoring timed out") mon.m.EmitGauge(nsg.MetricNSGMonitoringTimedOut, int64(1), map[string]string{