Skip to content

Commit 0f238fd

Browse files
committed
Add draft for IpAddress
1 parent e099af3 commit 0f238fd

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

api/v1/ipaddress_types.go

+11
Original file line numberDiff line numberDiff line change
@@ -31,26 +31,37 @@ type IpAddressSpec struct {
3131
//+kubebuilder:validation:Format=cidr
3232
//+kubebuilder:validation:XValidation:rule="self == oldSelf",message="Field 'ipAddress' is immutable"
3333
//+kubebuilder:validation:Required
34+
// The actual IP Address that should be reserved in NetBox
3435
IpAddress string `json:"ipAddress"`
3536

3637
//+kubebuilder:validation:XValidation:rule="self == oldSelf",message="Field 'tenant' is immutable"
38+
// The NetBox Tenant to be used for creating this resource in Netbox
3739
Tenant string `json:"tenant,omitempty"`
3840

41+
// NetBox Custom Fields that should be added to the resource in NetBox. Note that currently only Text Type is supported (GitHub #129)
3942
CustomFields map[string]string `json:"customFields,omitempty"`
4043

44+
// Comment that should be added to the resource in NetBox
4145
Comments string `json:"comments,omitempty"`
4246

47+
// Description that should be added to the resource in NetBox
4348
Description string `json:"description,omitempty"`
4449

50+
// preserveInNetbox defines whether or not the Resource should stay in NetBox when the Kubernetes Resource is deleted
51+
// When set to true, the resource will not be deleted in NetBox upon CR deletion
52+
// When set to false, the resource will be cleaned up in NetBox upon CR deletion
53+
// If you want to restore resources from NetBox (e.g. recreation of an entire cluster), preserveInNetbox set to true is a prerequisite.
4554
PreserveInNetbox bool `json:"preserveInNetbox,omitempty"`
4655
}
4756

4857
// IpAddressStatus defines the observed state of IpAddress
4958
type IpAddressStatus struct {
5059
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
5160
// Important: Run "make" to regenerate code after modifying this file
61+
// The ID of the resource in NetBox
5262
IpAddressId int64 `json:"id,omitempty"`
5363

64+
// The URL to the NetBox UI to display this resource. Note that the base depends on the runtime config of NetBox Operator
5465
IpAddressUrl string `json:"url,omitempty"`
5566

5667
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`

config/crd/bases/netbox.dev_ipaddresses.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -58,22 +58,35 @@ spec:
5858
description: IpAddressSpec defines the desired state of IpAddress
5959
properties:
6060
comments:
61+
description: Comment that should be added to the resource in NetBox
6162
type: string
6263
customFields:
6364
additionalProperties:
6465
type: string
66+
description: 'NetBox Custom Fields that should be added to the resource
67+
in NetBox. Note that currently only Text Type is supported (GitHub
68+
#129)'
6569
type: object
6670
description:
71+
description: Description that should be added to the resource in NetBox
6772
type: string
6873
ipAddress:
74+
description: The actual IP Address that should be reserved in NetBox
6975
format: cidr
7076
type: string
7177
x-kubernetes-validations:
7278
- message: Field 'ipAddress' is immutable
7379
rule: self == oldSelf
7480
preserveInNetbox:
81+
description: |-
82+
preserveInNetbox defines whether or not the Resource should stay in NetBox when the Kubernetes Resource is deleted
83+
When set to true, the resource will not be deleted in NetBox upon CR deletion
84+
When set to false, the resource will be cleaned up in NetBox upon CR deletion
85+
If you want to restore resources from NetBox (e.g. recreation of an entire cluster), preserveInNetbox set to true is a prerequisite.
7586
type: boolean
7687
tenant:
88+
description: The NetBox Tenant to be used for creating this resource
89+
in Netbox
7790
type: string
7891
x-kubernetes-validations:
7992
- message: Field 'tenant' is immutable
@@ -144,9 +157,12 @@ spec:
144157
description: |-
145158
INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
146159
Important: Run "make" to regenerate code after modifying this file
160+
The ID of the resource in NetBox
147161
format: int64
148162
type: integer
149163
url:
164+
description: The URL to the NetBox UI to display this resource. Note
165+
that the base depends on the runtime config of NetBox Operator
150166
type: string
151167
type: object
152168
type: object

0 commit comments

Comments
 (0)