Skip to content

Commit

Permalink
Adding Container Instance analysis #8
Browse files Browse the repository at this point in the history
  • Loading branch information
cmendible committed Nov 23, 2022
1 parent d78bd71 commit 17859dd
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/azqr/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ static async Task<List<Results>> ReviewResourceGroup(ArmClient client, RulesEngi
var aks = resourceGroupResource.GetContainerServiceManagedClusters().Select(x => x.Data).ToArray();
results.AddRange(await RulesEngineHelper.ExecuteRules(client, engine, subscriptionId.Name, rgId.Name, "AKS", aks));

var ci = resourceGroupResource.GetContainerGroups().Select(x => x.Data).ToArray();
results.AddRange(await RulesEngineHelper.ExecuteRules(client, engine, subscriptionId.Name, rgId.Name, "ContainerInstance", ci));

var signalR = resourceGroupResource.GetSignalRs().Select(x => x.Data).ToArray();
results.AddRange(await RulesEngineHelper.ExecuteRules(client, engine, subscriptionId.Name, rgId.Name, "SignalR", signalR));

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Container Instances

TODO
127 changes: 127 additions & 0 deletions src/azqr/Rules/ci.azqr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
[
{
"WorkflowName": "ContainerInstance",
"Rules": [
{
"RuleName": "SKU",
"SuccessEvent": "10",
"ErrorMessage": "SKU",
"ErrorType": "Error",
"RuleExpressionType": "LambdaExpression",
"Expression": "true",
"Actions": {
"OnSuccess": {
"Name": "OutputExpression",
"Context": {
"Expression": "input1.Sku.Value.ToString()"
}
}
}
},
{
"RuleName": "Avaliability Zones",
"SuccessEvent": "20",
"ErrorMessage": "Not protected against zone failures",
"ErrorType": "Error",
"RuleExpressionType": "LambdaExpression",
"Expression": "input1.Zones.Count() > 1",
"Actions": {
"OnSuccess": {
"Name": "OutputExpression",
"Context": {
"Expression": "\"Yes\""
}
},
"OnFailure": {
"Name": "OutputExpression",
"Context": {
"Expression": "\"No\""
}
}
}
},
{
"RuleName": "SLA",
"SuccessEvent": "30",
"ErrorMessage": "SLA",
"ErrorType": "Error",
"RuleExpressionType": "LambdaExpression",
"Expression": "true",
"Actions": {
"OnSuccess": {
"Name": "OutputExpression",
"Context": {
"Expression": "\"99.9%\""
}
}
}
},
{
"RuleName": "Private Endpoints",
"SuccessEvent": "40",
"ErrorMessage": "No Private Endpoints configured",
"ErrorType": "Error",
"RuleExpressionType": "LambdaExpression",
"Expression": "input1.SubnetIds.Count() > 0",
"Actions": {
"OnSuccess": {
"Name": "OutputExpression",
"Context": {
"Expression": "\"Private\""
}
},
"OnFailure": {
"Name": "OutputExpression",
"Context": {
"Expression": "\"Public\""
}
}
}
},
{
"RuleName": "CAF Naming",
"SuccessEvent": "50",
"ErrorMessage": "Name should start with 'ci' as prefix",
"ErrorType": "Error",
"RuleExpressionType": "LambdaExpression",
"Expression": "input1.Name.StartsWith(\"ci\")",
"Actions": {
"OnSuccess": {
"Name": "OutputExpression",
"Context": {
"Expression": "\"Yes\""
}
},
"OnFailure": {
"Name": "OutputExpression",
"Context": {
"Expression": "\"No\""
}
}
}
},
{
"RuleName": "Diagnostic Settings",
"SuccessEvent": "60",
"ErrorMessage": "No Diagnostics Setting Found",
"ErrorType": "Error",
"RuleExpressionType": "LambdaExpression",
"Expression": "input2 > 0",
"Actions": {
"OnSuccess": {
"Name": "OutputExpression",
"Context": {
"Expression": "input2"
}
},
"OnFailure": {
"Name": "OutputExpression",
"Context": {
"Expression": "\"None\""
}
}
}
}
]
}
]

0 comments on commit 17859dd

Please sign in to comment.