-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Up until now, we were using the legacy way of deploying hostpath-provisioner. We can start consuming HPP-CSI instead, which does not require setting up MachineConfigs and can take advantage of the underlying storage backend provided by the cloud provider. Signed-off-by: Oren Cohen <[email protected]>
- Loading branch information
Showing
11 changed files
with
99 additions
and
205 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
--- | ||
kind: HostPathProvisioner | ||
apiVersion: hostpathprovisioner.kubevirt.io/v1beta1 | ||
kind: HostPathProvisioner | ||
metadata: | ||
name: hostpath-provisioner | ||
spec: | ||
imagePullPolicy: IfNotPresent | ||
storagePools: | ||
- name: local | ||
- name: hpp-csi-local-basic | ||
path: "/var/hpp-csi-local-basic" | ||
- name: hpp-csi-pvc-block | ||
pvcTemplate: | ||
storageClassName: local-block-hpp | ||
volumeMode: Block | ||
storageClassName: local-block-hpp # Replaced by configure_hpp_*.sh | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 5Gi | ||
path: "/var/hpvolumes" | ||
storage: 70Gi | ||
path: "/var/hpp-csi-pvc-block" | ||
workload: | ||
nodeSelector: | ||
kubernetes.io/os: linux |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
apiVersion: storage.k8s.io/v1 | ||
kind: StorageClass | ||
metadata: | ||
name: hostpath-provisioner | ||
provisioner: kubevirt.io.hostpath-provisioner | ||
reclaimPolicy: Delete | ||
volumeBindingMode: WaitForFirstConsumer | ||
parameters: | ||
storagePool: hpp-csi-local-basic | ||
--- | ||
apiVersion: storage.k8s.io/v1 | ||
kind: StorageClass | ||
metadata: | ||
name: hostpath-csi-pvc-block | ||
provisioner: kubevirt.io.hostpath-provisioner | ||
reclaimPolicy: Delete | ||
volumeBindingMode: WaitForFirstConsumer | ||
parameters: | ||
storagePool: hpp-csi-pvc-block |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/bin/bash | ||
|
||
# | ||
# Configures HPP-CSI on an OCP cluster using the StoragePool feature. | ||
# | ||
# Deploys two storage classes | ||
# * hostpath-csi-basic - uses root filesystem of the worker nodes | ||
# * hostpath-csi-pvc-block - utilize another storage class as a backend | ||
# | ||
# Requires HPP operator to be deployed on the cluster. | ||
|
||
set -ex | ||
|
||
readonly SCRIPT_DIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")") | ||
HPP_VOLUME_SIZE=${HPP_VOLUME_SIZE:-${VOLUME_SIZE:-70}}Gi | ||
|
||
|
||
CLUSTER_PLATFORM=$( | ||
oc get infrastructure cluster \ | ||
--output=jsonpath='{$.status.platform}' | ||
) | ||
|
||
case "${CLUSTER_PLATFORM}" in | ||
Azure) | ||
HPP_BACKEND_STORAGE_CLASS=managed-csi | ||
;; | ||
AWS) | ||
HPP_BACKEND_STORAGE_CLASS=gp3-csi | ||
;; | ||
GCP) | ||
HPP_BACKEND_STORAGE_CLASS=standard-csi | ||
;; | ||
BareMetal) | ||
HPP_BACKEND_STORAGE_CLASS=ocs-storagecluster-ceph-rbd | ||
;; | ||
None) | ||
# UPI Installation | ||
HPP_BACKEND_STORAGE_CLASS=${HPP_BACKEND_STORAGE_CLASS:-ocs-storagecluster-ceph-rbd} | ||
;; | ||
*) | ||
echo "[ERROR] Unsupported cluster platform: [${CLUSTER_PLATFORM}]" >&2 | ||
exit 1 | ||
;; | ||
esac | ||
|
||
|
||
# Create HPP CustomResource using the StoragePool feature | ||
sed "${SCRIPT_DIR}/10_hpp_pool_cr.yaml" \ | ||
-e "s|^\( \+storageClassName\): .*|\1: ${HPP_BACKEND_STORAGE_CLASS}|g" \ | ||
| oc create --filename=- | ||
|
||
# Create HPP StorageClass using the StoragePool feature | ||
oc create --filename="${SCRIPT_DIR}/20_hpp_pool_sc.yaml" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters