github.com/pulumi/pulumi-kubernetes/sdk/v3@v3.30.2/go/kubernetes/storage/v1beta1/csistorageCapacity.go (about) 1 // Code generated by pulumigen DO NOT EDIT. 2 // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** 3 4 package v1beta1 5 6 import ( 7 "context" 8 "reflect" 9 10 "errors" 11 metav1 "github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes/meta/v1" 12 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 13 ) 14 15 // CSIStorageCapacity stores the result of one CSI GetCapacity call. For a given StorageClass, this describes the available capacity in a particular topology segment. This can be used when considering where to instantiate new PersistentVolumes. 16 // 17 // For example this can express things like: - StorageClass "standard" has "1234 GiB" available in "topology.kubernetes.io/zone=us-east1" - StorageClass "localssd" has "10 GiB" available in "kubernetes.io/hostname=knode-abc123" 18 // 19 // The following three cases all imply that no capacity is available for a certain combination: - no object exists with suitable topology and storage class name - such an object exists, but the capacity is unset - such an object exists, but the capacity is zero 20 // 21 // The producer of these objects can decide which approach is more suitable. 22 // 23 // They are consumed by the kube-scheduler when a CSI driver opts into capacity-aware scheduling with CSIDriverSpec.StorageCapacity. The scheduler compares the MaximumVolumeSize against the requested size of pending volumes to filter out unsuitable nodes. If MaximumVolumeSize is unset, it falls back to a comparison against the less precise Capacity. If that is also unset, the scheduler assumes that capacity is insufficient and tries some other node. 24 type CSIStorageCapacity struct { 25 pulumi.CustomResourceState 26 27 // APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources 28 ApiVersion pulumi.StringPtrOutput `pulumi:"apiVersion"` 29 // Capacity is the value reported by the CSI driver in its GetCapacityResponse for a GetCapacityRequest with topology and parameters that match the previous fields. 30 // 31 // The semantic is currently (CSI spec 1.2) defined as: The available capacity, in bytes, of the storage that can be used to provision volumes. If not set, that information is currently unavailable. 32 Capacity pulumi.StringPtrOutput `pulumi:"capacity"` 33 // Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds 34 Kind pulumi.StringPtrOutput `pulumi:"kind"` 35 // MaximumVolumeSize is the value reported by the CSI driver in its GetCapacityResponse for a GetCapacityRequest with topology and parameters that match the previous fields. 36 // 37 // This is defined since CSI spec 1.4.0 as the largest size that may be used in a CreateVolumeRequest.capacity_range.required_bytes field to create a volume with the same parameters as those in GetCapacityRequest. The corresponding value in the Kubernetes API is ResourceRequirements.Requests in a volume claim. 38 MaximumVolumeSize pulumi.StringPtrOutput `pulumi:"maximumVolumeSize"` 39 // Standard object's metadata. The name has no particular meaning. It must be be a DNS subdomain (dots allowed, 253 characters). To ensure that there are no conflicts with other CSI drivers on the cluster, the recommendation is to use csisc-<uuid>, a generated name, or a reverse-domain name which ends with the unique CSI driver name. 40 // 41 // Objects are namespaced. 42 // 43 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata 44 Metadata metav1.ObjectMetaPtrOutput `pulumi:"metadata"` 45 // NodeTopology defines which nodes have access to the storage for which capacity was reported. If not set, the storage is not accessible from any node in the cluster. If empty, the storage is accessible from all nodes. This field is immutable. 46 NodeTopology metav1.LabelSelectorPtrOutput `pulumi:"nodeTopology"` 47 // The name of the StorageClass that the reported capacity applies to. It must meet the same requirements as the name of a StorageClass object (non-empty, DNS subdomain). If that object no longer exists, the CSIStorageCapacity object is obsolete and should be removed by its creator. This field is immutable. 48 StorageClassName pulumi.StringOutput `pulumi:"storageClassName"` 49 } 50 51 // NewCSIStorageCapacity registers a new resource with the given unique name, arguments, and options. 52 func NewCSIStorageCapacity(ctx *pulumi.Context, 53 name string, args *CSIStorageCapacityArgs, opts ...pulumi.ResourceOption) (*CSIStorageCapacity, error) { 54 if args == nil { 55 return nil, errors.New("missing one or more required arguments") 56 } 57 58 if args.StorageClassName == nil { 59 return nil, errors.New("invalid value for required argument 'StorageClassName'") 60 } 61 args.ApiVersion = pulumi.StringPtr("storage.k8s.io/v1beta1") 62 args.Kind = pulumi.StringPtr("CSIStorageCapacity") 63 aliases := pulumi.Aliases([]pulumi.Alias{ 64 { 65 Type: pulumi.String("kubernetes:storage.k8s.io/v1:CSIStorageCapacity"), 66 }, 67 { 68 Type: pulumi.String("kubernetes:storage.k8s.io/v1alpha1:CSIStorageCapacity"), 69 }, 70 }) 71 opts = append(opts, aliases) 72 var resource CSIStorageCapacity 73 err := ctx.RegisterResource("kubernetes:storage.k8s.io/v1beta1:CSIStorageCapacity", name, args, &resource, opts...) 74 if err != nil { 75 return nil, err 76 } 77 return &resource, nil 78 } 79 80 // GetCSIStorageCapacity gets an existing CSIStorageCapacity resource's state with the given name, ID, and optional 81 // state properties that are used to uniquely qualify the lookup (nil if not required). 82 func GetCSIStorageCapacity(ctx *pulumi.Context, 83 name string, id pulumi.IDInput, state *CSIStorageCapacityState, opts ...pulumi.ResourceOption) (*CSIStorageCapacity, error) { 84 var resource CSIStorageCapacity 85 err := ctx.ReadResource("kubernetes:storage.k8s.io/v1beta1:CSIStorageCapacity", name, id, state, &resource, opts...) 86 if err != nil { 87 return nil, err 88 } 89 return &resource, nil 90 } 91 92 // Input properties used for looking up and filtering CSIStorageCapacity resources. 93 type csistorageCapacityState struct { 94 } 95 96 type CSIStorageCapacityState struct { 97 } 98 99 func (CSIStorageCapacityState) ElementType() reflect.Type { 100 return reflect.TypeOf((*csistorageCapacityState)(nil)).Elem() 101 } 102 103 type csistorageCapacityArgs struct { 104 // APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources 105 ApiVersion *string `pulumi:"apiVersion"` 106 // Capacity is the value reported by the CSI driver in its GetCapacityResponse for a GetCapacityRequest with topology and parameters that match the previous fields. 107 // 108 // The semantic is currently (CSI spec 1.2) defined as: The available capacity, in bytes, of the storage that can be used to provision volumes. If not set, that information is currently unavailable. 109 Capacity *string `pulumi:"capacity"` 110 // Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds 111 Kind *string `pulumi:"kind"` 112 // MaximumVolumeSize is the value reported by the CSI driver in its GetCapacityResponse for a GetCapacityRequest with topology and parameters that match the previous fields. 113 // 114 // This is defined since CSI spec 1.4.0 as the largest size that may be used in a CreateVolumeRequest.capacity_range.required_bytes field to create a volume with the same parameters as those in GetCapacityRequest. The corresponding value in the Kubernetes API is ResourceRequirements.Requests in a volume claim. 115 MaximumVolumeSize *string `pulumi:"maximumVolumeSize"` 116 // Standard object's metadata. The name has no particular meaning. It must be be a DNS subdomain (dots allowed, 253 characters). To ensure that there are no conflicts with other CSI drivers on the cluster, the recommendation is to use csisc-<uuid>, a generated name, or a reverse-domain name which ends with the unique CSI driver name. 117 // 118 // Objects are namespaced. 119 // 120 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata 121 Metadata *metav1.ObjectMeta `pulumi:"metadata"` 122 // NodeTopology defines which nodes have access to the storage for which capacity was reported. If not set, the storage is not accessible from any node in the cluster. If empty, the storage is accessible from all nodes. This field is immutable. 123 NodeTopology *metav1.LabelSelector `pulumi:"nodeTopology"` 124 // The name of the StorageClass that the reported capacity applies to. It must meet the same requirements as the name of a StorageClass object (non-empty, DNS subdomain). If that object no longer exists, the CSIStorageCapacity object is obsolete and should be removed by its creator. This field is immutable. 125 StorageClassName string `pulumi:"storageClassName"` 126 } 127 128 // The set of arguments for constructing a CSIStorageCapacity resource. 129 type CSIStorageCapacityArgs struct { 130 // APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources 131 ApiVersion pulumi.StringPtrInput 132 // Capacity is the value reported by the CSI driver in its GetCapacityResponse for a GetCapacityRequest with topology and parameters that match the previous fields. 133 // 134 // The semantic is currently (CSI spec 1.2) defined as: The available capacity, in bytes, of the storage that can be used to provision volumes. If not set, that information is currently unavailable. 135 Capacity pulumi.StringPtrInput 136 // Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds 137 Kind pulumi.StringPtrInput 138 // MaximumVolumeSize is the value reported by the CSI driver in its GetCapacityResponse for a GetCapacityRequest with topology and parameters that match the previous fields. 139 // 140 // This is defined since CSI spec 1.4.0 as the largest size that may be used in a CreateVolumeRequest.capacity_range.required_bytes field to create a volume with the same parameters as those in GetCapacityRequest. The corresponding value in the Kubernetes API is ResourceRequirements.Requests in a volume claim. 141 MaximumVolumeSize pulumi.StringPtrInput 142 // Standard object's metadata. The name has no particular meaning. It must be be a DNS subdomain (dots allowed, 253 characters). To ensure that there are no conflicts with other CSI drivers on the cluster, the recommendation is to use csisc-<uuid>, a generated name, or a reverse-domain name which ends with the unique CSI driver name. 143 // 144 // Objects are namespaced. 145 // 146 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata 147 Metadata metav1.ObjectMetaPtrInput 148 // NodeTopology defines which nodes have access to the storage for which capacity was reported. If not set, the storage is not accessible from any node in the cluster. If empty, the storage is accessible from all nodes. This field is immutable. 149 NodeTopology metav1.LabelSelectorPtrInput 150 // The name of the StorageClass that the reported capacity applies to. It must meet the same requirements as the name of a StorageClass object (non-empty, DNS subdomain). If that object no longer exists, the CSIStorageCapacity object is obsolete and should be removed by its creator. This field is immutable. 151 StorageClassName pulumi.StringInput 152 } 153 154 func (CSIStorageCapacityArgs) ElementType() reflect.Type { 155 return reflect.TypeOf((*csistorageCapacityArgs)(nil)).Elem() 156 } 157 158 type CSIStorageCapacityInput interface { 159 pulumi.Input 160 161 ToCSIStorageCapacityOutput() CSIStorageCapacityOutput 162 ToCSIStorageCapacityOutputWithContext(ctx context.Context) CSIStorageCapacityOutput 163 } 164 165 func (*CSIStorageCapacity) ElementType() reflect.Type { 166 return reflect.TypeOf((**CSIStorageCapacity)(nil)).Elem() 167 } 168 169 func (i *CSIStorageCapacity) ToCSIStorageCapacityOutput() CSIStorageCapacityOutput { 170 return i.ToCSIStorageCapacityOutputWithContext(context.Background()) 171 } 172 173 func (i *CSIStorageCapacity) ToCSIStorageCapacityOutputWithContext(ctx context.Context) CSIStorageCapacityOutput { 174 return pulumi.ToOutputWithContext(ctx, i).(CSIStorageCapacityOutput) 175 } 176 177 // CSIStorageCapacityArrayInput is an input type that accepts CSIStorageCapacityArray and CSIStorageCapacityArrayOutput values. 178 // You can construct a concrete instance of `CSIStorageCapacityArrayInput` via: 179 // 180 // CSIStorageCapacityArray{ CSIStorageCapacityArgs{...} } 181 type CSIStorageCapacityArrayInput interface { 182 pulumi.Input 183 184 ToCSIStorageCapacityArrayOutput() CSIStorageCapacityArrayOutput 185 ToCSIStorageCapacityArrayOutputWithContext(context.Context) CSIStorageCapacityArrayOutput 186 } 187 188 type CSIStorageCapacityArray []CSIStorageCapacityInput 189 190 func (CSIStorageCapacityArray) ElementType() reflect.Type { 191 return reflect.TypeOf((*[]*CSIStorageCapacity)(nil)).Elem() 192 } 193 194 func (i CSIStorageCapacityArray) ToCSIStorageCapacityArrayOutput() CSIStorageCapacityArrayOutput { 195 return i.ToCSIStorageCapacityArrayOutputWithContext(context.Background()) 196 } 197 198 func (i CSIStorageCapacityArray) ToCSIStorageCapacityArrayOutputWithContext(ctx context.Context) CSIStorageCapacityArrayOutput { 199 return pulumi.ToOutputWithContext(ctx, i).(CSIStorageCapacityArrayOutput) 200 } 201 202 // CSIStorageCapacityMapInput is an input type that accepts CSIStorageCapacityMap and CSIStorageCapacityMapOutput values. 203 // You can construct a concrete instance of `CSIStorageCapacityMapInput` via: 204 // 205 // CSIStorageCapacityMap{ "key": CSIStorageCapacityArgs{...} } 206 type CSIStorageCapacityMapInput interface { 207 pulumi.Input 208 209 ToCSIStorageCapacityMapOutput() CSIStorageCapacityMapOutput 210 ToCSIStorageCapacityMapOutputWithContext(context.Context) CSIStorageCapacityMapOutput 211 } 212 213 type CSIStorageCapacityMap map[string]CSIStorageCapacityInput 214 215 func (CSIStorageCapacityMap) ElementType() reflect.Type { 216 return reflect.TypeOf((*map[string]*CSIStorageCapacity)(nil)).Elem() 217 } 218 219 func (i CSIStorageCapacityMap) ToCSIStorageCapacityMapOutput() CSIStorageCapacityMapOutput { 220 return i.ToCSIStorageCapacityMapOutputWithContext(context.Background()) 221 } 222 223 func (i CSIStorageCapacityMap) ToCSIStorageCapacityMapOutputWithContext(ctx context.Context) CSIStorageCapacityMapOutput { 224 return pulumi.ToOutputWithContext(ctx, i).(CSIStorageCapacityMapOutput) 225 } 226 227 type CSIStorageCapacityOutput struct{ *pulumi.OutputState } 228 229 func (CSIStorageCapacityOutput) ElementType() reflect.Type { 230 return reflect.TypeOf((**CSIStorageCapacity)(nil)).Elem() 231 } 232 233 func (o CSIStorageCapacityOutput) ToCSIStorageCapacityOutput() CSIStorageCapacityOutput { 234 return o 235 } 236 237 func (o CSIStorageCapacityOutput) ToCSIStorageCapacityOutputWithContext(ctx context.Context) CSIStorageCapacityOutput { 238 return o 239 } 240 241 // APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources 242 func (o CSIStorageCapacityOutput) ApiVersion() pulumi.StringPtrOutput { 243 return o.ApplyT(func(v *CSIStorageCapacity) pulumi.StringPtrOutput { return v.ApiVersion }).(pulumi.StringPtrOutput) 244 } 245 246 // Capacity is the value reported by the CSI driver in its GetCapacityResponse for a GetCapacityRequest with topology and parameters that match the previous fields. 247 // 248 // The semantic is currently (CSI spec 1.2) defined as: The available capacity, in bytes, of the storage that can be used to provision volumes. If not set, that information is currently unavailable. 249 func (o CSIStorageCapacityOutput) Capacity() pulumi.StringPtrOutput { 250 return o.ApplyT(func(v *CSIStorageCapacity) pulumi.StringPtrOutput { return v.Capacity }).(pulumi.StringPtrOutput) 251 } 252 253 // Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds 254 func (o CSIStorageCapacityOutput) Kind() pulumi.StringPtrOutput { 255 return o.ApplyT(func(v *CSIStorageCapacity) pulumi.StringPtrOutput { return v.Kind }).(pulumi.StringPtrOutput) 256 } 257 258 // MaximumVolumeSize is the value reported by the CSI driver in its GetCapacityResponse for a GetCapacityRequest with topology and parameters that match the previous fields. 259 // 260 // This is defined since CSI spec 1.4.0 as the largest size that may be used in a CreateVolumeRequest.capacity_range.required_bytes field to create a volume with the same parameters as those in GetCapacityRequest. The corresponding value in the Kubernetes API is ResourceRequirements.Requests in a volume claim. 261 func (o CSIStorageCapacityOutput) MaximumVolumeSize() pulumi.StringPtrOutput { 262 return o.ApplyT(func(v *CSIStorageCapacity) pulumi.StringPtrOutput { return v.MaximumVolumeSize }).(pulumi.StringPtrOutput) 263 } 264 265 // Standard object's metadata. The name has no particular meaning. It must be be a DNS subdomain (dots allowed, 253 characters). To ensure that there are no conflicts with other CSI drivers on the cluster, the recommendation is to use csisc-<uuid>, a generated name, or a reverse-domain name which ends with the unique CSI driver name. 266 // 267 // Objects are namespaced. 268 // 269 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata 270 func (o CSIStorageCapacityOutput) Metadata() metav1.ObjectMetaPtrOutput { 271 return o.ApplyT(func(v *CSIStorageCapacity) metav1.ObjectMetaPtrOutput { return v.Metadata }).(metav1.ObjectMetaPtrOutput) 272 } 273 274 // NodeTopology defines which nodes have access to the storage for which capacity was reported. If not set, the storage is not accessible from any node in the cluster. If empty, the storage is accessible from all nodes. This field is immutable. 275 func (o CSIStorageCapacityOutput) NodeTopology() metav1.LabelSelectorPtrOutput { 276 return o.ApplyT(func(v *CSIStorageCapacity) metav1.LabelSelectorPtrOutput { return v.NodeTopology }).(metav1.LabelSelectorPtrOutput) 277 } 278 279 // The name of the StorageClass that the reported capacity applies to. It must meet the same requirements as the name of a StorageClass object (non-empty, DNS subdomain). If that object no longer exists, the CSIStorageCapacity object is obsolete and should be removed by its creator. This field is immutable. 280 func (o CSIStorageCapacityOutput) StorageClassName() pulumi.StringOutput { 281 return o.ApplyT(func(v *CSIStorageCapacity) pulumi.StringOutput { return v.StorageClassName }).(pulumi.StringOutput) 282 } 283 284 type CSIStorageCapacityArrayOutput struct{ *pulumi.OutputState } 285 286 func (CSIStorageCapacityArrayOutput) ElementType() reflect.Type { 287 return reflect.TypeOf((*[]*CSIStorageCapacity)(nil)).Elem() 288 } 289 290 func (o CSIStorageCapacityArrayOutput) ToCSIStorageCapacityArrayOutput() CSIStorageCapacityArrayOutput { 291 return o 292 } 293 294 func (o CSIStorageCapacityArrayOutput) ToCSIStorageCapacityArrayOutputWithContext(ctx context.Context) CSIStorageCapacityArrayOutput { 295 return o 296 } 297 298 func (o CSIStorageCapacityArrayOutput) Index(i pulumi.IntInput) CSIStorageCapacityOutput { 299 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *CSIStorageCapacity { 300 return vs[0].([]*CSIStorageCapacity)[vs[1].(int)] 301 }).(CSIStorageCapacityOutput) 302 } 303 304 type CSIStorageCapacityMapOutput struct{ *pulumi.OutputState } 305 306 func (CSIStorageCapacityMapOutput) ElementType() reflect.Type { 307 return reflect.TypeOf((*map[string]*CSIStorageCapacity)(nil)).Elem() 308 } 309 310 func (o CSIStorageCapacityMapOutput) ToCSIStorageCapacityMapOutput() CSIStorageCapacityMapOutput { 311 return o 312 } 313 314 func (o CSIStorageCapacityMapOutput) ToCSIStorageCapacityMapOutputWithContext(ctx context.Context) CSIStorageCapacityMapOutput { 315 return o 316 } 317 318 func (o CSIStorageCapacityMapOutput) MapIndex(k pulumi.StringInput) CSIStorageCapacityOutput { 319 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *CSIStorageCapacity { 320 return vs[0].(map[string]*CSIStorageCapacity)[vs[1].(string)] 321 }).(CSIStorageCapacityOutput) 322 } 323 324 func init() { 325 pulumi.RegisterInputType(reflect.TypeOf((*CSIStorageCapacityInput)(nil)).Elem(), &CSIStorageCapacity{}) 326 pulumi.RegisterInputType(reflect.TypeOf((*CSIStorageCapacityArrayInput)(nil)).Elem(), CSIStorageCapacityArray{}) 327 pulumi.RegisterInputType(reflect.TypeOf((*CSIStorageCapacityMapInput)(nil)).Elem(), CSIStorageCapacityMap{}) 328 pulumi.RegisterOutputType(CSIStorageCapacityOutput{}) 329 pulumi.RegisterOutputType(CSIStorageCapacityArrayOutput{}) 330 pulumi.RegisterOutputType(CSIStorageCapacityMapOutput{}) 331 }