Skip to content

Commit 0f141d2

Browse files
authored
feat: bump resource limits<br>- lock provider versions in DA<br>- fix dependency tree<br>- added new outputs<br>- added new required input cluster_rg_id (#12)
1 parent 7c9ae86 commit 0f141d2

File tree

21 files changed

+472
-113
lines changed

21 files changed

+472
-113
lines changed

.secrets.baseline

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"files": "go.sum|^.secrets.baseline$",
44
"lines": null
55
},
6-
"generated_at": "2025-01-24T16:49:18Z",
6+
"generated_at": "2025-02-11T22:49:03Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"
@@ -76,18 +76,7 @@
7676
"name": "TwilioKeyDetector"
7777
}
7878
],
79-
"results": {
80-
"solutions/deploy/README.md": [
81-
{
82-
"hashed_secret": "2254481e1661d8f017a712b0d1ad9a14fd9460a3",
83-
"is_secret": false,
84-
"is_verified": false,
85-
"line_number": 134,
86-
"type": "Secret Keyword",
87-
"verified_result": null
88-
}
89-
]
90-
},
79+
"results": {},
9180
"version": "0.13.1+ibm.62.dss",
9281
"word_list": {
9382
"file": null,

chart/cloud-pak-deployer/templates/install-job.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ spec:
7575
- '/cloud-pak-deployer/cp-deploy.sh vault set -vs cp4d_admin_cpd_{{ .Values.cluster_name }} -vsv {{ .Values.deployer.admin_password }} && /cloud-pak-deployer/cp-deploy.sh env apply -vvvv {{ .Values.deployer.accept_license_flag }}'
7676
resources:
7777
limits:
78-
cpu: 200m
78+
cpu: 250m
7979
memory: 512Mi
8080
requests:
81-
cpu: 10m
82-
memory: 64Mi
81+
cpu: 100m
82+
memory: 256Mi
8383
serviceAccount: {{ .Values.deployer.prefix }}-sa
8484
volumes:
8585
- name: config-volume

chart/cloud-pak-deployer/templates/uninstall-job.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ spec:
6666
- /cloud-pak-deployer/scripts/cp4d/cp4d-delete-instance.sh cpd <<< "y"
6767
resources:
6868
limits:
69-
cpu: 200m
69+
cpu: 250m
7070
memory: 512Mi
7171
requests:
72-
cpu: 10m
73-
memory: 64Mi
72+
cpu: 100m
73+
memory: 256Mi
7474
restartPolicy: Never
7575
securityContext:
7676
runAsUser: 0

examples/basic/main.tf

Lines changed: 90 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,106 @@
11
##############################################################################
2-
# ROKS Landing zone
2+
locals {
3+
cluster_name = var.existing_cluster_name != null ? var.existing_cluster_name : module.ocp_base[0].cluster_name
4+
cluster_rg_id = var.existing_cluster_rg_id != null ? var.existing_cluster_rg_id : module.resource_group[0].resource_group_id
5+
}
6+
###############################################################################
7+
8+
##############################################################################
9+
# Resource Group
310
##############################################################################
411

5-
module "roks_landing_zone" {
6-
source = "git::https://github.com/terraform-ibm-modules/terraform-ibm-landing-zone.git//patterns/roks-quickstart?ref=v6.6.1"
7-
ibmcloud_api_key = var.ibmcloud_api_key
8-
prefix = var.prefix
9-
region = var.region
10-
resource_tags = var.resource_tags
12+
module "resource_group" {
13+
count = var.existing_cluster_rg_id == null ? 1 : 0
14+
source = "terraform-ibm-modules/resource-group/ibm"
15+
version = "1.1.6"
16+
# if an existing resource group is not set (null) create a new one using prefix
17+
resource_group_name = "${var.prefix}-resource-group"
18+
}
19+
20+
########################################################################################################################
21+
# VPC + Subnet + Public Gateway
22+
#
23+
# NOTE: This is a very simple VPC with single subnet in a single zone with a public gateway enabled, that will allow
24+
# all traffic ingress/egress by default.
25+
# For production use cases this would need to be enhanced by adding more subnets and zones for resiliency, and
26+
# ACLs/Security Groups for network security.
27+
########################################################################################################################
28+
29+
resource "ibm_is_vpc" "vpc" {
30+
name = "${var.prefix}-vpc"
31+
resource_group = local.cluster_rg_id
32+
address_prefix_management = "auto"
33+
tags = var.resource_tags
34+
}
35+
36+
resource "ibm_is_public_gateway" "gateway" {
37+
name = "${var.prefix}-gateway-1"
38+
vpc = ibm_is_vpc.vpc.id
39+
resource_group = local.cluster_rg_id
40+
zone = "${var.region}-1"
41+
}
42+
43+
resource "ibm_is_subnet" "subnet_zone_1" {
44+
name = "${var.prefix}-subnet-1"
45+
vpc = ibm_is_vpc.vpc.id
46+
resource_group = local.cluster_rg_id
47+
zone = "${var.region}-1"
48+
total_ipv4_address_count = 256
49+
public_gateway = ibm_is_public_gateway.gateway.id
50+
}
51+
52+
########################################################################################################################
53+
# OCP VPC cluster (single zone)
54+
########################################################################################################################
55+
56+
locals {
57+
cluster_vpc_subnets = {
58+
default = [
59+
{
60+
id = ibm_is_subnet.subnet_zone_1.id
61+
cidr_block = ibm_is_subnet.subnet_zone_1.ipv4_cidr_block
62+
zone = ibm_is_subnet.subnet_zone_1.zone
63+
}
64+
]
65+
}
66+
67+
worker_pools = [
68+
{
69+
subnet_prefix = "default"
70+
pool_name = "default" # ibm_container_vpc_cluster automatically names default pool "default" (See https://github.com/IBM-Cloud/terraform-provider-ibm/issues/2849)
71+
machine_type = "bx2.16x64"
72+
operating_system = "REDHAT_8_64"
73+
workers_per_zone = 3 # minimum of 2 is allowed when using single zone
74+
}
75+
]
76+
}
77+
78+
module "ocp_base" {
79+
count = var.existing_cluster_name == null ? 1 : 0
80+
source = "terraform-ibm-modules/base-ocp-vpc/ibm"
81+
version = "3.41.7"
82+
resource_group_id = local.cluster_rg_id
83+
region = var.region
84+
tags = var.resource_tags
85+
cluster_name = var.prefix
86+
force_delete_storage = true
87+
vpc_id = ibm_is_vpc.vpc.id
88+
vpc_subnets = local.cluster_vpc_subnets
89+
worker_pools = local.worker_pools
90+
disable_outbound_traffic_protection = true # set as True to enable outbound traffic
1191
}
1292

1393
##############################################################################
1494
# Deploy cloudpak_data
1595
##############################################################################
96+
1697
module "cloudpak_data" {
1798
source = "../../solutions/deploy"
1899
ibmcloud_api_key = var.ibmcloud_api_key
19100
prefix = var.prefix
20101
region = var.region
21-
cluster_name = module.roks_landing_zone.workload_cluster_id
102+
cluster_name = local.cluster_name
103+
cluster_rg_id = local.cluster_rg_id
22104
cloud_pak_deployer_image = "quay.io/cloud-pak-deployer/cloud-pak-deployer"
23105
cpd_admin_password = "Passw0rd" #pragma: allowlist secret
24106
cpd_entitlement_key = "entitlementKey"

examples/basic/variables.tf

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
##############################################################################
44

55
variable "ibmcloud_api_key" {
6-
description = "The IBM Cloud platform API key needed to deploy IAM enabled resources."
6+
description = "The IBM Cloud API key to deploy resources."
77
type = string
88
sensitive = true
99
}
@@ -14,8 +14,8 @@ variable "prefix" {
1414
default = "lz-roks-cp4d"
1515

1616
validation {
17-
error_message = "Prefix must begin with a letter and contain only lowercase letters, numbers, and - characters. Prefixes must end with a lowercase letter or number and be 13 or fewer characters."
18-
condition = can(regex("^([a-z]|[a-z][-a-z0-9]*[a-z0-9])$", var.prefix)) && length(var.prefix) <= 13
17+
error_message = "Prefix must begin with a letter and contain only lowercase letters, numbers, and - characters. Prefixes must end with a lowercase letter or number and be 16 or fewer characters."
18+
condition = can(regex("^([a-z]|[a-z][-a-z0-9]*[a-z0-9])$", var.prefix)) && length(var.prefix) <= 16
1919
}
2020
}
2121

@@ -36,3 +36,19 @@ variable "install_odf_cluster_addon" {
3636
type = bool
3737
default = false
3838
}
39+
40+
variable "existing_cluster_name" {
41+
description = "Existing cluster name"
42+
type = string
43+
default = null
44+
validation {
45+
condition = can(regex("^[a-z][a-z0-9-]{0,12}[a-z0-9]$", var.existing_cluster_name))
46+
error_message = "Existing cluster name must begin with a letter and contain only lowercase letters, numbers, and - characters. Existing cluster names must end with a lowercase letter or number and be 13 or fewer characters."
47+
}
48+
}
49+
50+
variable "existing_cluster_rg_id" {
51+
description = "Existing resource group id"
52+
type = string
53+
default = null
54+
}

examples/basic/version.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ terraform {
33
required_providers {
44
# renovate is set up to keep provider version at the latest for all DA solutions
55
ibm = {
6-
source = "IBM-Cloud/ibm"
6+
source = "ibm-cloud/ibm"
77
version = "1.71.3"
88
}
99
}

0 commit comments

Comments
 (0)