sigs.k8s.io/cluster-api@v1.7.1/exp/ipam/api/v1alpha1/ipaddressclaim_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  	clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
    24  )
    25  
    26  // IPAddressClaimSpec is the desired state of an IPAddressClaim.
    27  type IPAddressClaimSpec struct {
    28  	// PoolRef is a reference to the pool from which an IP address should be created.
    29  	PoolRef corev1.TypedLocalObjectReference `json:"poolRef"`
    30  }
    31  
    32  // IPAddressClaimStatus is the observed status of a IPAddressClaim.
    33  type IPAddressClaimStatus struct {
    34  	// AddressRef is a reference to the address that was created for this claim.
    35  	// +optional
    36  	AddressRef corev1.LocalObjectReference `json:"addressRef,omitempty"`
    37  
    38  	// Conditions summarises the current state of the IPAddressClaim
    39  	// +optional
    40  	Conditions clusterv1.Conditions `json:"conditions,omitempty"`
    41  }
    42  
    43  // +kubebuilder:object:root=true
    44  // +kubebuilder:resource:path=ipaddressclaims,scope=Namespaced,categories=cluster-api
    45  // +kubebuilder:subresource:status
    46  // +kubebuilder:printcolumn:name="Pool Name",type="string",JSONPath=".spec.poolRef.name",description="Name of the pool to allocate an address from"
    47  // +kubebuilder:printcolumn:name="Pool Kind",type="string",JSONPath=".spec.poolRef.kind",description="Kind of the pool to allocate an address from"
    48  // +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Time duration since creation of IPAdressClaim"
    49  
    50  // IPAddressClaim is the Schema for the ipaddressclaim API.
    51  type IPAddressClaim struct {
    52  	metav1.TypeMeta   `json:",inline"`
    53  	metav1.ObjectMeta `json:"metadata,omitempty"`
    54  
    55  	Spec   IPAddressClaimSpec   `json:"spec,omitempty"`
    56  	Status IPAddressClaimStatus `json:"status,omitempty"`
    57  }
    58  
    59  // GetConditions returns the set of conditions for this object.
    60  func (m *IPAddressClaim) GetConditions() clusterv1.Conditions {
    61  	return m.Status.Conditions
    62  }
    63  
    64  // SetConditions sets the conditions on this object.
    65  func (m *IPAddressClaim) SetConditions(conditions clusterv1.Conditions) {
    66  	m.Status.Conditions = conditions
    67  }
    68  
    69  // +kubebuilder:object:root=true
    70  
    71  // IPAddressClaimList is a list of IPAddressClaims.
    72  type IPAddressClaimList struct {
    73  	metav1.TypeMeta `json:",inline"`
    74  	metav1.ListMeta `json:"metadata,omitempty"`
    75  	Items           []IPAddressClaim `json:"items"`
    76  }
    77  
    78  func init() {
    79  	objectTypes = append(objectTypes, &IPAddressClaim{}, &IPAddressClaimList{})
    80  }