Skip to content

Instantly share code, notes, and snippets.

@msau42
Created October 31, 2019 00:45
Show Gist options
  • Save msau42/ee472955b1b0c6cbd11120eed84821d7 to your computer and use it in GitHub Desktop.
Save msau42/ee472955b1b0c6cbd11120eed84821d7 to your computer and use it in GitHub Desktop.
storagepool idea
# StoragePools have nodeaffinity/selectors
# OPEN ISSUE: Does StoragePool also need parameters like ssd, encryption, etc.
type: StoragePool
metadata:
name: pool1
spec:
nodeAffinity/Selector:
zone: us-west1a
status:
capacity:
available: 1TB
----
type: StoragePool
metadata:
name: pool2
spec:
nodeAffinity/Selector:
zone: us-west1b
status:
capacity:
available: 100GB
---
# StorageClass can be comprised of multiple StoragePools
# OPEN ISSUE: Can a StoragePool be part of multiple StorageClasses?
type: StorageClass
metadata:
name: class1
parameters:
type: ssd
storagePools:
- pool1
- pool2
---
# Pods control placement through existing pod placement primitives
type: Pod
metadata:
name: pod1
spec:
nodeAffinity/selector:
zone: us-west1a
volumes:
claimName: pvc1
---
# Another example of pod placement strategies
type: Pod
metadata:
name: pod1
spec:
# Spread the pods with this label across zones
podAntiAffinity:
labelSelector:
app: my-app
topologyKey: zone
volumes:
claimName: pvc1
---
type: PVC
metadata:
name: pvc1
spec:
storageClass: class1
capacity:
request: 50GB
---
# This is extendable to templated PVCs like StatefulSets too
type: StatefulSet
metadata:
name: stateful-app
spec:
podTemplate:
# Spread the pods with this label across zones
podAntiAffinity:
labelSelector:
app: my-app
topologyKey: zone
pvcTemplate:
- name: pvc-a
storageClass: class1
capacity:
request: 50GB
# If you have different types of pools available on the same node (ie HDD and SSD), make different storageclasses for them
type: StatefulSet
metadata:
name: stateful-app
spec:
podTemplate:
# Spread the pods with this label across zones
podAntiAffinity:
labelSelector:
app: my-app
topologyKey: zone
pvcTemplate:
- name: pvc-a
storageClass: hdd-class
capacity:
request: 50GB
- name: pvc-b
storageClass: ssd-class
capacity:
request: 50GB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment