Skip to content

Commit

Permalink
Merge pull request #795 from IBM/ibm-vpc-storage
Browse files Browse the repository at this point in the history
#792 Allow IBM VPC storage
  • Loading branch information
fketelaars authored Sep 26, 2024
2 parents a75cf49 + 6fc248a commit fd8d3b4
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 17 deletions.
4 changes: 2 additions & 2 deletions automation-generators/existing-ocp/openshift/preprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ def preprocessor(attributes=None, fullConfig=None, moduleVariables=None):
g.appendError(msg='storage_name must be specified for all openshift_storage elements')
if "storage_type" not in os:
g.appendError(msg='storage_type must be specified for all openshift_storage elements')
if "storage_type" in os and os['storage_type'] not in ['nfs','ocs','aws-elastic','pwx','ibm-storage-fdf','custom','auto']:
g.appendError(msg='storage_type must be nfs, ocs, aws-elastic, ibm-storage-fdf, custom, or auto')
if "storage_type" in os and os['storage_type'] not in ['nfs','ocs','aws-elastic','pwx','ibm-classic-storage','ibm-vpc-storage','ibm-storage-fdf','custom','auto']:
g.appendError(msg='storage_type must be nfs, ocs, aws-elastic, ibm-classic-storage, ibm-vpc-storage, ibm-storage-fdf, custom, or auto')
if "storage_type" in os and os['storage_type'] == 'custom':
if "ocp_storage_class_file" not in os:
g.appendError(msg='ocp_storage_class_file must be specified when storage_type is custom')
Expand Down
15 changes: 2 additions & 13 deletions automation-generators/ibm-cloud/openshift/preprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
# dns_servers:
# - 172.31.2.73:53
# openshift_storage:
# - storage_name: nfs-storage
# storage_type: nfs
# nfs_server_name: sample-nfs
# - storage_name: ocs-storage
# storage_type: ocs
# ocs_storage_label: ocs
Expand Down Expand Up @@ -115,16 +112,8 @@ def preprocessor(attributes=None, fullConfig=None, moduleVariables=None):
g.appendError(msg='storage_name must be specified for all openshift_storage elements')
if "storage_type" not in os:
g.appendError(msg='storage_type must be specified for all openshift_storage elements')
if "storage_type" in os and os['storage_type'] not in ['nfs','ocs','pwx']:
g.appendError(msg='storage_type must be nfs, ocs or pwx')
if "storage_type" in os and os['storage_type']=='nfs':
nfs_server_names = []
if 'nfs_server' in fc:
nfs_server_names = fc.match('nfs_server[*].name')
if "nfs_server_name" not in os:
g.appendError(msg='nfs_server_name must be specified when storage_type is nfs')
elif os['nfs_server_name'] not in nfs_server_names:
g.appendError(msg="'"+ os['nfs_server_name'] + "' is not an existing nfs_server name (Found nfs_server: ["+ ','.join(nfs_server_names) +"] )")
if "storage_type" in os and os['storage_type'] not in ['ibm-vpc-storage','ocs','pwx']:
g.appendError(msg='storage_type must be ibm-vpc-storage, ocs or pwx')
if "storage_type" in os and os['storage_type']=='ocs':
if "ocs_storage_label" not in os:
g.appendError(msg='ocs_storage_label must be specified when storage_type is ocs')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
_storage_type: 'ibm-classic-storage'
when: _openshift_storage_classes.stdout is search("ibmc-file-gold-gid")

- set_fact:
_storage_type: 'ibm-vpc-storage'
when: _openshift_storage_classes.stdout is search("ibmc-vpc-file-1000-iops")

- set_fact:
_storage_type: 'nfs'
when: _openshift_storage_classes.stdout is search("managed-nfs-storage")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@

# Fail if the detected storage type is not supported
- fail:
msg: "Valid storage types are 'nfs', 'ocs', 'pwx', 'aws-elastic', 'ibm-classic-storage', 'ibm-storage-fdf', and 'custom'"
when: _storage_type not in ['nfs', 'ocs', 'pwx', 'aws-elastic', 'ibm-classic-storage', 'ibm-storage-fdf', 'custom']
msg: "Valid storage types are 'nfs', 'ocs', 'pwx', 'aws-elastic', 'ibm-classic-storage', 'ibm-vpc-storage', 'ibm-storage-fdf', and 'custom'"
when: _storage_type not in ['nfs', 'ocs', 'pwx', 'aws-elastic', 'ibm-classic-storage', 'ibm-vpc-storage', 'ibm-storage-fdf', 'custom']

# Set storage class variables based on the detected storage type
- set_fact:
Expand All @@ -69,13 +69,15 @@
'ocs': 'ocs-storagecluster-cephfs',
'pwx': 'px-replicated',
'ibm-classic-storage': 'ibmc-file-gold-gid',
'ibm-vpc-storage': 'ibmc-vpc-file-1000-iops',
'ibm-storage-fdf': 'ibm-storage-fusion-cp-sc'
}[_storage_type]) }}"
ocp_storage_class_block: "{{ _selected_openshift_storage.ocp_storage_class_block | default({
'nfs': 'managed-nfs-storage',
'ocs': 'ocs-storagecluster-ceph-rbd',
'pwx': 'px-db',
'ibm-classic-storage': 'ibmc-block-gold',
'ibm-vpc-storage': 'ibmc-vpc-block-10iops-tier',
'ibm-storage-fdf': 'ibm-storage-fusion-cp-sc'
}[_storage_type]) }}"
when:
Expand Down
2 changes: 2 additions & 0 deletions scripts/deployer/cpd-start-deployer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ if ! $(oc get pvc cloud-pak-deployer-status > /dev/null 2>&1 );then
export DEPLOYER_SC=ocs-storagecluster-cephfs
elif oc get sc ibmc-file-gold-gid > /dev/null 2>&1;then
export DEPLOYER_SC=ibmc-file-gold-gid
elif oc get sc ibmc-vpc-file-1000-iops > /dev/null 2>&1;then
export DEPLOYER_SC=ibmc-vpc-file-1000-iops
else
echo "No supported storage class found for the deployer job, exiting."
exit 1
Expand Down

0 comments on commit fd8d3b4

Please sign in to comment.