Skip to content

Commit

Permalink
Add logs for testing
Browse files Browse the repository at this point in the history
This commit will be removed after the testing in INT is done
  • Loading branch information
nwnt committed Sep 23, 2023
1 parent cf4febc commit 63a65b6
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions pkg/monitor/azure/nsg/nsg.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ func (n *NSGMonitor) Monitor(ctx context.Context) {
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,
Expand Down
1 change: 1 addition & 0 deletions pkg/monitor/cluster/arooperatorheartbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func (mon *Monitor) emitAroOperatorHeartbeat(ctx context.Context) error {
_, present := aroOperatorDeploymentsReady[d.Name]
if present {
deploymentIsReady := ready.DeploymentIsReady(&d)
mon.log.Info("New message")
mon.log.Infof("deployment %q is ready: %v, it's status: %+v", d.Name, deploymentIsReady, d.Status)
aroOperatorDeploymentsReady[d.Name] = deploymentIsReady
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/monitor/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,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{
Expand Down
1 change: 1 addition & 0 deletions pkg/monitor/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
})
Expand Down
6 changes: 6 additions & 0 deletions pkg/monitor/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ out:

// workOne checks the API server health of a cluster
func (mon *monitor) workOne(ctx context.Context, log *logrus.Entry, doc *api.OpenShiftClusterDocument, sub *api.SubscriptionDocument, hourlyRun bool) {
log.Info("workOne has started")
ctx, cancel := context.WithTimeout(ctx, 50*time.Second)
defer cancel()

Expand All @@ -248,7 +249,10 @@ func (mon *monitor) workOne(ctx context.Context, log *logrus.Entry, doc *api.Ope
}

var nsgMon *nsg.NSGMonitor
log.Info(doc.OpenShiftCluster.Properties.NetworkProfile.PreconfiguredNSG, hourlyRun)
if doc.OpenShiftCluster.Properties.NetworkProfile.PreconfiguredNSG == api.PreconfiguredNSGEnabled && hourlyRun {
// TODO remove after testing
log.Info("NSG Monitoring is starting for ", doc.ID)

fpAuthorizer, err := mon.env.FPAuthorizer(sub.Subscription.Properties.TenantID, mon.env.Environment().ResourceManagerEndpoint)
if err != nil {
Expand Down Expand Up @@ -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.ID)
case <-ctx.Done():
log.Info("NSG Monitoring timed out")
mon.m.EmitGauge(nsg.MetricNSGMonitoringTimedOut, int64(1), map[string]string{
Expand Down

0 comments on commit 63a65b6

Please sign in to comment.