orange-policeman-59119
04/01/2019, 5:29 PMssd
. A stack that deploys with limited permissions to a namespace cannot and should not own that storage class, because storage classes are a global resource. So I'd like to conditionally choose the storage class for a volume in a statefulset with logic like:
const ssdClass = new k8s.storage.v1.StorageClass(
'ssd',
{ metadata: { name: 'ssd' }, ... },
{ readonly: true }, // or loadOnly, or load, or whatever, I just want to get the resource that currently exists in Kubernetes that matches the spec I've provided. if it differs, I'd like this to return undefined
);
// ... in the spec for statefulSet
storageClass: ssdClass ? ssdClass.metadata.name : undefined`
Edit: Actually, come to think of it that API won't work, new
will always return an instance of a class. So perhaps a static method on the Kubernetes resource, like: k8s.storage.v1.StorageClass#read
that returns an Output<k8s.storage.v1.StorageClass | undefined>
?creamy-potato-29402
04/01/2019, 5:35 PMk8s.storage.v1.StorageClass.get(...)
?orange-policeman-59119
04/01/2019, 5:45 PMOutput
, what happens if the named storage class doesn't exist?creamy-potato-29402
04/01/2019, 5:47 PMget
will failorange-policeman-59119
04/01/2019, 5:47 PMget
?creamy-potato-29402
04/01/2019, 5:50 PMorange-policeman-59119
04/01/2019, 5:52 PMssd
storage class, and if that exists we ought to use that for persistence. If not, we should fall back to the default by leaving it undefined.