Skip to content

Commit

Permalink
Fix make generate
Browse files Browse the repository at this point in the history
  • Loading branch information
nwnt committed Oct 24, 2023
1 parent 25fdcc4 commit 885c6fb
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ require (
github.com/Azure/azure-sdk-for-go v63.1.0+incompatible
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.1
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.1
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2 v2.2.1
github.com/Azure/go-autorest/autorest v0.11.29
github.com/Azure/go-autorest/autorest/adal v0.9.23
github.com/Azure/go-autorest/autorest/date v0.3.0
Expand Down Expand Up @@ -91,7 +92,6 @@ require (

require (
github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2 v2.2.1 // indirect
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/logger v0.2.1 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.1 h1:LNHhpdK7hzUcx/k1LIcuh
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.1/go.mod h1:uE9zaUfEQT/nbQjVi2IblCG9iaLtZsuYZ8ne+PuQ02M=
github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY=
github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM=
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 h1:mLY+pNLjCUeKhgnAJWAKhEUQM+RJQo2H1fuGSw1Ky1E=
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2 v2.2.1 h1:bWh0Z2rOEDfB/ywv/l0iHN1JgyazE6kW/aIA89+CEK0=
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2 v2.2.1/go.mod h1:Bzf34hhAE9NSxailk8xVeLEZbUjOXcC+GnU1mMKdhLw=
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 h1:ECsQtyERDVz3NP3kvDOTLvbQhqWp/x9EsGKtb4ogUr8=
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8=
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=
github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs=
Expand Down
2 changes: 1 addition & 1 deletion pkg/deploy/assets/rp-production.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions pkg/monitor/azure/nsg/nsg.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package nsg
import (
"context"
"errors"
"fmt"
"net/http"
"net/netip"
"strings"
Expand Down Expand Up @@ -164,12 +165,12 @@ func (n *NSGMonitor) Monitor(ctx context.Context) []error {
if r.isInvalidDenyRule() {
dims := map[string]string{
dimension.NSGResourceGroup: nsgResource.ResourceGroupName,
dimension.ResourceName: nsgResource.Name,
dimension.NSG: nsgResource.Name,
dimension.NSGRuleName: *rule.Name,
dimension.NSGRuleSources: strings.Join(r.sourceStrings, ","),
dimension.NSGRuleDestinations: strings.Join(r.destinationStrings, ","),
dimension.NSGRuleDirection: string(*rule.Properties.Direction),
dimension.NSGRulePriority: string(*rule.Properties.Priority),
dimension.NSGRulePriority: fmt.Sprint(*rule.Properties.Priority),
}
emitter.EmitGauge(n.emitter, MetricInvalidDenyRule, int64(1), n.dims, dims)
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/monitor/azure/nsg/nsg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,24 +415,24 @@ func TestMonitor(t *testing.T) {
dimension.Location: ocLocation,
dimension.SubscriptionID: subscriptionID,
dimension.NSGResourceGroup: resourcegroupName,
dimension.ResourceName: nsg1Name,
dimension.NSG: nsg1Name,
dimension.NSGRuleName: nsgRuleName1,
dimension.NSGRuleSources: subsetOfMaster1,
dimension.NSGRuleDestinations: subsetOfMaster2,
dimension.NSGRuleDirection: string(armnetwork.SecurityRuleDirectionInbound),
dimension.NSGRulePriority: string(priority1),
dimension.NSGRulePriority: fmt.Sprint(priority1),
})
mock.EXPECT().EmitGauge(MetricInvalidDenyRule, int64(1), map[string]string{
dimension.ResourceID: ocID,
dimension.Location: ocLocation,
dimension.SubscriptionID: subscriptionID,
dimension.NSGResourceGroup: resourcegroupName,
dimension.ResourceName: nsg2Name,
dimension.NSG: nsg2Name,
dimension.NSGRuleName: nsgRuleName3,
dimension.NSGRuleSources: "10.0.1.1/32,10.0.1.2",
dimension.NSGRuleDestinations: "*",
dimension.NSGRuleDirection: string(armnetwork.SecurityRuleDirectionOutbound),
dimension.NSGRulePriority: string(priority3),
dimension.NSGRulePriority: fmt.Sprint(priority3),
})
},
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/monitor/azure/nsg/rulechecker.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func toPrefixes(log *logrus.Entry, addresses []string) []netip.Prefix {
// 1. The strings always come directly from Azure, which has been validated.
// 2. Even if the value is wrong, it won't be neither master or worker.
// 3. We should also skip other service tags (VirtualNetwork, Internet, Any etc)
log.Errorf("Error while parsing %s. Full error %s.", address, err)
log.Debugf("Error while parsing %s. Full error %s.", address, err)
continue
}
prefixes = append(prefixes, prefix)
Expand Down
3 changes: 1 addition & 2 deletions pkg/monitor/azure/nsg/rulechecker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ import (
"net/netip"
"testing"

"github.com/sirupsen/logrus"

"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2"
"github.com/sirupsen/logrus"

utilerror "github.com/Azure/ARO-RP/test/util/error"
)
Expand Down
4 changes: 3 additions & 1 deletion test/e2e/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ var _ = Describe("Monitor", func() {
// This is more of an integration test rather than E2E.
It("must run and must not return any errors", func(ctx context.Context) {
By("creating a new monitor instance for the test cluster")
var wg sync.WaitGroup
wg.Add(1)
mon, err := cluster.NewMonitor(log, clients.RestConfig, &api.OpenShiftCluster{
ID: resourceIDFromEnv(),
}, &noop.Noop{}, nil, true, new(sync.WaitGroup))
}, &noop.Noop{}, nil, true, &wg)
Expect(err).NotTo(HaveOccurred())

By("running the monitor once")
Expand Down

0 comments on commit 885c6fb

Please sign in to comment.