@@ -20,25 +20,22 @@ import (
20
20
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21
21
)
22
22
23
- // EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
24
- // NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
25
-
26
23
// IpAddressSpec defines the desired state of IpAddress
27
24
type IpAddressSpec struct {
28
- // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
29
- // Important: Run "make" to regenerate code after modifying this file
30
-
25
+ // The IP Address in CIDR notation that should be reserved in NetBox
31
26
//+kubebuilder:validation:Format=cidr
32
27
//+kubebuilder:validation:XValidation:rule="self == oldSelf",message="Field 'ipAddress' is immutable"
33
28
//+kubebuilder:validation:Required
34
- // The actual IP Address that should be reserved in NetBox
35
29
IpAddress string `json:"ipAddress"`
36
30
37
- //+kubebuilder:validation:XValidation:rule="self == oldSelf",message="Field 'tenant' is immutable"
38
31
// The NetBox Tenant to be used for creating this resource in Netbox
32
+ //+kubebuilder:validation:XValidation:rule="self == oldSelf",message="Field 'tenant' is immutable"
39
33
Tenant string `json:"tenant,omitempty"`
40
34
41
- // NetBox Custom Fields that should be added to the resource in NetBox. Note that currently only Text Type is supported (GitHub #129)
35
+ // The NetBox Custom Fields that should be added to the resource in NetBox.
36
+ // Note that currently only Text Type is supported (GitHub #129)
37
+ // More info on NetBox Custom Fields:
38
+ // https://github.com/netbox-community/netbox/blob/main/docs/customization/custom-fields.md
42
39
CustomFields map [string ]string `json:"customFields,omitempty"`
43
40
44
41
// Comment that should be added to the resource in NetBox
@@ -47,23 +44,28 @@ type IpAddressSpec struct {
47
44
// Description that should be added to the resource in NetBox
48
45
Description string `json:"description,omitempty"`
49
46
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.
47
+ // Defines whether the Resource should be preserved in NetBox when the
48
+ // Kubernetes Resource is deleted.
49
+ // - When set to true, the resource will not be deleted but preserved in
50
+ // NetBox upon CR deletion
51
+ // - When set to false, the resource will be cleaned up in NetBox
52
+ // upon CR deletion
53
+ // Setting preserveInNetbox to true is mandatory if the user wants to restore
54
+ // resources from NetBox (e.g. Sticky CIDRs even if resources are deleted and
55
+ // recreated in Kubernetes)
54
56
PreserveInNetbox bool `json:"preserveInNetbox,omitempty"`
55
57
}
56
58
57
59
// IpAddressStatus defines the observed state of IpAddress
58
60
type IpAddressStatus struct {
59
- // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
60
- // Important: Run "make" to regenerate code after modifying this file
61
61
// The ID of the resource in NetBox
62
62
IpAddressId int64 `json:"id,omitempty"`
63
63
64
- // The URL to the NetBox UI to display this resource. Note that the base depends on the runtime config of NetBox Operator
64
+ // The URL to the resource in the NetBox UI. Note that the base of this
65
+ // URL depends on the runtime config of NetBox Operator
65
66
IpAddressUrl string `json:"url,omitempty"`
66
67
68
+ // Conditions represent the latest available observations of an object's state
67
69
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
68
70
}
69
71
@@ -77,7 +79,7 @@ type IpAddressStatus struct {
77
79
//+kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
78
80
// +kubebuilder:resource:shortName=ip
79
81
80
- // IpAddress is the Schema for the ipaddresses API
82
+ // IpAddress allows to create a NetBox IP Address. More info about NetBox IP Addresses: https://github.com/netbox-community/netbox/blob/main/docs/models/ipam/ipaddress.md
81
83
type IpAddress struct {
82
84
metav1.TypeMeta `json:",inline"`
83
85
metav1.ObjectMeta `json:"metadata,omitempty"`
0 commit comments