diff --git a/.gitignore b/.gitignore index f4ae5814..1ee2755a 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,10 @@ vendor/ !command/test-fixtures/**/.terraform/ *.sh + +!createaddon.sh +!createcrd.sh +!deleteaddon.sh +!deletecrd.sh +!updatecrd.sh +!updateodf.sh diff --git a/examples/openshift-data-foundation/README.md b/examples/openshift-data-foundation/README.md index 194a279a..7c09ba4a 100644 --- a/examples/openshift-data-foundation/README.md +++ b/examples/openshift-data-foundation/README.md @@ -10,4 +10,6 @@ If you'd like to Deploy and Manage the different configurations for ODF on a Red If you'd like to update or replace the different worker nodes with ODF enabled, head over to the [vpc-worker-replace](https://github.com/IBM-Cloud/terraform-provider-ibm/tree/master/examples/openshift-data-foundation/vpc-worker-replace) folder. This inherently covers the worker replace steps of sequential cordon, drain, and replace. -## Deploying & Managing OpenShift Data Foundation on ROKS Satellite - Coming Soon \ No newline at end of file +## Deploying & Managing OpenShift Data Foundation on ROKS Satellite + +If you'd like to Deploy and Manage ODF on a Red Hat OpenShift on a Satellite environment head over to the [satellite](https://github.com/IBM-Cloud/terraform-provider-ibm/tree/master/examples/openshift-data-foundation/satellite) folder. \ No newline at end of file diff --git a/examples/openshift-data-foundation/addon/4.12.0/README.md b/examples/openshift-data-foundation/addon/4.12.0/README.md index ce1565e5..884e9f4a 100644 --- a/examples/openshift-data-foundation/addon/4.12.0/README.md +++ b/examples/openshift-data-foundation/addon/4.12.0/README.md @@ -1,4 +1,4 @@ -# [Tech Preview] Deploying and Managing Openshift Data Foundation +# Deploying and Managing Openshift Data Foundation This example shows how to deploy and manage the Openshift Data Foundation (ODF) on IBM Cloud VPC based RedHat Openshift cluster. Note this template is still in development, so please be advised before using in production. diff --git a/examples/openshift-data-foundation/addon/4.13.0/README.md b/examples/openshift-data-foundation/addon/4.13.0/README.md index ace81d09..035ae723 100644 --- a/examples/openshift-data-foundation/addon/4.13.0/README.md +++ b/examples/openshift-data-foundation/addon/4.13.0/README.md @@ -1,4 +1,4 @@ -# [Tech Preview] Deploying and Managing Openshift Data Foundation +# Deploying and Managing Openshift Data Foundation This example shows how to deploy and manage the Openshift Data Foundation (ODF) on IBM Cloud VPC based RedHat Openshift cluster. Note this template is still in development, so please be advised before using in production. diff --git a/examples/openshift-data-foundation/addon/4.14.0/README.md b/examples/openshift-data-foundation/addon/4.14.0/README.md index e35625fe..ed309e2b 100644 --- a/examples/openshift-data-foundation/addon/4.14.0/README.md +++ b/examples/openshift-data-foundation/addon/4.14.0/README.md @@ -1,4 +1,4 @@ -# [Tech Preview] Deploying and Managing Openshift Data Foundation +# Deploying and Managing Openshift Data Foundation This example shows how to deploy and manage the Openshift Data Foundation (ODF) on IBM Cloud VPC based RedHat Openshift cluster. Note this template is still in development, so please be advised before using in production. @@ -157,7 +157,7 @@ ocsUpgrade = "false" -> "true" | cluster | Name of the cluster. | `string` | yes | - | region | Region of the cluster | `string` | yes | - | odfVersion | Version of the ODF add-on | `string` | yes | 4.12.0 -| osdSize | Enter the size for the storage devices that you want to provision for the Object Storage Daemon (OSD) pods | `string` | yes | 250Gi +| osdSize | Enter the size for the storage devices that you want to provision for the Object Storage Daemon (OSD) pods | `string` | yes | 512Gi | numOfOsd | The Number of OSD | `string` | yes | 1 | osdStorageClassName | Enter the storage class to be used to provision block volumes for Object Storage Daemon (OSD) pods | `string` | yes | ibmc-vpc-block-metro-10iops-tier | autoDiscoverDevices | Set to true if automatically discovering local disks | `string` | no | true diff --git a/examples/openshift-data-foundation/addon/4.14.0/createaddon.sh b/examples/openshift-data-foundation/addon/4.14.0/createaddon.sh new file mode 100644 index 00000000..68fb4a32 --- /dev/null +++ b/examples/openshift-data-foundation/addon/4.14.0/createaddon.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e + +WORKING_DIR=$(pwd) + +cp ${WORKING_DIR}/variables.tf ${WORKING_DIR}/ibm_odf_addon/variables.tf +cp ${WORKING_DIR}/schematics.tfvars ${WORKING_DIR}/ibm_odf_addon/schematics.tfvars +cd ${WORKING_DIR}/ibm_odf_addon +terraform init +terraform apply --auto-approve -var-file ${WORKING_DIR}/ibm_odf_addon/schematics.tfvars \ No newline at end of file diff --git a/examples/openshift-data-foundation/addon/4.14.0/createcrd.sh b/examples/openshift-data-foundation/addon/4.14.0/createcrd.sh new file mode 100644 index 00000000..6a321582 --- /dev/null +++ b/examples/openshift-data-foundation/addon/4.14.0/createcrd.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e + +WORKING_DIR=$(pwd) + +cp ${WORKING_DIR}/variables.tf ${WORKING_DIR}/ocscluster/variables.tf +cp ${WORKING_DIR}/schematics.tfvars ${WORKING_DIR}/ocscluster/schematics.tfvars +cd ${WORKING_DIR}/ocscluster +terraform init +terraform apply --auto-approve -var-file ${WORKING_DIR}/ocscluster/schematics.tfvars \ No newline at end of file diff --git a/examples/openshift-data-foundation/addon/4.14.0/deleteaddon.sh b/examples/openshift-data-foundation/addon/4.14.0/deleteaddon.sh new file mode 100644 index 00000000..e23f9be4 --- /dev/null +++ b/examples/openshift-data-foundation/addon/4.14.0/deleteaddon.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +set -e + +WORKING_DIR=$(pwd) + +cp ${WORKING_DIR}/variables.tf ${WORKING_DIR}/ibm_odf_addon/variables.tf +cp ${WORKING_DIR}/schematics.tfvars ${WORKING_DIR}/ibm_odf_addon/schematics.tfvars +cd ${WORKING_DIR}/ibm_odf_addon +terraform init +if [ -e ${WORKING_DIR}/ibm_odf_addon/terraform.tfstate ] +then + echo "ok" +else + terraform apply --auto-approve -var-file=${WORKING_DIR}/ibm_odf_addon/schematics.tfvars +fi +terraform destroy --auto-approve -var-file=${WORKING_DIR}/ibm_odf_addon/schematics.tfvars \ No newline at end of file diff --git a/examples/openshift-data-foundation/addon/4.14.0/deletecrd.sh b/examples/openshift-data-foundation/addon/4.14.0/deletecrd.sh new file mode 100644 index 00000000..42127bc5 --- /dev/null +++ b/examples/openshift-data-foundation/addon/4.14.0/deletecrd.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +set -e + +WORKING_DIR=$(pwd) + +cp ${WORKING_DIR}/variables.tf ${WORKING_DIR}/ocscluster/variables.tf +cp ${WORKING_DIR}/schematics.tfvars ${WORKING_DIR}/ocscluster/schematics.tfvars +cd ${WORKING_DIR}/ocscluster +terraform init +if [ -e ${WORKING_DIR}/ocscluster/terraform.tfstate ] +then + echo "ok" +else + terraform import -var-file=${WORKING_DIR}/ocscluster/schematics.tfvars kubernetes_manifest.ocscluster_ocscluster_auto "apiVersion=ocs.ibm.io/v1,kind=OcsCluster,namespace=openshift-storage,name=ocscluster-auto" + terraform apply --auto-approve -var-file ${WORKING_DIR}/ocscluster/schematics.tfvars +fi + +terraform destroy --auto-approve -var-file=${WORKING_DIR}/ocscluster/schematics.tfvars \ No newline at end of file diff --git a/examples/openshift-data-foundation/addon/4.14.0/schematics.tfvars b/examples/openshift-data-foundation/addon/4.14.0/schematics.tfvars index f49519a8..f30b2136 100644 --- a/examples/openshift-data-foundation/addon/4.14.0/schematics.tfvars +++ b/examples/openshift-data-foundation/addon/4.14.0/schematics.tfvars @@ -6,7 +6,7 @@ ibmcloud_api_key = "" cluster = "" region = "" -odfVersion = "" +odfVersion = "4.14.0" # To create the Ocscluster Custom Resource Definition, with the following specs diff --git a/examples/openshift-data-foundation/addon/4.14.0/updatecrd.sh b/examples/openshift-data-foundation/addon/4.14.0/updatecrd.sh new file mode 100644 index 00000000..c0a8002c --- /dev/null +++ b/examples/openshift-data-foundation/addon/4.14.0/updatecrd.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +set -e + +WORKING_DIR=$(pwd) + +cp ${WORKING_DIR}/variables.tf ${WORKING_DIR}/ocscluster/variables.tf +cp ${WORKING_DIR}/schematics.tfvars ${WORKING_DIR}/ocscluster/schematics.tfvars +cd ${WORKING_DIR}/ocscluster +terraform init +if [ -e ${WORKING_DIR}/ocscluster/terraform.tfstate ] +then + echo "ok" +else + terraform import -var-file=${WORKING_DIR}/ocscluster/schematics.tfvars kubernetes_manifest.ocscluster_ocscluster_auto "apiVersion=ocs.ibm.io/v1,kind=OcsCluster,namespace=openshift-storage,name=ocscluster-auto" +fi + +terraform apply --auto-approve -var-file ${WORKING_DIR}/ocscluster/schematics.tfvars + +sed -i'' -e "s|ocsUpgrade = \"true\"|ocsUpgrade = \"false\"|g" ${WORKING_DIR}/schematics.tfvars +sed -i'' -e "s|ocsUpgrade = \"true\"|ocsUpgrade = \"false\"|g" ${WORKING_DIR}/ocscluster/schematics.tfvars +rm -f ${WORKING_DIR}/schematics.tfvars-e +rm -f ${WORKING_DIR}/ocscluster/schematics.tfvars-e + +terraform apply --auto-approve -var-file ${WORKING_DIR}/ocscluster/schematics.tfvars \ No newline at end of file diff --git a/examples/openshift-data-foundation/addon/4.14.0/updateodf.sh b/examples/openshift-data-foundation/addon/4.14.0/updateodf.sh new file mode 100644 index 00000000..3cdf61cc --- /dev/null +++ b/examples/openshift-data-foundation/addon/4.14.0/updateodf.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e + +WORKING_DIR=$(pwd) + +cp ${WORKING_DIR}/variables.tf ${WORKING_DIR}/ibm_odf_addon/variables.tf +cp ${WORKING_DIR}/schematics.tfvars ${WORKING_DIR}/ibm_odf_addon/schematics.tfvars +cd ${WORKING_DIR}/ibm_odf_addon +terraform init +terraform apply --auto-approve -var-file ${WORKING_DIR}/ibm_odf_addon/schematics.tfvars diff --git a/examples/openshift-data-foundation/satellite/README.md b/examples/openshift-data-foundation/satellite/README.md new file mode 100644 index 00000000..4061f256 --- /dev/null +++ b/examples/openshift-data-foundation/satellite/README.md @@ -0,0 +1,9 @@ +# Deploying and Managing Openshift Data Foundation on Satellite + +This example shows how to deploy and manage the Openshift Data Foundation (ODF) on IBM Cloud Satellite based RedHat Openshift cluster. + +#### Please Select the ODF Template you wish to install on your ROKS Satellite Cluster and follow the documentation. + +- odf-remote - Choose this template if you have a CSI driver installed in your cluster. For example, the azuredisk-csi-driver driver. You can use the CSI driver to dynamically provision storage volumes when deploying ODF. + +- odf-local - Choose this template when you have local storage available to your worker nodes. If your storage volumes are visible when running lsblk, you can use these disks when deploying ODF if they are raw and unformatted. \ No newline at end of file diff --git a/examples/openshift-data-foundation/satellite/odf-local/4.13/README.md b/examples/openshift-data-foundation/satellite/odf-local/4.13/README.md new file mode 100644 index 00000000..3cec5f07 --- /dev/null +++ b/examples/openshift-data-foundation/satellite/odf-local/4.13/README.md @@ -0,0 +1,177 @@ +# Openshift Data Foundation - Local Deployment + +This example shows how to deploy and manage the Openshift Data Foundation (ODF) on IBM Cloud Satellite based RedHat Openshift cluster. + +This sample configuration will deploy the ODF, scale and upgrade it using the "ibm_satellite_storage_configuration" and "ibm_satellite_storage_assignment" resources from the ibm terraform provider. + +For more information, about + +* ODF Deployment & Management on Satellite, see [OpenShift Data Foundation for local devices](https://cloud.ibm.com/docs/satellite?topic=satellite-storage-odf-local&interface=ui) + +## Usage + +### Option 1 - Command Line Interface + +To run this example on your Terminal, first download this directory i.e `examples/openshift-data-foundation/` + +```bash +$ cd satellite +``` + +```bash +$ terraform init +$ terraform plan --var-file input.tfvars +$ terraform apply --var-file input.tfvars +``` + +Run `terraform destroy --var-file input.tfvars` when you don't need these resources. + +### Option 2 - IBM Cloud Schematics + +To Deploy & Manage the Openshift-Data-Foundation add-on using `IBM Cloud Schematics` please follow the below documentation + +https://cloud.ibm.com/docs/schematics?topic=schematics-get-started-terraform + + +## Example usage + +### Deployment of ODF Storage Configuration and Assignment + +The default input.tfvars is given below, the user should just change the value of the parameters in accorandance to their requirment. + +```hcl +# Common for both storage configuration and assignment +ibmcloud_api_key = "" +location = "" #Location of your storage configuration and assignment +configName = "" #Name of your storage configuration +region = "" + + +#ODF Storage Configuration +storageTemplateName = "odf-local" +storageTemplateVersion = "4.13" + +## User Parameters +autoDiscoverDevices = "true" +osdDevicePaths = "" +billingType = "advanced" +clusterEncryption = "false" +kmsBaseUrl = null +kmsEncryption = "false" +kmsInstanceId = null +kmsInstanceName = null +kmsTokenUrl = null +ibmCosEndpoint = null +ibmCosLocation = null +ignoreNoobaa = false +numOfOsd = "1" +ocsUpgrade = "false" +workerNodes = null +encryptionInTransit = false +disableNoobaaLB = false +performCleanup = false + +## Secret Parameters +ibmCosAccessKey = null +ibmCosSecretKey = null +iamAPIKey = "" #Required +kmsApiKey = null +kmsRootKey = null + +#ODF Storage Assignment +assignmentName = "" +cluster = "" +updateConfigRevision = false + +## NOTE ## +# The following variables will cause issues to your storage assignment lifecycle, so please use only with a storage configuration resource. +deleteAssignments = false +updateAssignments = false +``` + +Please note with this deployment the storage configuration and it's respective storage assignment is created to your specific satellite cluster in this example, if you'd like more control over the resources you can split it up into different files. + +### Scale-Up of ODF + +The following variables in the `input.tfvars` file can be edited + +* numOfOsd - To scale your storage +* workerNodes - To increase the number of Worker Nodes with ODF + +```hcl +numOfOsd = "1" -> "2" +workerNodes = null -> "worker_1_ID,worker_2_ID" +updateConfigRevision = true +``` +In this example we set the `updateConfigRevision` parameter to true in order to update our storage assignment with the latest configuration revision i.e the OcsCluster CRD is updated with the latest changes. + +You could also use `updateAssignments` to directly update the storage configuration's assignments, but if you have a dependent `storage_assignment` resource, it's lifecycle will be affected. It it recommended to use this parameter when you've only defined the `storage_configuration` resource. + +### Upgrade of ODF + +The following variables in the `input.tfvars` file should be changed in order to upgrade the ODF add-on and the Ocscluster CRD. + +* storageTemplateVersion - Specify the version you wish to upgrade to +* ocsUpgrade - Must be set to `true` to upgrade the CRD + +```hcl +# For ODF add-on upgrade +storageTemplateVersion = "4.13" -> "4.14" +ocsUpgrade = "false" -> "true" +``` + +Note this operation deletes the existing configuration and it's respective assignments, updates it to the next version and reassigns back to the previous clusters/groups. If used with a dependent assignment resource, it's lifecycle will be affected. It is recommended to perform this scenario when you've only defined the `storage_configuration` resource. + +## Examples + +* [ ODF Deployment & Management ](https://cloud.ibm.com/docs/satellite?topic=satellite-storage-odf-local&interface=ui) + + + +## Requirements + +| Name | Version | +|------|---------| +| terraform | ~> 0.14.8 | + +## Providers + +| Name | Version | +|------|---------| +| ibm | latest | + +## Inputs + +| Name | Description | Type | Required | Default +|------|-------------|------|----------|--------| +| ibmcloud_api_key | IBM Cloud API Key | `string` | yes | - +| cluster | Name of the cluster. | `string` | yes | - +| region | Region of the cluster | `string` | yes | - +| storageTemplateVersion | Version of the Storage Template (odf-local) | `string` | yes | - +| storageTemplateName | Name of the Storage Template (odf-local)| `string` | yes | - +| numOfOsd | The Number of OSD | `string` | yes | 1 +| autoDiscoverDevices | Set to true if automatically discovering local disks | `string` | no | true +| billingType | Set to true if automatically discovering local disks | `string` | no | advanced +| performCleanup |Set to true if you want to perform complete cleanup of ODF on assignment deletion. | `bool` | yes | false +| clusterEncryption | To enable at-rest encryption of all disks in the storage cluster | `string` | no | false +| iamApiKey | Your IAM API key. | `string` | true | - +| kmsEncryption | Set to true to enable HPCS Encryption | `string` | yes | false +| kmsBaseUrl | The HPCS Base URL | `string` | no | null +| kmsInstanceId | The HPCS Service ID | `string` | no | null +| kmsSecretName | The HPCS secret name | `string` | no | null +| kmsInstanceName | The HPCS service name | `string` | no | null +| kmsTokenUrl | The HPCS Token URL | `string` | no | null +| ignoreNoobaa | Set to true if you do not want MultiCloudGateway | `bool` | no | false +| ocsUpgrade | Set to true to upgrade Ocscluster | `string` | no | false +| osdDevicePaths | IDs of the disks to be used for OSD pods if using local disks or standard classic cluster | `string` | no | null +| workerNodes | Provide the names of the worker nodes on which to install ODF. Leave blank to install ODF on all worker nodes | `string` | no | null +| encryptionInTransit |To enable in-transit encryption. Enabling in-transit encryption does not affect the existing mapped or mounted volumes. After a volume is mapped/mounted, it retains the encryption settings that were used when it was initially mounted. To change the encryption settings for existing volumes, they must be remounted again one-by-one. | `bool` | no | false +| disableNoobaaLB | Specify true to disable to NooBaa public load balancer. | `bool` | no | false + +Refer - https://cloud.ibm.com/docs/satellite?topic=satellite-storage-odf-local&interface=ui#odf-local-4.13-parameters + +## Note + +* Users should only change the values of the variables within quotes, variables should be left untouched with the default values if they are not set. +* `workerNodes` takes a string containing comma separated values of the names of the worker nodes you wish to enable ODF on. +* During ODF Storage Template Update, it is recommended to delete all terraform related assignments before handed, as their lifecycle will be affected, during update new storage assignments are made back internally with new UUIDs. diff --git a/examples/openshift-data-foundation/satellite/odf-local/4.13/input.tfvars b/examples/openshift-data-foundation/satellite/odf-local/4.13/input.tfvars new file mode 100644 index 00000000..31e5668c --- /dev/null +++ b/examples/openshift-data-foundation/satellite/odf-local/4.13/input.tfvars @@ -0,0 +1,53 @@ +## DEFAULT VALUES ARE SET ## +## Please change according to your configuratiom ## + + +# Common for both storage configuration and assignment +ibmcloud_api_key = "" +location = "" #Location of your storage configuration and assignment +configName = "" #Name of your storage configuration +region = "" + + +#ODF Storage Configuration + +storageTemplateName = "odf-local" +storageTemplateVersion = "4.13" + +## User Parameters + +autoDiscoverDevices = "true" +osdDevicePaths = "" +billingType = "advanced" +clusterEncryption = "false" +kmsBaseUrl = null +kmsEncryption = "false" +kmsInstanceId = null +kmsInstanceName = null +kmsTokenUrl = null +ibmCosEndpoint = null +ibmCosLocation = null +ignoreNoobaa = false +numOfOsd = "1" +ocsUpgrade = "false" +workerNodes = null +encryptionInTransit = false +disableNoobaaLB = false +performCleanup = false + +## Secret Parameters +ibmCosAccessKey = null +ibmCosSecretKey = null +iamAPIKey = "" #Required +kmsApiKey = null +kmsRootKey = null + +#ODF Storage Assignment +assignmentName = "" +cluster = "" +updateConfigRevision = false + +## NOTE ## +# The following variables will cause issues to your storage assignment lifecycle, so please use only with a storage configuration resource. +deleteAssignments = false +updateAssignments = false \ No newline at end of file diff --git a/examples/openshift-data-foundation/satellite/odf-local/4.13/main.tf b/examples/openshift-data-foundation/satellite/odf-local/4.13/main.tf new file mode 100644 index 00000000..1038eaec --- /dev/null +++ b/examples/openshift-data-foundation/satellite/odf-local/4.13/main.tf @@ -0,0 +1,57 @@ +terraform { + required_providers { + ibm = { + source = "IBM-Cloud/ibm" + version = ">= 1.56.0" + } + } +} + +provider "ibm" { + ibmcloud_api_key = var.ibmcloud_api_key + region = var.region +} + +resource "ibm_satellite_storage_configuration" "storage_configuration" { + location = var.location + config_name = var.configName + storage_template_name = var.storageTemplateName + storage_template_version = var.storageTemplateVersion + user_config_parameters = { + "auto-discover-devices" = var.autoDiscoverDevices, + "num-of-osd" = var.numOfOsd, + "osd-device-path" = var.osdDevicePaths, + "billing-type" = var.billingType, + "cluster-encryption" = var.clusterEncryption, + "ibm-cos-endpoint"= var.ibmCosEndpoint, + "ibm-cos-location"= var.ibmCosLocation, + "ignore-noobaa"= var.ignoreNoobaa, + "kms-base-url"= var.kmsBaseUrl, + "kms-encryption"= var.kmsEncryption, + "kms-instance-id"= var.kmsInstanceId, + "kms-instance-name"= var.kmsInstanceName, + "kms-token-url"= var.kmsTokenUrl, + "odf-upgrade"= var.ocsUpgrade, + "perform-cleanup"= var.performCleanup, + "disable-noobaa-LB"= var.disableNoobaaLB, + "encryption-intransit"= var.encryptionInTransit, + "worker-nodes"= var.workerNodes + } + user_secret_parameters = { + "iam-api-key"= var.iamAPIKey, + "ibm-cos-access-key" = var.ibmCosAccessKey, + "kms-root-key" = var.kmsRootKey, + "kms-api-key" = var.kmsApiKey + } + delete_assignments = var.deleteAssignments + update_assignments = var.updateAssignments +} + +resource "ibm_satellite_storage_assignment" "storage_assignment" { + assignment_name = var.assignmentName + cluster = var.cluster + controller = var.location + config = var.configName + depends_on = [ibm_satellite_storage_configuration.storage_configuration] + update_config_revision = var.updateConfigRevision +} diff --git a/examples/openshift-data-foundation/satellite/odf-local/4.13/variables.tf b/examples/openshift-data-foundation/satellite/odf-local/4.13/variables.tf new file mode 100644 index 00000000..f9794a34 --- /dev/null +++ b/examples/openshift-data-foundation/satellite/odf-local/4.13/variables.tf @@ -0,0 +1,221 @@ +variable "ibmcloud_api_key" { + type = string + description = "IBM Cloud API Key" +} + +variable "iamAPIKey" { + type = string + description = "Your IBM Cloud API Key" +} + +variable "location" { + type = string + description = "The satellite location where you want to create your configuration" +} + +variable "configName" { + type = string + description = "The name of your storage configuration" +} + +variable "storageTemplateName" { + type = string + description = "The storage template for your configuration." +} + +variable "storageTemplateVersion" { + type = string + description = "The version of the storage template." +} + +variable "region" { + type = string + description = "Enter Satellite Location Region" +} + +variable "odfVersion" { + type = string + default = "4.13.0" + description = "Provide the ODF Version you wish to install on your cluster" +} + +variable "numOfOsd" { +type = string +default = "1" +description = "Number of Osd" +} + +variable "osdDevicePaths" { +type = string +description = "IDs of the disks to be used for OSD pods if using local disks or standard classic cluster" +default = null +} + +variable "ocsUpgrade" { + type = string + default = "false" + description = "Set to true to upgrade Ocscluster" + +} + +variable "clusterEncryption" { + type = string + default = "false" + description = "Enable at-rest encryption of all disks in the storage cluster." +} + + +variable "billingType" { + type = string + default = "advanced" + description = "Choose between advanced and essentials" +} + +variable "ignoreNoobaa" { + type = bool + default = false + description = "Set to true if you do not want MultiCloudGateway" +} + +variable "performCleanup" { + type = bool + default = false + description = "Set to true if you want to perform cleanup during assignment deletion" +} + +variable "ibmCosEndpoint" { + type = string + default = null + description = "The IBM COS regional public endpoint" +} + +variable "ibmCosLocation" { + type = string + default = null + description = "The location constraint that you want to use when creating your bucket. For example us-east-standard." +} + +variable "ibmCosSecretKey" { + type = string + default = null + description = "Your IBM COS HMAC secret access key." +} + +variable "ibmCosAccessKey" { + type = string + default = null + description = "Your IBM COS HMAC access key ID." +} + +variable "kmsApiKey" { + type = string + default = null + description = "IAM API key to access the KMS instance. The API key that you provide must have at least Viewer access to the KMS instance." +} + +variable "kmsRootKey" { + type = string + default = null + description = "KMS root key of your instance." +} + +variable "osdSize" { + type = string + default = "250Gi" + description = "Enter the size for the storage devices that you want to provision for the Object Storage Daemon (OSD) pods." +} + +variable "osdStorageClassName" { + type = string + default = "ibmc-vpc-block-metro-10iops-tier" + description = "Enter the storage class to be used to provision block volumes for Object Storage Daemon (OSD) pods." + +} + +variable "autoDiscoverDevices" { + type = string + default = "false" + description = "Set to true if automatically discovering local disks" +} + +variable "kmsEncryption" { + type = string + default = "false" + description = "Set to true to enable HPCS Encryption" +} + +variable "kmsInstanceName" { + type = string + default = null + description = "Please provide HPCS service name" +} + +variable "kmsSecretName" { + type = string + default = null + description = "Please provide the HPCS secret name" +} + +variable "workerNodes" { + type = string + default = null + description = "Provide the names of the worker nodes on which to install ODF. Leave blank to install ODF on all worker nodes." +} + +variable "kmsInstanceId" { + type = string + default = null + description = "Please provide HPCS Service ID" +} + +variable "kmsBaseUrl" { + type = string + default = null + description = "Please provide HPCS Base URL" +} + +variable "kmsTokenUrl" { + type = string + default = null + description = "Please provide HPCS token URL" +} + +variable "encryptionInTransit" { + type = bool + default = false + description = "Enter true to enable in-transit encryption. Enabling in-transit encryption does not affect the existing mapped or mounted volumes. After a volume is mapped/mounted, it retains the encryption settings that were used when it was initially mounted. To change the encryption settings for existing volumes, they must be remounted again one-by-one." +} + +variable "disableNoobaaLB" { + type = bool + default = false + description = "Specify true to disable to NooBaa public load balancer." +} + +variable "cluster" { + type = string + description = "Cluster ID or Name you wish to assign your configuration to." +} + +variable "assignmentName" { + type = string + description = "Name of your storage assignment to a cluster" +} + +variable "updateConfigRevision" { + type = bool + default = false + description = "Set to true if you want to update the assignment with the latest configuration revision" +} + +variable "deleteAssignments" { + type = bool + default = false + description = "Set to true if you want to delete all the assignments of the configuration, during storage configuration destroy" +} + +variable "updateAssignments" { + type = bool + default = false + description = "Set to true if you want to update all the configuration's assignments with the latest revision" +} diff --git a/examples/openshift-data-foundation/satellite/odf-local/4.14/README.md b/examples/openshift-data-foundation/satellite/odf-local/4.14/README.md new file mode 100644 index 00000000..94485d60 --- /dev/null +++ b/examples/openshift-data-foundation/satellite/odf-local/4.14/README.md @@ -0,0 +1,183 @@ +# Openshift Data Foundation - Local Deployment + +This example shows how to deploy and manage the Openshift Data Foundation (ODF) on IBM Cloud Satellite based RedHat Openshift cluster. + +This sample configuration will deploy the ODF, scale and upgrade it using the "ibm_satellite_storage_configuration" and "ibm_satellite_storage_assignment" resources from the ibm terraform provider. + +For more information, about + +* ODF Deployment & Management on Satellite, see [OpenShift Data Foundation for local devices](https://cloud.ibm.com/docs/satellite?topic=satellite-storage-odf-local&interface=ui) + +## Usage + +### Option 1 - Command Line Interface + +To run this example on your Terminal, first download this directory i.e `examples/openshift-data-foundation/` + +```bash +$ cd satellite +``` + +```bash +$ terraform init +$ terraform plan --var-file input.tfvars +$ terraform apply --var-file input.tfvars +``` + +Run `terraform destroy --var-file input.tfvars` when you don't need these resources. + +### Option 2 - IBM Cloud Schematics + +To Deploy & Manage the Openshift-Data-Foundation add-on using `IBM Cloud Schematics` please follow the below documentation + +https://cloud.ibm.com/docs/schematics?topic=schematics-get-started-terraform + + +## Example usage + +### Deployment of ODF Storage Configuration and Assignment + +The default input.tfvars is given below, the user should just change the value of the parameters in accorandance to their requirment. + +```hcl +# Common for both storage configuration and assignment +ibmcloud_api_key = "" +location = "" #Location of your storage configuration and assignment +configName = "" #Name of your storage configuration +region = "" + + +#ODF Storage Configuration +storageTemplateName = "odf-local" +storageTemplateVersion = "4.14" + +## User Parameters +autoDiscoverDevices = "true" +osdDevicePaths = "" +billingType = "advanced" +clusterEncryption = "false" +kmsBaseUrl = null +kmsEncryption = "false" +kmsInstanceId = null +kmsInstanceName = null +kmsTokenUrl = null +ibmCosEndpoint = null +ibmCosLocation = null +ignoreNoobaa = false +numOfOsd = "1" +ocsUpgrade = "false" +workerNodes = null +encryptionInTransit = false +disableNoobaaLB = false +performCleanup = false +taintNodes = false +addSingleReplicaPool = false +prepareForDisasterRecovery = false + +## Secret Parameters +ibmCosAccessKey = null +ibmCosSecretKey = null +iamAPIKey = "" #Required +kmsApiKey = null +kmsRootKey = null + +#ODF Storage Assignment +assignmentName = "" +cluster = "" +updateConfigRevision = false + +## NOTE ## +# The following variables will cause issues to your storage assignment lifecycle, so please use only with a storage configuration resource. +deleteAssignments = false +updateAssignments = false +``` + +Please note with this deployment the storage configuration and it's respective storage assignment is created to your specific satellite cluster in this example, if you'd like more control over the resources you can split it up into different files. + +### Scale-Up of ODF + +The following variables in the `input.tfvars` file can be edited + +* numOfOsd - To scale your storage +* workerNodes - To increase the number of Worker Nodes with ODF + +```hcl +numOfOsd = "1" -> "2" +workerNodes = null -> "worker_1_ID,worker_2_ID" +updateConfigRevision = true +``` +In this example we set the `updateConfigRevision` parameter to true in order to update our storage assignment with the latest configuration revision i.e the OcsCluster CRD is updated with the latest changes. + +You could also use `updateAssignments` to directly update the storage configuration's assignments, but if you have a dependent `storage_assignment` resource, it's lifecycle will be affected. It it recommended to use this parameter when you've only defined the `storage_configuration` resource. + +### Upgrade of ODF + +The following variables in the `input.tfvars` file should be changed in order to upgrade the ODF add-on and the Ocscluster CRD. + +* storageTemplateVersion - Specify the version you wish to upgrade to +* ocsUpgrade - Must be set to `true` to upgrade the CRD + +```hcl +# For ODF add-on upgrade +storageTemplateVersion = "4.14" -> "4.15" +ocsUpgrade = "false" -> "true" +``` + +Note this operation deletes the existing configuration and it's respective assignments, updates it to the next version and reassigns back to the previous clusters/groups. If used with a dependent assignment resource, it's lifecycle will be affected. It is recommended to perform this scenario when you've only defined the `storage_configuration` resource. + +## Examples + +* [ ODF Deployment & Management ](https://cloud.ibm.com/docs/satellite?topic=satellite-storage-odf-local&interface=ui) + + + +## Requirements + +| Name | Version | +|------|---------| +| terraform | ~> 0.14.8 | + +## Providers + +| Name | Version | +|------|---------| +| ibm | latest | + +## Inputs + +| Name | Description | Type | Required | Default +|------|-------------|------|----------|--------| +| ibmcloud_api_key | IBM Cloud API Key | `string` | yes | - +| cluster | Name of the cluster. | `string` | yes | - +| region | Region of the cluster | `string` | yes | - +| storageTemplateVersion | Version of the Storage Template (odf-local) | `string` | yes | - +| storageTemplateName | Name of the Storage Template (odf-local)| `string` | yes | - +| numOfOsd | The Number of OSD | `string` | yes | 1 +| autoDiscoverDevices | Set to true if automatically discovering local disks | `string` | no | true +| billingType | Set to true if automatically discovering local disks | `string` | no | advanced +| performCleanup |Set to true if you want to perform complete cleanup of ODF on assignment deletion. | `bool` | yes | false +| clusterEncryption | To enable at-rest encryption of all disks in the storage cluster | `string` | no | false +| iamApiKey | Your IAM API key. | `string` | true | - +| kmsEncryption | Set to true to enable HPCS Encryption | `string` | yes | false +| kmsBaseUrl | The HPCS Base URL | `string` | no | null +| kmsInstanceId | The HPCS Service ID | `string` | no | null +| kmsSecretName | The HPCS secret name | `string` | no | null +| kmsInstanceName | The HPCS service name | `string` | no | null +| kmsTokenUrl | The HPCS Token URL | `string` | no | null +| ignoreNoobaa | Set to true if you do not want MultiCloudGateway | `bool` | no | false +| ocsUpgrade | Set to true to upgrade Ocscluster | `string` | no | false +| osdDevicePaths | IDs of the disks to be used for OSD pods if using local disks or standard classic cluster | `string` | no | null +| workerNodes | Provide the names of the worker nodes on which to install ODF. Leave blank to install ODF on all worker nodes | `string` | no | null +| encryptionInTransit |To enable in-transit encryption. Enabling in-transit encryption does not affect the existing mapped or mounted volumes. After a volume is mapped/mounted, it retains the encryption settings that were used when it was initially mounted. To change the encryption settings for existing volumes, they must be remounted again one-by-one. | `bool` | no | false +| taintNodes | Specify true to taint the selected worker nodes so that only OpenShift Data Foundation pods can run on those nodes. Use this option only if you limit ODF to a subset of nodes in your cluster. | `bool` | no | false +| addSingleReplicaPool | Specify true to create a single replica pool without data replication, increasing the risk of data loss, data corruption, and potential system instability. | `bool` | no | false +| prepareForDisasterRecovery | Specify true to set up the storage system for disaster recovery service with the essential configurations in place. This allows seamless implementation of disaster recovery strategies for your workloads | `bool` | no | false +| disableNoobaaLB | Specify true to disable to NooBaa public load balancer. | `bool` | no | false + +Refer - https://cloud.ibm.com/docs/satellite?topic=satellite-storage-odf-local&interface=ui#odf-local-4.14-parameters + +## Note + +* Users should only change the values of the variables within quotes, variables should be left untouched with the default values if they are not set. +* `workerNodes` takes a string containing comma separated values of the names of the worker nodes you wish to enable ODF on. +* During ODF Storage Template Update, it is recommended to delete all terraform related assignments before handed, as their lifecycle will be affected, during update new storage assignments are made back internally with new UUIDs. diff --git a/examples/openshift-data-foundation/satellite/odf-local/4.14/input.tfvars b/examples/openshift-data-foundation/satellite/odf-local/4.14/input.tfvars new file mode 100644 index 00000000..1b94fe8c --- /dev/null +++ b/examples/openshift-data-foundation/satellite/odf-local/4.14/input.tfvars @@ -0,0 +1,56 @@ +## DEFAULT VALUES ARE SET ## +## Please change according to your configuratiom ## + + +# Common for both storage configuration and assignment +ibmcloud_api_key = "" +location = "" #Location of your storage configuration and assignment +configName = "" #Name of your storage configuration +region = "" + + +#ODF Storage Configuration + +storageTemplateName = "odf-local" +storageTemplateVersion = "4.14" + +## User Parameters + +autoDiscoverDevices = "true" +osdDevicePaths = "" +billingType = "advanced" +clusterEncryption = "false" +kmsBaseUrl = null +kmsEncryption = "false" +kmsInstanceId = null +kmsInstanceName = null +kmsTokenUrl = null +ibmCosEndpoint = null +ibmCosLocation = null +ignoreNoobaa = false +numOfOsd = "1" +ocsUpgrade = "false" +workerNodes = null +encryptionInTransit = false +disableNoobaaLB = false +performCleanup = false +taintNodes = false +addSingleReplicaPool = false +prepareForDisasterRecovery = false + +## Secret Parameters +ibmCosAccessKey = null +ibmCosSecretKey = null +iamAPIKey = "" #Required +kmsApiKey = null +kmsRootKey = null + +#ODF Storage Assignment +assignmentName = "" +cluster = "" +updateConfigRevision = false + +## NOTE ## +# The following variables will cause issues to your storage assignment lifecycle, so please use only with a storage configuration resource. +deleteAssignments = false +updateAssignments = false \ No newline at end of file diff --git a/examples/openshift-data-foundation/satellite/odf-local/4.14/main.tf b/examples/openshift-data-foundation/satellite/odf-local/4.14/main.tf new file mode 100644 index 00000000..0c428125 --- /dev/null +++ b/examples/openshift-data-foundation/satellite/odf-local/4.14/main.tf @@ -0,0 +1,60 @@ +terraform { + required_providers { + ibm = { + source = "IBM-Cloud/ibm" + version = ">= 1.56.0" + } + } +} + +provider "ibm" { + ibmcloud_api_key = var.ibmcloud_api_key + region = var.region +} + +resource "ibm_satellite_storage_configuration" "storage_configuration" { + location = var.location + config_name = var.configName + storage_template_name = var.storageTemplateName + storage_template_version = var.storageTemplateVersion + user_config_parameters = { + "auto-discover-devices" = var.autoDiscoverDevices, + "num-of-osd" = var.numOfOsd, + "osd-device-path" = var.osdDevicePaths, + "billing-type" = var.billingType, + "cluster-encryption" = var.clusterEncryption, + "ibm-cos-endpoint"= var.ibmCosEndpoint, + "ibm-cos-location"= var.ibmCosLocation, + "ignore-noobaa"= var.ignoreNoobaa, + "kms-base-url"= var.kmsBaseUrl, + "kms-encryption"= var.kmsEncryption, + "kms-instance-id"= var.kmsInstanceId, + "kms-instance-name"= var.kmsInstanceName, + "kms-token-url"= var.kmsTokenUrl, + "odf-upgrade"= var.ocsUpgrade, + "perform-cleanup"= var.performCleanup, + "disable-noobaa-LB"= var.disableNoobaaLB, + "encryption-intransit"= var.encryptionInTransit, + "worker-nodes"= var.workerNodes, + "add-single-replica-pool" = var.addSingleReplicaPool, + "taint-nodes" = var.taintNodes, + "prepare-for-disaster-recovery" = var.prepareForDisasterRecovery + } + user_secret_parameters = { + "iam-api-key"= var.iamAPIKey, + "ibm-cos-access-key" = var.ibmCosAccessKey, + "kms-root-key" = var.kmsRootKey, + "kms-api-key" = var.kmsApiKey + } + delete_assignments = var.deleteAssignments + update_assignments = var.updateAssignments +} + +resource "ibm_satellite_storage_assignment" "storage_assignment" { + assignment_name = var.assignmentName + cluster = var.cluster + controller = var.location + config = var.configName + depends_on = [ibm_satellite_storage_configuration.storage_configuration] + update_config_revision = var.updateConfigRevision +} diff --git a/examples/openshift-data-foundation/satellite/odf-local/4.14/variables.tf b/examples/openshift-data-foundation/satellite/odf-local/4.14/variables.tf new file mode 100644 index 00000000..016e74bf --- /dev/null +++ b/examples/openshift-data-foundation/satellite/odf-local/4.14/variables.tf @@ -0,0 +1,239 @@ +variable "ibmcloud_api_key" { + type = string + description = "IBM Cloud API Key" +} + +variable "iamAPIKey" { + type = string + description = "Your IBM Cloud API Key" +} + +variable "location" { + type = string + description = "The satellite location where you want to create your configuration" +} + +variable "configName" { + type = string + description = "The name of your storage configuration" +} + +variable "storageTemplateName" { + type = string + description = "The storage template for your configuration." +} + +variable "storageTemplateVersion" { + type = string + description = "The version of the storage template." +} + +variable "region" { + type = string + description = "Enter Satellite Location Region" +} + +variable "odfVersion" { + type = string + default = "4.13.0" + description = "Provide the ODF Version you wish to install on your cluster" +} + +variable "numOfOsd" { +type = string +default = "1" +description = "Number of Osd" +} + +variable "osdDevicePaths" { +type = string +description = "IDs of the disks to be used for OSD pods if using local disks or standard classic cluster" +default = null +} + +variable "ocsUpgrade" { + type = string + default = "false" + description = "Set to true to upgrade Ocscluster" + +} + +variable "clusterEncryption" { + type = string + default = "false" + description = "Enable at-rest encryption of all disks in the storage cluster." +} + + +variable "billingType" { + type = string + default = "advanced" + description = "Choose between advanced and essentials" +} + +variable "ignoreNoobaa" { + type = bool + default = false + description = "Set to true if you do not want MultiCloudGateway" +} + +variable "performCleanup" { + type = bool + default = false + description = "Set to true if you want to perform cleanup during assignment deletion" +} + +variable "ibmCosEndpoint" { + type = string + default = null + description = "The IBM COS regional public endpoint" +} + +variable "ibmCosLocation" { + type = string + default = null + description = "The location constraint that you want to use when creating your bucket. For example us-east-standard." +} + +variable "ibmCosSecretKey" { + type = string + default = null + description = "Your IBM COS HMAC secret access key." +} + +variable "ibmCosAccessKey" { + type = string + default = null + description = "Your IBM COS HMAC access key ID." +} + +variable "kmsApiKey" { + type = string + default = null + description = "IAM API key to access the KMS instance. The API key that you provide must have at least Viewer access to the KMS instance." +} + +variable "kmsRootKey" { + type = string + default = null + description = "KMS root key of your instance." +} + +variable "osdSize" { + type = string + default = "250Gi" + description = "Enter the size for the storage devices that you want to provision for the Object Storage Daemon (OSD) pods." +} + +variable "osdStorageClassName" { + type = string + default = "ibmc-vpc-block-metro-10iops-tier" + description = "Enter the storage class to be used to provision block volumes for Object Storage Daemon (OSD) pods." + +} + +variable "autoDiscoverDevices" { + type = string + default = "false" + description = "Set to true if automatically discovering local disks" +} + +variable "kmsEncryption" { + type = string + default = "false" + description = "Set to true to enable HPCS Encryption" +} + +variable "kmsInstanceName" { + type = string + default = null + description = "Please provide HPCS service name" +} + +variable "kmsSecretName" { + type = string + default = null + description = "Please provide the HPCS secret name" +} + +variable "workerNodes" { + type = string + default = null + description = "Provide the names of the worker nodes on which to install ODF. Leave blank to install ODF on all worker nodes." +} + +variable "kmsInstanceId" { + type = string + default = null + description = "Please provide HPCS Service ID" +} + +variable "kmsBaseUrl" { + type = string + default = null + description = "Please provide HPCS Base URL" +} + +variable "kmsTokenUrl" { + type = string + default = null + description = "Please provide HPCS token URL" +} + +variable "encryptionInTransit" { + type = bool + default = false + description = "Enter true to enable in-transit encryption. Enabling in-transit encryption does not affect the existing mapped or mounted volumes. After a volume is mapped/mounted, it retains the encryption settings that were used when it was initially mounted. To change the encryption settings for existing volumes, they must be remounted again one-by-one." +} + +variable "disableNoobaaLB" { + type = bool + default = false + description = "Specify true to disable to NooBaa public load balancer." +} + +variable "cluster" { + type = string + description = "Cluster ID or Name you wish to assign your configuration to." +} + +variable "assignmentName" { + type = string + description = "Name of your storage assignment to a cluster" +} + +variable "updateConfigRevision" { + type = bool + default = false + description = "Set to true if you want to update the assignment with the latest configuration revision" +} + +variable "deleteAssignments" { + type = bool + default = false + description = "Set to true if you want to delete all the assignments of the configuration, during storage configuration destroy" +} + +variable "updateAssignments" { + type = bool + default = false + description = "Set to true if you want to update all the configuration's assignments with the latest revision" +} + +variable "taintNodes" { + type = bool + default = false + description = "Specify true to taint the selected worker nodes so that only OpenShift Data Foundation pods can run on those nodes. Use this option only if you limit ODF to a subset of nodes in your cluster." +} + +variable "addSingleReplicaPool" { + type = bool + default = false + description = "Specify true to create a single replica pool without data replication, increasing the risk of data loss, data corruption, and potential system instability." +} + +variable "prepareForDisasterRecovery" { + type = bool + default = false + description = "Specify true to set up the storage system for disaster recovery service with the essential configurations in place. This allows seamless implementation of disaster recovery strategies for your workloads." +} \ No newline at end of file diff --git a/examples/openshift-data-foundation/satellite/odf-remote/4.13/README.md b/examples/openshift-data-foundation/satellite/odf-remote/4.13/README.md new file mode 100644 index 00000000..602b9327 --- /dev/null +++ b/examples/openshift-data-foundation/satellite/odf-remote/4.13/README.md @@ -0,0 +1,177 @@ +# Openshift Data Foundation - Remote Deployment + +This example shows how to deploy and manage the Openshift Data Foundation (ODF) on IBM Cloud Satellite based RedHat Openshift cluster. + +This sample configuration will deploy the ODF, scale and upgrade it using the "ibm_satellite_storage_configuration" and "ibm_satellite_storage_assignment" resources from the ibm terraform provider. + +For more information, about + +* ODF Deployment & Management on Satellite, see [OpenShift Data Foundation for remote devices](https://cloud.ibm.com/docs/satellite?topic=satellite-storage-odf-remote&interface=ui) + +## Usage + +### Option 1 - Command Line Interface + +To run this example on your Terminal, first download this directory i.e `examples/openshift-data-foundation/` + +```bash +$ cd satellite +``` + +```bash +$ terraform init +$ terraform plan --var-file input.tfvars +$ terraform apply --var-file input.tfvars +``` + +Run `terraform destroy --var-file input.tfvars` when you don't need these resources. + +### Option 2 - IBM Cloud Schematics + +To Deploy & Manage the Openshift-Data-Foundation add-on using `IBM Cloud Schematics` please follow the below documentation + +https://cloud.ibm.com/docs/schematics?topic=schematics-get-started-terraform + + +## Example usage + +### Deployment of ODF Storage Configuration and Assignment + +The default input.tfvars is given below, the user should just change the value of the parameters in accorandance to their requirment. + +```hcl +# Common for both storage configuration and assignment +ibmcloud_api_key = "" +location = "" #Location of your storage configuration and assignment +configName = "" #Name of your storage configuration +region = "" + + +#ODF Storage Configuration +storageTemplateName = "odf-remote" +storageTemplateVersion = "4.13" + +## User Parameters +billingType = "advanced" +clusterEncryption = "false" +kmsBaseUrl = null +kmsEncryption = "false" +kmsInstanceId = null +kmsInstanceName = null +kmsTokenUrl = null +ibmCosEndpoint = null +ibmCosLocation = null +ignoreNoobaa = false +numOfOsd = "1" +ocsUpgrade = "false" +osdSize = "512Gi" +osdStorageClassName = "ibmc-vpc-block-metro-5iops-tier" +workerNodes = null +encryptionInTransit = false +disableNoobaaLB = false +performCleanup = false + +## Secret Parameters +ibmCosAccessKey = null +ibmCosSecretKey = null +iamAPIKey = "" #Required +kmsApiKey = null +kmsRootKey = null + +#ODF Storage Assignment +assignmentName = "" +cluster = "" +updateConfigRevision = false + +## NOTE ## +# The following variables will cause issues to your storage assignment lifecycle, so please use only with a storage configuration resource. +deleteAssignments = false +updateAssignments = false +``` + +Please note with this deployment the storage configuration and it's respective storage assignment is created to your specific satellite cluster in this example, if you'd like more control over the resources you can split it up into different files. + +### Scale-Up of ODF + +The following variables in the `input.tfvars` file can be edited + +* numOfOsd - To scale your storage +* workerNodes - To increase the number of Worker Nodes with ODF + +```hcl +numOfOsd = "1" -> "2" +workerNodes = null -> "worker_1_ID,worker_2_ID" +updateConfigRevision = true +``` +In this example we set the `updateConfigRevision` parameter to true in order to update our storage assignment with the latest configuration revision i.e the OcsCluster CRD is updated with the latest changes. + +You could also use `updateAssignments` to directly update the storage configuration's assignments, but if you have a dependent `storage_assignment` resource, it's lifecycle will be affected. It it recommended to use this parameter when you've only defined the `storage_configuration` resource. + +### Upgrade of ODF + +The following variables in the `input.tfvars` file should be changed in order to upgrade the ODF add-on and the Ocscluster CRD. + +* storageTemplateVersion - Specify the version you wish to upgrade to +* ocsUpgrade - Must be set to `true` to upgrade the CRD + +```hcl +# For ODF add-on upgrade +storageTemplateVersion = "4.13" -> "4.14" +ocsUpgrade = "false" -> "true" +``` + +Note this operation deletes the existing configuration and it's respective assignments, updates it to the next version and reassigns back to the previous clusters/groups. If used with a dependent assignment resource, it's lifecycle will be affected. It is recommended to perform this scenario when you've only defined the `storage_configuration` resource. + +## Examples + +* [ ODF Deployment & Management ](https://cloud.ibm.com/docs/satellite?topic=satellite-storage-odf-remote&interface=ui) + + + +## Requirements + +| Name | Version | +|------|---------| +| terraform | ~> 0.14.8 | + +## Providers + +| Name | Version | +|------|---------| +| ibm | latest | + +## Inputs + +| Name | Description | Type | Required | Default +|------|-------------|------|----------|--------| +| ibmcloud_api_key | IBM Cloud API Key | `string` | yes | - +| cluster | Name of the cluster. | `string` | yes | - +| region | Region of the cluster | `string` | yes | - +| storageTemplateVersion | Version of the Storage Template (odf-remote) | `string` | yes | - +| storageTemplateName | Name of the Storage Template (odf-remote)| `string` | yes | - +| osdSize | Enter the size for the storage devices that you want to provision for the Object Storage Daemon (OSD) pods | `string` | yes | 512Gi +| numOfOsd | The Number of OSD | `string` | yes | 1 +| osdStorageClassName | Enter the storage class to be used to provision block volumes for Object Storage Daemon (OSD) pods | `string` | yes | ibmc-vpc-block-metro-5iops-tier +| billingType | Set to true if automatically discovering local disks | `string` | no | advanced +| performCleanup |Set to true if you want to perform complete cleanup of ODF on assignment deletion. | `bool` | yes | false +| clusterEncryption | To enable at-rest encryption of all disks in the storage cluster | `string` | no | false +| iamApiKey | Your IAM API key. | `string` | true | - +| kmsEncryption | Set to true to enable HPCS Encryption | `string` | yes | false +| kmsBaseUrl | The HPCS Base URL | `string` | no | null +| kmsInstanceId | The HPCS Service ID | `string` | no | null +| kmsSecretName | The HPCS secret name | `string` | no | null +| kmsInstanceName | The HPCS service name | `string` | no | null +| kmsTokenUrl | The HPCS Token URL | `string` | no | null +| ignoreNoobaa | Set to true if you do not want MultiCloudGateway | `bool` | no | false +| ocsUpgrade | Set to true to upgrade Ocscluster | `string` | no | false +| workerNodes | Provide the names of the worker nodes on which to install ODF. Leave blank to install ODF on all worker nodes | `string` | no | null +| encryptionInTransit |To enable in-transit encryption. Enabling in-transit encryption does not affect the existing mapped or mounted volumes. After a volume is mapped/mounted, it retains the encryption settings that were used when it was initially mounted. To change the encryption settings for existing volumes, they must be remounted again one-by-one. | `bool` | no | false +| disableNoobaaLB | Specify true to disable to NooBaa public load balancer. | `bool` | no | false + +Refer - https://cloud.ibm.com/docs/satellite?topic=satellite-storage-odf-remote&interface=ui#odf-remote-4.13-parameters + +## Note + +* Users should only change the values of the variables within quotes, variables should be left untouched with the default values if they are not set. +* `workerNodes` takes a string containing comma separated values of the names of the worker nodes you wish to enable ODF on. +* During ODF Storage Template Update, it is recommended to delete all terraform related assignments before handed, as their lifecycle will be affected, during update new storage assignments are made back internally with new UUIDs. diff --git a/examples/openshift-data-foundation/satellite/odf-remote/4.13/input.tfvars b/examples/openshift-data-foundation/satellite/odf-remote/4.13/input.tfvars new file mode 100644 index 00000000..33a739de --- /dev/null +++ b/examples/openshift-data-foundation/satellite/odf-remote/4.13/input.tfvars @@ -0,0 +1,53 @@ +## DEFAULT VALUES ARE SET ## +## Please change according to your configuratiom ## + + +# Common for both storage configuration and assignment +ibmcloud_api_key = "" +location = "" #Location of your storage configuration and assignment +configName = "" #Name of your storage configuration +region = "" + + +#ODF Storage Configuration + +storageTemplateName = "odf-remote" +storageTemplateVersion = "4.13" + +## User Parameters + +billingType = "advanced" +clusterEncryption = "false" +kmsBaseUrl = null +kmsEncryption = "false" +kmsInstanceId = null +kmsInstanceName = null +kmsTokenUrl = null +ibmCosEndpoint = null +ibmCosLocation = null +ignoreNoobaa = false +numOfOsd = "1" +ocsUpgrade = "false" +osdSize = "512Gi" +osdStorageClassName = "ibmc-vpc-block-metro-5iops-tier" +workerNodes = null +encryptionInTransit = false +disableNoobaaLB = false +performCleanup = false + +## Secret Parameters +ibmCosAccessKey = null +ibmCosSecretKey = null +iamAPIKey = "" #Required +kmsApiKey = null +kmsRootKey = null + +#ODF Storage Assignment +assignmentName = "" +cluster = "" +updateConfigRevision = false + +## NOTE ## +# The following variables will cause issues to your storage assignment lifecycle, so please use only with a storage configuration resource. +deleteAssignments = false +updateAssignments = false \ No newline at end of file diff --git a/examples/openshift-data-foundation/satellite/odf-remote/4.13/main.tf b/examples/openshift-data-foundation/satellite/odf-remote/4.13/main.tf new file mode 100644 index 00000000..435a11cd --- /dev/null +++ b/examples/openshift-data-foundation/satellite/odf-remote/4.13/main.tf @@ -0,0 +1,57 @@ +terraform { + required_providers { + ibm = { + source = "IBM-Cloud/ibm" + version = ">= 1.56.0" + } + } +} + +provider "ibm" { + ibmcloud_api_key = var.ibmcloud_api_key + region = var.region +} + +resource "ibm_satellite_storage_configuration" "storage_configuration" { + location = var.location + config_name = var.configName + storage_template_name = var.storageTemplateName + storage_template_version = var.storageTemplateVersion + user_config_parameters = { + "osd-size" = var.osdSize, + "num-of-osd" = var.numOfOsd, + "osd-storage-class" = var.osdStorageClassName, + "billing-type" = var.billingType, + "cluster-encryption" = var.clusterEncryption, + "ibm-cos-endpoint"= var.ibmCosEndpoint, + "ibm-cos-location"= var.ibmCosLocation, + "ignore-noobaa"= var.ignoreNoobaa, + "kms-base-url"= var.kmsBaseUrl, + "kms-encryption"= var.kmsEncryption, + "kms-instance-id"= var.kmsInstanceId, + "kms-instance-name"= var.kmsInstanceName, + "kms-token-url"= var.kmsTokenUrl, + "odf-upgrade"= var.ocsUpgrade, + "perform-cleanup"= var.performCleanup, + "disable-noobaa-LB"= var.disableNoobaaLB, + "encryption-intransit"= var.encryptionInTransit, + "worker-nodes"= var.workerNodes + } + user_secret_parameters = { + "iam-api-key"= var.iamAPIKey, + "ibm-cos-access-key" = var.ibmCosAccessKey, + "kms-root-key" = var.kmsRootKey, + "kms-api-key" = var.kmsApiKey + } + delete_assignments = var.deleteAssignments + update_assignments = var.updateAssignments +} + +resource "ibm_satellite_storage_assignment" "storage_assignment" { + assignment_name = var.assignmentName + cluster = var.cluster + controller = var.location + config = var.configName + depends_on = [ibm_satellite_storage_configuration.storage_configuration] + update_config_revision = var.updateConfigRevision +} diff --git a/examples/openshift-data-foundation/satellite/odf-remote/4.13/variables.tf b/examples/openshift-data-foundation/satellite/odf-remote/4.13/variables.tf new file mode 100644 index 00000000..f9794a34 --- /dev/null +++ b/examples/openshift-data-foundation/satellite/odf-remote/4.13/variables.tf @@ -0,0 +1,221 @@ +variable "ibmcloud_api_key" { + type = string + description = "IBM Cloud API Key" +} + +variable "iamAPIKey" { + type = string + description = "Your IBM Cloud API Key" +} + +variable "location" { + type = string + description = "The satellite location where you want to create your configuration" +} + +variable "configName" { + type = string + description = "The name of your storage configuration" +} + +variable "storageTemplateName" { + type = string + description = "The storage template for your configuration." +} + +variable "storageTemplateVersion" { + type = string + description = "The version of the storage template." +} + +variable "region" { + type = string + description = "Enter Satellite Location Region" +} + +variable "odfVersion" { + type = string + default = "4.13.0" + description = "Provide the ODF Version you wish to install on your cluster" +} + +variable "numOfOsd" { +type = string +default = "1" +description = "Number of Osd" +} + +variable "osdDevicePaths" { +type = string +description = "IDs of the disks to be used for OSD pods if using local disks or standard classic cluster" +default = null +} + +variable "ocsUpgrade" { + type = string + default = "false" + description = "Set to true to upgrade Ocscluster" + +} + +variable "clusterEncryption" { + type = string + default = "false" + description = "Enable at-rest encryption of all disks in the storage cluster." +} + + +variable "billingType" { + type = string + default = "advanced" + description = "Choose between advanced and essentials" +} + +variable "ignoreNoobaa" { + type = bool + default = false + description = "Set to true if you do not want MultiCloudGateway" +} + +variable "performCleanup" { + type = bool + default = false + description = "Set to true if you want to perform cleanup during assignment deletion" +} + +variable "ibmCosEndpoint" { + type = string + default = null + description = "The IBM COS regional public endpoint" +} + +variable "ibmCosLocation" { + type = string + default = null + description = "The location constraint that you want to use when creating your bucket. For example us-east-standard." +} + +variable "ibmCosSecretKey" { + type = string + default = null + description = "Your IBM COS HMAC secret access key." +} + +variable "ibmCosAccessKey" { + type = string + default = null + description = "Your IBM COS HMAC access key ID." +} + +variable "kmsApiKey" { + type = string + default = null + description = "IAM API key to access the KMS instance. The API key that you provide must have at least Viewer access to the KMS instance." +} + +variable "kmsRootKey" { + type = string + default = null + description = "KMS root key of your instance." +} + +variable "osdSize" { + type = string + default = "250Gi" + description = "Enter the size for the storage devices that you want to provision for the Object Storage Daemon (OSD) pods." +} + +variable "osdStorageClassName" { + type = string + default = "ibmc-vpc-block-metro-10iops-tier" + description = "Enter the storage class to be used to provision block volumes for Object Storage Daemon (OSD) pods." + +} + +variable "autoDiscoverDevices" { + type = string + default = "false" + description = "Set to true if automatically discovering local disks" +} + +variable "kmsEncryption" { + type = string + default = "false" + description = "Set to true to enable HPCS Encryption" +} + +variable "kmsInstanceName" { + type = string + default = null + description = "Please provide HPCS service name" +} + +variable "kmsSecretName" { + type = string + default = null + description = "Please provide the HPCS secret name" +} + +variable "workerNodes" { + type = string + default = null + description = "Provide the names of the worker nodes on which to install ODF. Leave blank to install ODF on all worker nodes." +} + +variable "kmsInstanceId" { + type = string + default = null + description = "Please provide HPCS Service ID" +} + +variable "kmsBaseUrl" { + type = string + default = null + description = "Please provide HPCS Base URL" +} + +variable "kmsTokenUrl" { + type = string + default = null + description = "Please provide HPCS token URL" +} + +variable "encryptionInTransit" { + type = bool + default = false + description = "Enter true to enable in-transit encryption. Enabling in-transit encryption does not affect the existing mapped or mounted volumes. After a volume is mapped/mounted, it retains the encryption settings that were used when it was initially mounted. To change the encryption settings for existing volumes, they must be remounted again one-by-one." +} + +variable "disableNoobaaLB" { + type = bool + default = false + description = "Specify true to disable to NooBaa public load balancer." +} + +variable "cluster" { + type = string + description = "Cluster ID or Name you wish to assign your configuration to." +} + +variable "assignmentName" { + type = string + description = "Name of your storage assignment to a cluster" +} + +variable "updateConfigRevision" { + type = bool + default = false + description = "Set to true if you want to update the assignment with the latest configuration revision" +} + +variable "deleteAssignments" { + type = bool + default = false + description = "Set to true if you want to delete all the assignments of the configuration, during storage configuration destroy" +} + +variable "updateAssignments" { + type = bool + default = false + description = "Set to true if you want to update all the configuration's assignments with the latest revision" +} diff --git a/examples/openshift-data-foundation/satellite/odf-remote/4.14/README.md b/examples/openshift-data-foundation/satellite/odf-remote/4.14/README.md new file mode 100644 index 00000000..b29fd228 --- /dev/null +++ b/examples/openshift-data-foundation/satellite/odf-remote/4.14/README.md @@ -0,0 +1,183 @@ +# Openshift Data Foundation - Remote Deployment + +This example shows how to deploy and manage the Openshift Data Foundation (ODF) on IBM Cloud Satellite based RedHat Openshift cluster. + +This sample configuration will deploy the ODF, scale and upgrade it using the "ibm_satellite_storage_configuration" and "ibm_satellite_storage_assignment" resources from the ibm terraform provider. + +For more information, about + +* ODF Deployment & Management on Satellite, see [OpenShift Data Foundation for remote devices](https://cloud.ibm.com/docs/satellite?topic=satellite-storage-odf-remote&interface=ui) + +## Usage + +### Option 1 - Command Line Interface + +To run this example on your Terminal, first download this directory i.e `examples/openshift-data-foundation/` + +```bash +$ cd satellite +``` + +```bash +$ terraform init +$ terraform plan --var-file input.tfvars +$ terraform apply --var-file input.tfvars +``` + +Run `terraform destroy --var-file input.tfvars` when you don't need these resources. + +### Option 2 - IBM Cloud Schematics + +To Deploy & Manage the Openshift-Data-Foundation add-on using `IBM Cloud Schematics` please follow the below documentation + +https://cloud.ibm.com/docs/schematics?topic=schematics-get-started-terraform + + +## Example usage + +### Deployment of ODF Storage Configuration and Assignment + +The default input.tfvars is given below, the user should just change the value of the parameters in accorandance to their requirment. + +```hcl +# Common for both storage configuration and assignment +ibmcloud_api_key = "" +location = "" #Location of your storage configuration and assignment +configName = "" #Name of your storage configuration +region = "" + + +#ODF Storage Configuration +storageTemplateName = "odf-remote" +storageTemplateVersion = "4.14" + +## User Parameters +billingType = "advanced" +clusterEncryption = "false" +kmsBaseUrl = null +kmsEncryption = "false" +kmsInstanceId = null +kmsInstanceName = null +kmsTokenUrl = null +ibmCosEndpoint = null +ibmCosLocation = null +ignoreNoobaa = false +numOfOsd = "1" +ocsUpgrade = "false" +osdSize = "512Gi" +osdStorageClassName = "ibmc-vpc-block-metro-5iops-tier" +workerNodes = null +encryptionInTransit = false +disableNoobaaLB = false +performCleanup = false +taintNodes = false +addSingleReplicaPool = false +prepareForDisasterRecovery = false + +## Secret Parameters +ibmCosAccessKey = null +ibmCosSecretKey = null +iamAPIKey = "" #Required +kmsApiKey = null +kmsRootKey = null + +#ODF Storage Assignment +assignmentName = "" +cluster = "" +updateConfigRevision = false + +## NOTE ## +# The following variables will cause issues to your storage assignment lifecycle, so please use only with a storage configuration resource. +deleteAssignments = false +updateAssignments = false +``` + +Please note with this deployment the storage configuration and it's respective storage assignment is created to your specific satellite cluster in this example, if you'd like more control over the resources you can split it up into different files. + +### Scale-Up of ODF + +The following variables in the `input.tfvars` file can be edited + +* numOfOsd - To scale your storage +* workerNodes - To increase the number of Worker Nodes with ODF + +```hcl +numOfOsd = "1" -> "2" +workerNodes = null -> "worker_1_ID,worker_2_ID" +updateConfigRevision = true +``` +In this example we set the `updateConfigRevision` parameter to true in order to update our storage assignment with the latest configuration revision i.e the OcsCluster CRD is updated with the latest changes. + +You could also use `updateAssignments` to directly update the storage configuration's assignments, but if you have a dependent `storage_assignment` resource, it's lifecycle will be affected. It it recommended to use this parameter when you've only defined the `storage_configuration` resource. + +### Upgrade of ODF + +The following variables in the `input.tfvars` file should be changed in order to upgrade the ODF add-on and the Ocscluster CRD. + +* storageTemplateVersion - Specify the version you wish to upgrade to +* ocsUpgrade - Must be set to `true` to upgrade the CRD + +```hcl +# For ODF add-on upgrade +storageTemplateVersion = "4.14" -> "4.15" +ocsUpgrade = "false" -> "true" +``` + +Note this operation deletes the existing configuration and it's respective assignments, updates it to the next version and reassigns back to the previous clusters/groups. If used with a dependent assignment resource, it's lifecycle will be affected. It is recommended to perform this scenario when you've only defined the `storage_configuration` resource. + +## Examples + +* [ ODF Deployment & Management ](https://cloud.ibm.com/docs/satellite?topic=satellite-storage-odf-remote&interface=ui) + + + +## Requirements + +| Name | Version | +|------|---------| +| terraform | ~> 0.14.8 | + +## Providers + +| Name | Version | +|------|---------| +| ibm | latest | + +## Inputs + +| Name | Description | Type | Required | Default +|------|-------------|------|----------|--------| +| ibmcloud_api_key | IBM Cloud API Key | `string` | yes | - +| cluster | Name of the cluster. | `string` | yes | - +| region | Region of the cluster | `string` | yes | - +| storageTemplateVersion | Version of the Storage Template (odf-remote) | `string` | yes | - +| storageTemplateName | Name of the Storage Template (odf-remote)| `string` | yes | - +| osdSize | Enter the size for the storage devices that you want to provision for the Object Storage Daemon (OSD) pods | `string` | yes | 512Gi +| numOfOsd | The Number of OSD | `string` | yes | 1 +| osdStorageClassName | Enter the storage class to be used to provision block volumes for Object Storage Daemon (OSD) pods | `string` | yes | ibmc-vpc-block-metro-5iops-tier +| billingType | Set to true if automatically discovering local disks | `string` | no | advanced +| performCleanup |Set to true if you want to perform complete cleanup of ODF on assignment deletion. | `bool` | yes | false +| clusterEncryption | To enable at-rest encryption of all disks in the storage cluster | `string` | no | false +| iamApiKey | Your IAM API key. | `string` | true | - +| kmsEncryption | Set to true to enable HPCS Encryption | `string` | yes | false +| kmsBaseUrl | The HPCS Base URL | `string` | no | null +| kmsInstanceId | The HPCS Service ID | `string` | no | null +| kmsSecretName | The HPCS secret name | `string` | no | null +| kmsInstanceName | The HPCS service name | `string` | no | null +| kmsTokenUrl | The HPCS Token URL | `string` | no | null +| ignoreNoobaa | Set to true if you do not want MultiCloudGateway | `bool` | no | false +| ocsUpgrade | Set to true to upgrade Ocscluster | `string` | no | false +| workerNodes | Provide the names of the worker nodes on which to install ODF. Leave blank to install ODF on all worker nodes | `string` | no | null +| encryptionInTransit |To enable in-transit encryption. Enabling in-transit encryption does not affect the existing mapped or mounted volumes. After a volume is mapped/mounted, it retains the encryption settings that were used when it was initially mounted. To change the encryption settings for existing volumes, they must be remounted again one-by-one. | `bool` | no | false +| taintNodes | Specify true to taint the selected worker nodes so that only OpenShift Data Foundation pods can run on those nodes. Use this option only if you limit ODF to a subset of nodes in your cluster. | `bool` | no | false +| addSingleReplicaPool | Specify true to create a single replica pool without data replication, increasing the risk of data loss, data corruption, and potential system instability. | `bool` | no | false +| prepareForDisasterRecovery | Specify true to set up the storage system for disaster recovery service with the essential configurations in place. This allows seamless implementation of disaster recovery strategies for your workloads | `bool` | no | false +| disableNoobaaLB | Specify true to disable to NooBaa public load balancer. | `bool` | no | false + +Refer - https://cloud.ibm.com/docs/satellite?topic=satellite-storage-odf-remote&interface=ui#odf-remote-4.14-parameters + +## Note + +* Users should only change the values of the variables within quotes, variables should be left untouched with the default values if they are not set. +* `workerNodes` takes a string containing comma separated values of the names of the worker nodes you wish to enable ODF on. +* During ODF Storage Template Update, it is recommended to delete all terraform related assignments before handed, as their lifecycle will be affected, during update new storage assignments are made back internally with new UUIDs. diff --git a/examples/openshift-data-foundation/satellite/odf-remote/4.14/input.tfvars b/examples/openshift-data-foundation/satellite/odf-remote/4.14/input.tfvars new file mode 100644 index 00000000..5198408b --- /dev/null +++ b/examples/openshift-data-foundation/satellite/odf-remote/4.14/input.tfvars @@ -0,0 +1,56 @@ +## DEFAULT VALUES ARE SET ## +## Please change according to your configuratiom ## + + +# Common for both storage configuration and assignment +ibmcloud_api_key = "" +location = "" #Location of your storage configuration and assignment +configName = "" #Name of your storage configuration +region = "" + + +#ODF Storage Configuration + +storageTemplateName = "odf-remote" +storageTemplateVersion = "4.14" + +## User Parameters + +billingType = "advanced" +clusterEncryption = "false" +kmsBaseUrl = null +kmsEncryption = "false" +kmsInstanceId = null +kmsInstanceName = null +kmsTokenUrl = null +ibmCosEndpoint = null +ibmCosLocation = null +ignoreNoobaa = false +numOfOsd = "1" +ocsUpgrade = "false" +osdSize = "512Gi" +osdStorageClassName = "ibmc-vpc-block-metro-5iops-tier" +workerNodes = null +encryptionInTransit = false +disableNoobaaLB = false +performCleanup = false +taintNodes = false +addSingleReplicaPool = false +prepareForDisasterRecovery = false + +## Secret Parameters +ibmCosAccessKey = null +ibmCosSecretKey = null +iamAPIKey = "" #Required +kmsApiKey = null +kmsRootKey = null + +#ODF Storage Assignment +assignmentName = "" +cluster = "" +updateConfigRevision = false + +## NOTE ## +# The following variables will cause issues to your storage assignment lifecycle, so please use only with a storage configuration resource. +deleteAssignments = false +updateAssignments = false \ No newline at end of file diff --git a/examples/openshift-data-foundation/satellite/odf-remote/4.14/main.tf b/examples/openshift-data-foundation/satellite/odf-remote/4.14/main.tf new file mode 100644 index 00000000..8c58612d --- /dev/null +++ b/examples/openshift-data-foundation/satellite/odf-remote/4.14/main.tf @@ -0,0 +1,60 @@ +terraform { + required_providers { + ibm = { + source = "IBM-Cloud/ibm" + version = ">= 1.56.0" + } + } +} + +provider "ibm" { + ibmcloud_api_key = var.ibmcloud_api_key + region = var.region +} + +resource "ibm_satellite_storage_configuration" "storage_configuration" { + location = var.location + config_name = var.configName + storage_template_name = var.storageTemplateName + storage_template_version = var.storageTemplateVersion + user_config_parameters = { + "osd-size" = var.osdSize, + "num-of-osd" = var.numOfOsd, + "osd-storage-class" = var.osdStorageClassName, + "billing-type" = var.billingType, + "cluster-encryption" = var.clusterEncryption, + "ibm-cos-endpoint"= var.ibmCosEndpoint, + "ibm-cos-location"= var.ibmCosLocation, + "ignore-noobaa"= var.ignoreNoobaa, + "kms-base-url"= var.kmsBaseUrl, + "kms-encryption"= var.kmsEncryption, + "kms-instance-id"= var.kmsInstanceId, + "kms-instance-name"= var.kmsInstanceName, + "kms-token-url"= var.kmsTokenUrl, + "odf-upgrade"= var.ocsUpgrade, + "perform-cleanup"= var.performCleanup, + "disable-noobaa-LB"= var.disableNoobaaLB, + "encryption-intransit"= var.encryptionInTransit, + "worker-nodes"= var.workerNodes, + "add-single-replica-pool" = var.addSingleReplicaPool, + "taint-nodes" = var.taintNodes, + "prepare-for-disaster-recovery" = var.prepareForDisasterRecovery + } + user_secret_parameters = { + "iam-api-key"= var.iamAPIKey, + "ibm-cos-access-key" = var.ibmCosAccessKey, + "kms-root-key" = var.kmsRootKey, + "kms-api-key" = var.kmsApiKey + } + delete_assignments = var.deleteAssignments + update_assignments = var.updateAssignments +} + +resource "ibm_satellite_storage_assignment" "storage_assignment" { + assignment_name = var.assignmentName + cluster = var.cluster + controller = var.location + config = var.configName + depends_on = [ibm_satellite_storage_configuration.storage_configuration] + update_config_revision = var.updateConfigRevision +} diff --git a/examples/openshift-data-foundation/satellite/odf-remote/4.14/variables.tf b/examples/openshift-data-foundation/satellite/odf-remote/4.14/variables.tf new file mode 100644 index 00000000..016e74bf --- /dev/null +++ b/examples/openshift-data-foundation/satellite/odf-remote/4.14/variables.tf @@ -0,0 +1,239 @@ +variable "ibmcloud_api_key" { + type = string + description = "IBM Cloud API Key" +} + +variable "iamAPIKey" { + type = string + description = "Your IBM Cloud API Key" +} + +variable "location" { + type = string + description = "The satellite location where you want to create your configuration" +} + +variable "configName" { + type = string + description = "The name of your storage configuration" +} + +variable "storageTemplateName" { + type = string + description = "The storage template for your configuration." +} + +variable "storageTemplateVersion" { + type = string + description = "The version of the storage template." +} + +variable "region" { + type = string + description = "Enter Satellite Location Region" +} + +variable "odfVersion" { + type = string + default = "4.13.0" + description = "Provide the ODF Version you wish to install on your cluster" +} + +variable "numOfOsd" { +type = string +default = "1" +description = "Number of Osd" +} + +variable "osdDevicePaths" { +type = string +description = "IDs of the disks to be used for OSD pods if using local disks or standard classic cluster" +default = null +} + +variable "ocsUpgrade" { + type = string + default = "false" + description = "Set to true to upgrade Ocscluster" + +} + +variable "clusterEncryption" { + type = string + default = "false" + description = "Enable at-rest encryption of all disks in the storage cluster." +} + + +variable "billingType" { + type = string + default = "advanced" + description = "Choose between advanced and essentials" +} + +variable "ignoreNoobaa" { + type = bool + default = false + description = "Set to true if you do not want MultiCloudGateway" +} + +variable "performCleanup" { + type = bool + default = false + description = "Set to true if you want to perform cleanup during assignment deletion" +} + +variable "ibmCosEndpoint" { + type = string + default = null + description = "The IBM COS regional public endpoint" +} + +variable "ibmCosLocation" { + type = string + default = null + description = "The location constraint that you want to use when creating your bucket. For example us-east-standard." +} + +variable "ibmCosSecretKey" { + type = string + default = null + description = "Your IBM COS HMAC secret access key." +} + +variable "ibmCosAccessKey" { + type = string + default = null + description = "Your IBM COS HMAC access key ID." +} + +variable "kmsApiKey" { + type = string + default = null + description = "IAM API key to access the KMS instance. The API key that you provide must have at least Viewer access to the KMS instance." +} + +variable "kmsRootKey" { + type = string + default = null + description = "KMS root key of your instance." +} + +variable "osdSize" { + type = string + default = "250Gi" + description = "Enter the size for the storage devices that you want to provision for the Object Storage Daemon (OSD) pods." +} + +variable "osdStorageClassName" { + type = string + default = "ibmc-vpc-block-metro-10iops-tier" + description = "Enter the storage class to be used to provision block volumes for Object Storage Daemon (OSD) pods." + +} + +variable "autoDiscoverDevices" { + type = string + default = "false" + description = "Set to true if automatically discovering local disks" +} + +variable "kmsEncryption" { + type = string + default = "false" + description = "Set to true to enable HPCS Encryption" +} + +variable "kmsInstanceName" { + type = string + default = null + description = "Please provide HPCS service name" +} + +variable "kmsSecretName" { + type = string + default = null + description = "Please provide the HPCS secret name" +} + +variable "workerNodes" { + type = string + default = null + description = "Provide the names of the worker nodes on which to install ODF. Leave blank to install ODF on all worker nodes." +} + +variable "kmsInstanceId" { + type = string + default = null + description = "Please provide HPCS Service ID" +} + +variable "kmsBaseUrl" { + type = string + default = null + description = "Please provide HPCS Base URL" +} + +variable "kmsTokenUrl" { + type = string + default = null + description = "Please provide HPCS token URL" +} + +variable "encryptionInTransit" { + type = bool + default = false + description = "Enter true to enable in-transit encryption. Enabling in-transit encryption does not affect the existing mapped or mounted volumes. After a volume is mapped/mounted, it retains the encryption settings that were used when it was initially mounted. To change the encryption settings for existing volumes, they must be remounted again one-by-one." +} + +variable "disableNoobaaLB" { + type = bool + default = false + description = "Specify true to disable to NooBaa public load balancer." +} + +variable "cluster" { + type = string + description = "Cluster ID or Name you wish to assign your configuration to." +} + +variable "assignmentName" { + type = string + description = "Name of your storage assignment to a cluster" +} + +variable "updateConfigRevision" { + type = bool + default = false + description = "Set to true if you want to update the assignment with the latest configuration revision" +} + +variable "deleteAssignments" { + type = bool + default = false + description = "Set to true if you want to delete all the assignments of the configuration, during storage configuration destroy" +} + +variable "updateAssignments" { + type = bool + default = false + description = "Set to true if you want to update all the configuration's assignments with the latest revision" +} + +variable "taintNodes" { + type = bool + default = false + description = "Specify true to taint the selected worker nodes so that only OpenShift Data Foundation pods can run on those nodes. Use this option only if you limit ODF to a subset of nodes in your cluster." +} + +variable "addSingleReplicaPool" { + type = bool + default = false + description = "Specify true to create a single replica pool without data replication, increasing the risk of data loss, data corruption, and potential system instability." +} + +variable "prepareForDisasterRecovery" { + type = bool + default = false + description = "Specify true to set up the storage system for disaster recovery service with the essential configurations in place. This allows seamless implementation of disaster recovery strategies for your workloads." +} \ No newline at end of file