sigs.k8s.io/cluster-api@v1.7.1/exp/ipam/api/v1alpha1/ipaddress_types.go (about) 1 /* 2 Copyright 2022 The Kubernetes Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package v1alpha1 18 19 import ( 20 corev1 "k8s.io/api/core/v1" 21 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 22 ) 23 24 // IPAddressSpec is the desired state of an IPAddress. 25 type IPAddressSpec struct { 26 // ClaimRef is a reference to the claim this IPAddress was created for. 27 ClaimRef corev1.LocalObjectReference `json:"claimRef"` 28 29 // PoolRef is a reference to the pool that this IPAddress was created from. 30 PoolRef corev1.TypedLocalObjectReference `json:"poolRef"` 31 32 // Address is the IP address. 33 Address string `json:"address"` 34 35 // Prefix is the prefix of the address. 36 Prefix int `json:"prefix"` 37 38 // Gateway is the network gateway of the network the address is from. 39 // +optional 40 Gateway string `json:"gateway,omitempty"` 41 } 42 43 // +kubebuilder:object:root=true 44 // +kubebuilder:resource:path=ipaddresses,scope=Namespaced,categories=cluster-api 45 // +kubebuilder:printcolumn:name="Address",type="string",JSONPath=".spec.address",description="Address" 46 // +kubebuilder:printcolumn:name="Pool Name",type="string",JSONPath=".spec.poolRef.name",description="Name of the pool the address is from" 47 // +kubebuilder:printcolumn:name="Pool Kind",type="string",JSONPath=".spec.poolRef.kind",description="Kind of the pool the address is from" 48 // +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Time duration since creation of IPAdress" 49 50 // IPAddress is the Schema for the ipaddress API. 51 type IPAddress struct { 52 metav1.TypeMeta `json:",inline"` 53 metav1.ObjectMeta `json:"metadata,omitempty"` 54 55 Spec IPAddressSpec `json:"spec,omitempty"` 56 } 57 58 // +kubebuilder:object:root=true 59 60 // IPAddressList is a list of IPAddress. 61 type IPAddressList struct { 62 metav1.TypeMeta `json:",inline"` 63 metav1.ListMeta `json:"metadata,omitempty"` 64 Items []IPAddress `json:"items"` 65 } 66 67 func init() { 68 objectTypes = append(objectTypes, &IPAddress{}, &IPAddressList{}) 69 }