Skip to content

Commit

Permalink
Merge pull request #57 from boxboat/feature/move-detailed-information-dr
Browse files Browse the repository at this point in the history
Adding more detailed information for DR and Image Management
  • Loading branch information
fgauna12 authored Jul 19, 2021
2 parents 16f641f + b982216 commit ef299ef
Show file tree
Hide file tree
Showing 3 changed files with 177 additions and 41 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@ $ aks-hc check all -g <resource group> -n <cluster name> -i ingress-nginx,kube-n
$ exit
```

### Optional - Azure Container Registry

If you use Azure Container Registry (ACR), you can have this health check review some basic configuration. If will not inspect container images pushed to the registry.

To do this, look at the container registries available then specify the `--image-registries` option.

``` bash
$ az acr list --query "[].name"
foo1
foo2

$ aks-hc check all -g <resource group> -n <cluster name> -i ingress-nginx,kube-node-lease,kube-public,kube-system --image-registries "foo1,foo2"
```

## Option B - Run with Azure Service Principal

This option walks you through running the health check using an Azure Managed Identity so that it can be tied to a "service principal". Essentially, it avoids impersoning a user or running with someone's identity.
Expand Down
66 changes: 54 additions & 12 deletions modules/disasterRecovery.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import chalk from "chalk"
import { equalsIgnoreCase } from '../helpers/stringCompare.js';
import { ResultStatus } from '../helpers/commandStatus.js';
import { Severity } from '../helpers/commandSeverity.js';
import { EOL } from 'os';

const space = ' '

//
// Checks if the cluster has agent pools without multiple availability zones
Expand All @@ -10,22 +13,39 @@ export function checkForAvailabilityZones(clusterDetails) {

console.log(chalk.white("Checking for agent pools without multiple availability zones..."));

let details = []

// Find agent pools with either no AZ's or a single AZ
var agentPoolsWithNoAzs = clusterDetails
.agentPoolProfiles
.filter(x => (x.availabilityZones || []).length <= 1);

// Log output
if (agentPoolsWithNoAzs.length) {
console.log(chalk.red(`--- Found ${agentPoolsWithNoAzs.length} agent pools without multiple availability zones`));
let message = `Found ${agentPoolsWithNoAzs.length} agent pools without multiple availability zones`;

if (global.verbose) {
agentPoolsWithNoAzs.forEach(x => message += `${EOL}${space}${x.name}`);
}

details.push({
status: ResultStatus.Fail,
message: message
}
);
} else {
console.log(chalk.green("--- All agent pools have multiple availability zones"));
details.push({
status: ResultStatus.Pass,
message: 'All agent pools have multiple availability zones'
}
);
}

return {
checkId: 'DR-2',
status: !agentPoolsWithNoAzs.length? ResultStatus.Pass: ResultStatus.Fail,
severity: Severity.High
status: !agentPoolsWithNoAzs.length ? ResultStatus.Pass : ResultStatus.Fail,
severity: Severity.High,
details: details
}
}

Expand All @@ -36,22 +56,33 @@ export function checkForVelero(pods) {

console.log(chalk.white("Checking for Velero..."));

let details = []

// Check if Velero is installed
var veleroInstalled = pods
.items
.some(pod => pod.spec.containers.some(con => equalsIgnoreCase(con.name, "velero")));

// Log output
if (!veleroInstalled) {
console.log(chalk.red(`--- Velero is not installed`));
details.push({
status: ResultStatus.Fail,
message: "Velero is not installed"
}
);
} else {
console.log(chalk.green("--- Velero is installed"));
details.push({
status: ResultStatus.Pass,
message: "Velero is installed"
}
);
}

return {
checkId: 'DR-5',
status: veleroInstalled.length? ResultStatus.Pass: ResultStatus.Fail,
severity: Severity.Medium
status: veleroInstalled.length ? ResultStatus.Pass : ResultStatus.Fail,
severity: Severity.Medium,
details: details
}
}

Expand All @@ -62,19 +93,30 @@ export function checkForControlPlaneSla(clusterDetails) {

console.log(chalk.white("Checking for SLA for control plane..."));

let details = []

// Check if SLA is configured for the management plane
var slaConfigured = clusterDetails.sku.tier == "Paid";

// Log output
if (!slaConfigured) {
console.log(chalk.red(`--- An SLA has not been configured for the control plane`));
details.push({
status: ResultStatus.Fail,
message: "An SLA has not been configured for the control plane"
}
);
} else {
console.log(chalk.green("--- An SLA has been configured for the control plane"));
details.push({
status: ResultStatus.Pass,
message: "An SLA has been configured for the control plane"
}
);
}

return {
checkId: 'DR-6',
status: slaConfigured.length? ResultStatus.Pass: ResultStatus.Fail,
severity: Severity.High
status: slaConfigured.length ? ResultStatus.Pass : ResultStatus.Fail,
severity: Severity.High,
details: details
}
}
Loading

0 comments on commit ef299ef

Please sign in to comment.