-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
debb5ae
commit bb4ddef
Showing
5 changed files
with
112 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package cluster | ||
|
||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the Apache License 2.0. | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/Azure/ARO-RP/pkg/validate/dynamic" | ||
) | ||
|
||
/*************************************************************** | ||
Monitor the Cluster Service Prinicpal required permissions: | ||
- Network Contributor role on vnet | ||
****************************************************************/ | ||
|
||
func (mon *Monitor) emitValidatePermissions(ctx context.Context) error { | ||
subnets := []dynamic.Subnet{{ | ||
ID: mon.oc.Properties.MasterProfile.SubnetID, | ||
Path: "properties.masterProfile.subnetId", | ||
}} | ||
|
||
err := mon.validator.ValidateVnet(ctx, mon.oc.Location, subnets, mon.oc.Properties.NetworkProfile.PodCIDR, | ||
mon.oc.Properties.NetworkProfile.ServiceCIDR) | ||
|
||
if err != nil { | ||
mon.emitGauge("cluster.validate.permissions", 1, map[string]string{ | ||
"ValidateVnetPermissions": err.Error(), | ||
}) | ||
} | ||
|
||
err = mon.validator.ValidateSubnets(ctx, mon.oc, subnets) | ||
if err != nil { | ||
mon.emitGauge("cluster.validate.permissions", 1, map[string]string{ | ||
"ValidateSubnet": err.Error(), | ||
}) | ||
} | ||
|
||
err = mon.validator.ValidateDiskEncryptionSets(ctx, mon.oc) | ||
if err != nil { | ||
mon.emitGauge("cluster.validate.permissions", 1, map[string]string{ | ||
"ValidateDiskEncryptionSet": err.Error(), | ||
}) | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package cluster | ||
|
||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the Apache License 2.0. | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestEmitValidatePermissions(t *testing.T) { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters