Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding docs around the Subnet Available collector and analyzer #473

Merged
merged 6 commits into from
Mar 10, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions docs/source/host-collect-analyze/subnetAvailable.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
title: Subnet Available
description: Collect and analyze information about checking for an available (IPv4) subnet.
---

## Subnet Available Collector

To check if there is an available (IPv4) subnet on a node, you can use the `subnetAvailable` collector. This is useful for Pod/Service CIDR ranges.

This collector searches for overlap with the routing table of the node to help avoid conflicts.

### Parameters

In addition to the [shared collector properties](/collect/collectors/#shared-properties), the `subnetAvailable` collector accepts the following parameters:

#### `CIDRRangeAlloc` (Required)
The overarching subnet range to search for available CIDR blocks to use. The format must be `"x.x.x.x/y"`, with an IPv4 network and `y` being a CIDR mask between 1 and 32.

#### `desiredCIDR` (Required)
An integer between 1 and 32.

Searches in `CIDRRangeAlloc` for an IP subnet of this CIDR block size.

### Example Collector Definition

```yaml
apiVersion: troubleshoot.sh/v1beta2
kind: HostPreflight
metadata:
name: subnet-available
spec:
collectors:
# would output yes/no depending if there is a /22 available in 10.0.0.0/8
- subnetAvailable:
CpuID marked this conversation as resolved.
Show resolved Hide resolved
CIDRRangeAlloc: "10.0.0.0/8"
desiredCIDR: 22
```

### Included Resources

The results of the `subnetAvailable` collector are stored in the `host-collectors/subnetAvailable` directory of the support bundle.

#### `[collector-name].json`

If the `collectorName` field is not set, the file is named `result.json`.

Example of the resulting JSON file:

```json
{
"CIDRRangeAlloc": "10.0.0.0/8",
"desiredCIDR": 22,
"status": "a-subnet-is-available"
}
```

## Subnet Available Analyzer

The `subnetAvailable` analyzer supports the following outcomes:

- `a-subnet-is-available`: Indicates that a subnet of the `desiredCIDR` size is available within `CIDRRangeAlloc`.
- `no-subnet-available`: Indicates that the entirety of `CIDRRangeAlloc` is exhausted by the node routing table, and that no subnets can be allocated of the `desiredCIDR` size.

### Example Analyzer Definition

```yaml
apiVersion: troubleshoot.sh/v1beta2
kind: HostPreflight
metadata:
name: subnet-available
spec:
analyzers:
- subnetAvailable:
outcomes:
CpuID marked this conversation as resolved.
Show resolved Hide resolved
- fail:
when: "no-subnet-available"
message: failed to find available subnet
- pass:
when: "a-subnet-is-available"
message: available /22 subnet found
```