Skip to content

Commit

Permalink
Add ParentPrefixSelector guide empty docs
Browse files Browse the repository at this point in the history
  • Loading branch information
henrybear327 committed Nov 11, 2024
1 parent 74dea6a commit 7decd40
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
51 changes: 51 additions & 0 deletions ParentPrefixSelectorGuide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# A guide of `ParentPrefixSelector` in `PrefixClaim`

There are 2 ways to make a Prefix claim:
- provide a `parentPrefix`
- provide a `parentPrefixSelector`

In this documentation, we will focus on the `parentPrefixSelector` only.

# CRD format

The following is a sample of utilizing the `parentPrefixSelector`:
```bash
apiVersion: netbox.dev/v1
kind: PrefixClaim
metadata:
labels:
app.kubernetes.io/name: netbox-operator
app.kubernetes.io/managed-by: kustomize
name: prefixclaim-customfields-sample
spec:
tenant: "MY_TENANT"
site: "DM-Akron"
description: "some description"
comments: "your comments"
preserveInNetbox: true
prefixLength: "/31"
parentPrefixSelector:
tenant: "MY_TENANT_2"
site: "DM-Bryon"
environment: "Production"
poolName: "Pool 1"
```

## `Spec.tenant` and `Spec.site`

Please provide the *name*, not the *slug* value

## `parentPrefixSelector`

The `parentPrefixSelector` is a key-value map, where all the entries are of data type `<string-string>`.

The `parentPrefixSelector` is a set of query conditions for selecting a set of prefixes that can be used as the parent prefix.

The fields that can be used as query conditions in the `parentPrefixSelector` are:
- `tenant` and `site`
- these 2 fields come by design with NetBox, so you do *not* need to create custom fields for them
- please provide the *name*, not the *slug* value
- if either of the value is missing, it will *not* inherit from the tenant and site from the Spec
- custom fields
- the data types tested and supported so far are `string`, `integer`, and `boolean`
- for `boolean` type, please use `true` and `false` as the value
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ Use Cases for this Restoration:
- Disaster Recovery: In case the cluster is lost, IP Addresses can be restored with the IPAddressClaim only
- Sticky IPs: Some services do not handle changes to IPs well. This ensures the IP/Prefix assigned to a Custom Resource is always the same.

# `ParentPrefixSelector` in `PrefixClaim`

Please read [ParentPrefixSelector guide] for more information!

[ParentPrefixSelector guide]: ./ParentPrefixSelectorGuide.md


# Project Distribution

Following are the steps to build the installer and distribute this project to users.
Expand Down

0 comments on commit 7decd40

Please sign in to comment.