@pulumi/kubernetes
Version:
[](https://github.com/pulumi/pulumi-kubernetes/actions) [](https://slack.pulumi.com) [;
exports.CSIStorageCapacity = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../../utilities");
/**
* 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.
*
* 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"
*
* 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
*
* The producer of these objects can decide which approach is more suitable.
*
* 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.
*/
class CSIStorageCapacity extends pulumi.CustomResource {
/**
* Get an existing CSIStorageCapacity resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name, id, opts) {
return new CSIStorageCapacity(name, undefined, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of CSIStorageCapacity. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === CSIStorageCapacity.__pulumiType;
}
/**
* Create a CSIStorageCapacity resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name, args, opts) {
let resourceInputs = {};
opts = opts || {};
if (!opts.id) {
if (args?.storageClassName === undefined && !opts.urn) {
throw new Error("Missing required property 'storageClassName'");
}
resourceInputs["apiVersion"] = "storage.k8s.io/v1";
resourceInputs["capacity"] = args?.capacity;
resourceInputs["kind"] = "CSIStorageCapacity";
resourceInputs["maximumVolumeSize"] = args?.maximumVolumeSize;
resourceInputs["metadata"] = args?.metadata;
resourceInputs["nodeTopology"] = args?.nodeTopology;
resourceInputs["storageClassName"] = args?.storageClassName;
}
else {
resourceInputs["apiVersion"] = undefined /*out*/;
resourceInputs["capacity"] = undefined /*out*/;
resourceInputs["kind"] = undefined /*out*/;
resourceInputs["maximumVolumeSize"] = undefined /*out*/;
resourceInputs["metadata"] = undefined /*out*/;
resourceInputs["nodeTopology"] = undefined /*out*/;
resourceInputs["storageClassName"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const aliasOpts = { aliases: [{ type: "kubernetes:storage.k8s.io/v1beta1:CSIStorageCapacity" }, { type: "kubernetes:storage.k8s.io/v1alpha1:CSIStorageCapacity" }] };
opts = pulumi.mergeOptions(opts, aliasOpts);
super(CSIStorageCapacity.__pulumiType, name, resourceInputs, opts);
}
}
exports.CSIStorageCapacity = CSIStorageCapacity;
/** @internal */
CSIStorageCapacity.__pulumiType = 'kubernetes:storage.k8s.io/v1:CSIStorageCapacity';
//# sourceMappingURL=csistorageCapacity.js.map