Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions solutions/virtualization/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# OpenShift Virtualization on OCP VPC cluster

This architecture help setting up OpenShift Virtualization on OCP VPC cluster. Also the outbound traffic is allowed, which is required for accessing the Operator Hub.

Prerequisites:
- A OCP VPC cluster.
- Outbound traffic protection disabled.

The following resources are provisioned by this example:

- Install `openshift-data-foundation` and `vpc-file-csi-driver` addons.
- Setup OperatorHub

<!-- Below content is automatically populated via pre-commit hook -->
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
### Requirements

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3.0 |
| <a name="requirement_helm"></a> [helm](#requirement\_helm) | 2.17.0 |
| <a name="requirement_ibm"></a> [ibm](#requirement\_ibm) | 1.75.1 |
| <a name="requirement_kubernetes"></a> [kubernetes](#requirement\_kubernetes) | 2.35.1 |
| <a name="requirement_null"></a> [null](#requirement\_null) | 3.2.3 |
| <a name="requirement_time"></a> [time](#requirement\_time) | 0.12.1 |

### Modules

No modules.

### Resources

| Name | Type |
|------|------|
| [helm_release.operator](https://registry.terraform.io/providers/hashicorp/helm/2.17.0/docs/resources/release) | resource |
| [helm_release.subscription](https://registry.terraform.io/providers/hashicorp/helm/2.17.0/docs/resources/release) | resource |
| [ibm_container_addons.addons](https://registry.terraform.io/providers/IBM-Cloud/ibm/1.75.1/docs/resources/container_addons) | resource |
| [kubernetes_config_map_v1_data.disable_default_storageclass](https://registry.terraform.io/providers/hashicorp/kubernetes/2.35.1/docs/resources/config_map_v1_data) | resource |
| [kubernetes_config_map_v1_data.set_vpc_file_default_storage_class](https://registry.terraform.io/providers/hashicorp/kubernetes/2.35.1/docs/resources/config_map_v1_data) | resource |
| [null_resource.config_map_status](https://registry.terraform.io/providers/hashicorp/null/3.2.3/docs/resources/resource) | resource |
| [null_resource.enable_catalog_source](https://registry.terraform.io/providers/hashicorp/null/3.2.3/docs/resources/resource) | resource |
| [null_resource.update_storage_profile](https://registry.terraform.io/providers/hashicorp/null/3.2.3/docs/resources/resource) | resource |
| [time_sleep.wait_for_default_storage](https://registry.terraform.io/providers/hashicorp/time/0.12.1/docs/resources/sleep) | resource |
| [time_sleep.wait_for_storage_profile](https://registry.terraform.io/providers/hashicorp/time/0.12.1/docs/resources/sleep) | resource |
| [time_sleep.wait_for_subscription](https://registry.terraform.io/providers/hashicorp/time/0.12.1/docs/resources/sleep) | resource |
| [ibm_container_cluster_config.cluster_config](https://registry.terraform.io/providers/IBM-Cloud/ibm/1.75.1/docs/data-sources/container_cluster_config) | data source |
| [ibm_container_vpc_cluster.cluster](https://registry.terraform.io/providers/IBM-Cloud/ibm/1.75.1/docs/data-sources/container_vpc_cluster) | data source |

### Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_cluster_config_endpoint_type"></a> [cluster\_config\_endpoint\_type](#input\_cluster\_config\_endpoint\_type) | Specify the type of endpoint to use to access the cluster configuration. Possible values: `default`, `private`, `vpe`, `link`. The `default` value uses the default endpoint of the cluster. | `string` | `"default"` | no |
| <a name="input_cluster_id"></a> [cluster\_id](#input\_cluster\_id) | The ID of the cluster to deploy the agents in. | `string` | n/a | yes |
| <a name="input_cluster_resource_group_id"></a> [cluster\_resource\_group\_id](#input\_cluster\_resource\_group\_id) | The resource group ID of the cluster. | `string` | n/a | yes |
| <a name="input_ibmcloud_api_key"></a> [ibmcloud\_api\_key](#input\_ibmcloud\_api\_key) | The IBM Cloud API key. | `string` | n/a | yes |
| <a name="input_infra_node_selectors"></a> [infra\_node\_selectors](#input\_infra\_node\_selectors) | List of infra node selectors to apply to HyperConverged pods. | <pre>list(object({<br/> label = string<br/> values = list(string)<br/> }))</pre> | <pre>[<br/> {<br/> "label": "ibm-cloud.kubernetes.io/server-type",<br/> "values": [<br/> "virtual",<br/> "physical"<br/> ]<br/> }<br/>]</pre> | no |
| <a name="input_provider_visibility"></a> [provider\_visibility](#input\_provider\_visibility) | Set the visibility value for the IBM terraform provider. Supported values are `public`, `private`, `public-and-private`. [Learn more](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/guides/custom-service-endpoints). | `string` | `"public"` | no |
| <a name="input_provision_odf_addon"></a> [provision\_odf\_addon](#input\_provision\_odf\_addon) | Set this variable to true to install OpenShift Data Foundation addon in your existing cluster. | `bool` | `false` | no |
| <a name="input_provision_vpc_file_addon"></a> [provision\_vpc\_file\_addon](#input\_provision\_vpc\_file\_addon) | Set this variable to true to install File Storage for VPC addon in your existing cluster. | `bool` | `false` | no |
| <a name="input_region"></a> [region](#input\_region) | The region in which to provision all resources created by this solution. | `string` | `"us-south"` | no |
| <a name="input_vpc_file_default_storage_class"></a> [vpc\_file\_default\_storage\_class](#input\_vpc\_file\_default\_storage\_class) | The name of the VPC File storage class which will be set as the default storage class. | `string` | `"ibmc-vpc-file-metro-1000-iops"` | no |
| <a name="input_wait_till"></a> [wait\_till](#input\_wait\_till) | To avoid long wait times when you run your Terraform code, you can specify the stage when you want Terraform to mark the cluster resource creation as completed. Depending on what stage you choose, the cluster creation might not be fully completed and continues to run in the background. However, your Terraform code can continue to run without waiting for the cluster to be fully created. Supported args are `MasterNodeReady`, `OneWorkerNodeReady`, `IngressReady` and `Normal` | `string` | `"Normal"` | no |
| <a name="input_wait_till_timeout"></a> [wait\_till\_timeout](#input\_wait\_till\_timeout) | Timeout for wait\_till in minutes. | `number` | `90` | no |
| <a name="input_workloads_node_selectors"></a> [workloads\_node\_selectors](#input\_workloads\_node\_selectors) | List of workload node selectors to apply to HyperConverged pods. | <pre>list(object({<br/> label = string<br/> values = list(string)<br/> }))</pre> | <pre>[<br/> {<br/> "label": "ibm-cloud.kubernetes.io/server-type",<br/> "values": [<br/> "physical"<br/> ]<br/> }<br/>]</pre> | no |

### Outputs

No outputs.
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"ibmcloud_api_key": $VALIDATION_APIKEY
}
23 changes: 23 additions & 0 deletions solutions/virtualization/chart/operator/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
24 changes: 24 additions & 0 deletions solutions/virtualization/chart/operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: virtualization
description: A Helm chart for Openshft Virtualization

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.2

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
apiVersion: hco.kubevirt.io/v1beta1
kind: HyperConverged
metadata:
annotations:
deployOVS: 'false'
name: kubevirt-hyperconverged
namespace: {{ .Release.Namespace }}
spec:
virtualMachineOptions:
disableFreePageReporting: false
disableSerialConsoleLog: true
higherWorkloadDensity:
memoryOvercommitPercentage: 100
liveMigrationConfig:
allowAutoConverge: false
allowPostCopy: false
completionTimeoutPerGiB: 800
parallelMigrationsPerCluster: 5
parallelOutboundMigrationsPerNode: 2
progressTimeout: 150
infra:
nodePlacement:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
{{- range $node_selector := .Values.infra_node_selectors }}
- key: {{ $node_selector.label | quote }}
operator: In
values:
{{- range $val := $node_selector.values }}
- {{ $val | quote }}
{{- end}}
{{- end}}
workloadUpdateStrategy:
batchEvictionInterval: 1m0s
batchEvictionSize: 10
workloadUpdateMethods:
- LiveMigrate
uninstallStrategy: BlockUninstallIfWorkloadsExist
workloads:
nodePlacement:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
{{- range $node_selector := .Values.workloads_node_selectors }}
- key: {{ $node_selector.label | quote }}
operator: In
values:
{{- range $val := $node_selector.values }}
- {{ $val | quote }}
{{- end}}
{{- end}}
14 changes: 14 additions & 0 deletions solutions/virtualization/chart/operator/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# NOTE: Mock values added here for helm linter to pass. Actual values are set in main.tf
operator:
# renovate: datasource=docker depName=icr.io/ext/logdna-agent versioning=regex:^(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)-(?<build>\d{8}).\w+?$
version: "v4.17.4"

infra_node_selectors:
- label: ibm-cloud.kubernetes.io/server-type
values:
- virtual

workloads_node_selectors:
- label: ibm-cloud.kubernetes.io/server-type
values:
- physical
23 changes: 23 additions & 0 deletions solutions/virtualization/chart/subscription/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
24 changes: 24 additions & 0 deletions solutions/virtualization/chart/subscription/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: virtualization
description: A Helm chart for Openshft Virtualization

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.2

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
name: kubevirt-hyperconverged-group
namespace: {{ .Release.Namespace }}
spec:
targetNamespaces:
- {{ .Release.Namespace }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: hco-operatorhub
namespace: {{ .Release.Namespace }}
spec:
source: redhat-operators
sourceNamespace: openshift-marketplace
name: kubevirt-hyperconverged
startingCSV: kubevirt-hyperconverged-operator.{{ .Values.subscription.version }}
channel: "stable"
4 changes: 4 additions & 0 deletions solutions/virtualization/chart/subscription/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# NOTE: Mock values added here for helm linter to pass. Actual values are set in main.tf
subscription:
# renovate: datasource=docker depName=icr.io/ext/logdna-agent versioning=regex:^(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)-(?<build>\d{8}).\w+?$
version: "v4.17.4"
6 changes: 6 additions & 0 deletions solutions/virtualization/kubeconfig/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Ignore everything
*

# But not these files...
!.gitignore
!README.md
2 changes: 2 additions & 0 deletions solutions/virtualization/kubeconfig/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This directory must exist in source control so the `ibm_container_cluster_config` data lookup can use it to place the
config.yml used to connect to a kubernetes cluster.
Loading