GithubHelp home page GithubHelp logo

terraform-ibm-modules / terraform-ibm-base-ocp-vpc Goto Github PK

View Code? Open in Web Editor NEW
1.0 19.0 4.0 705 KB

Provisions a Red Hat OpenShift VPC cluster on IBM Cloud

License: Apache License 2.0

HCL 78.50% Go 13.39% Shell 8.11%
core-team ibm-cloud ocp openshift-cluster terraform terraform-module vpc-cluster graduated supported

terraform-ibm-base-ocp-vpc's Introduction

Red Hat OpenShift VPC cluster on IBM Cloud module

Graduated (Supported) latest release Renovate enabled semantic-release pre-commit Catalog release

Use this module to provision an IBM Cloud Red Hat OpenShift cluster on VPC Gen2. The module either creates the required Cloud Object Storage instance or uses an existing instance. The module also supports optionally passing a key management configuration for secret encryption and boot volume encryption.

Optionally, the module supports advanced security group management for the worker nodes, VPE, and load balancer associated with the cluster. This feature allows you to configure security groups for the cluster's worker nodes, VPE, and load balancer.

Important: You can't update Red Hat OpenShift cluster nodes by using this module. The Terraform logic ignores updates to prevent possible destructive changes.

Before you begin

Overview

terraform-ibm-base-ocp-vpc

Usage

module "ocp_base" {
  source               = "terraform-ibm-modules/base-ocp-vpc/ibm"
  version              = "X.X.X" # Replace "X.X.X" with a release version to lock into a specific release
  ibmcloud_api_key     = "XXXXXXXXXXXXXXXXXXX"
  cluster_name         = "example-cluster-name"
  resource_group_id    = "xxXXxxXXxXxXXXXxxXxxxXXXXxXXXXX"
  region               = "us-south"
  force_delete_storage = true
  vpc_id               = "79cxxxx-xxxx-xxxx-xxxx-xxxxxXX8667"
  # obtain the below values from the targeted VPC and adjust to the number of zones, subnets, subnet name, cidr_block, id, zone
  vpc_subnets          = {
    zone-1    = [
        {
            cidr_block = "192.168.32.0/22"
            id         = "0717-afc29fbb-0dbe-493a-a5b9-f3c5899cb8b9"
            zone       = "us-south-1"
        },
        {
            cidr_block = "192.168.36.0/22"
            id         = "0727-d65c1eda-9e38-4200-8452-cb8ff5bb3140"
            zone       = "us-south-2"
        },
        {
            cidr_block = "192.168.40.0/22"
            id         = "0737-9a823cd3-16bf-4ba4-a429-9e1fc7db74b8"
            zone       = "us-south-3"
        }
    ]
    zone-2 = [
        {
            cidr_block = "192.168.0.0/22"
            id         = "0717-846b9490-34ae-4a6c-8288-28112dca1ba3"
            zone       = "us-south-1"
        },
        {
            cidr_block = "192.168.4.0/22"
            id         = "0727-ef8db7f6-ffa5-4d8b-a317-4631741a45ee"
            zone       = "us-south-2"
        },
        {
            cidr_block = "192.168.8.0/22"
            id         = "0737-c9a6d871-d95b-4914-abf5-82c22f4161d1"
            zone       = "us-south-3"
        }
    ]
    zone-3 = [
        {
            cidr_block = "192.168.16.0/22"
            id         = "0717-d46e227c-89d4-4b02-9008-d03907a275b6"
            zone       = "us-south-1"
        },
        {
            cidr_block = "192.168.20.0/22"
            id         = "0727-93b1edcb-966c-4517-a7af-6ac63cd93adf"
            zone       = "us-south-2"
        },
        {
            cidr_block = "192.168.24.0/22"
            id         = "0737-807ec4f1-4d84-484e-b2f4-62dd5e431065"
            zone       = "us-south-3"
        }
    ]
  }
}

Advanced security group options

The Terraform module provides options to attach additional security groups to the worker nodes, VPE, and load balancer associated with the cluster.

The custom_sg example demonstrates how to use these capabilities.

See the IBM Cloud documentation on this topic here

Tip: The terraform-ibm-security-groups module can be used to create security groups and rules.

Worker nodes

  • Additional security groups can be specified at cluster creation time. These security groups are attached to all worker nodes of the cluster, including additional worker nodes/pools added after the creation of the cluster. See the variable custom_security_group_ids.
  • Additional security groups can be specified for specific worker pools. These security groups only apply to the worker pool. See the field additional_security_group_ids in the variable worker_pools.

In all cases, note that:

  • The default VPC security is no longer attached to the worker nodes.
  • You can opt-out of attaching the IBM-managed cluster security group (named kube-) through the flag attach_ibm_managed_security_group.
  • It is impossible to change the security groups associated with a cluster after the creation of that cluster.

VPEs (Virtual Private Endpoints)

  • The IBM Cloud OCP stack creates VPEs by default. Prior to version 4.14, a VPE to the master is created. From version 4.14, VPEs to the master, container registry, and IBM Cloud kube APIs are created.
  • You can attach additional security groups through the additional_vpe_security_group_ids variable.
  • The default IBM-managed security group is attached to those VPEs in all cases.

Load balancers

  • The IBM Cloud OCP stack manages the lifecycle of VPC Loadbalancers for your cluster. See the LoadBalancer section in the Understanding options for exposing apps.
  • By default, one load balancer is created at cluster creation for the default cluster ingress.
  • You can attach additional security groups using the additional_lb_security_group_ids variable. This set of security groups is attached to all loadbalancers managed by the cluster.
  • Important: If additional load balancers are added after creating the cluster, for example, by exposing a Kubernetes service of type LoadBalancer, update the number_of_lbs variable and re-run this module to attach the extra security groups to the newly created load balancer.
  • The default IBM-managed security group is attached to the LBs in all cases.

Troubleshooting

New kube_version message

  • When you run a terraform plan command, you might get a message about a new version of Kubernetes, as in the following example:

    kube_version = "4.12.16_openshift" -> "4.12.20_openshift"
    
    Unless you have made equivalent changes to your configuration, or ignored the relevant attributes using ignore_changes, the following plan may include actions to undo or respond to these changes.

    A new version is detected because the Kubernetes master node is updated outside of Terraform, and the Terraform state is out of date with that version.

    The Kubernetes version is ignored in the module code, so the infrastructure will not be modified. The message identifies that drift exists in the versions, and after running the terraform apply command, the state will be refreshed.

Required IAM access policies

You need the following permissions to run this module.

  • Account Management
    • All Identity and Access Enabled service
      • Viewer platform access
    • All Resource Groups service
      • Viewer platform access
  • IAM Services
    • Cloud Object Storage service
      • Editor platform access
      • Manager service access
    • Kubernetes service
      • Administrator platform access
      • Manager service access
    • VPC Infrastructure service
      • Administrator platform access
      • Manager service access

Optionally, you need the following permissions to attach Access Management tags to resources in this module.

  • IAM Services
    • Tagging service
      • Administrator platform access

Note

  • One worker pool should always be named as default. Refer issue 2849 for further details.

Requirements

Name Version
terraform >= 1.3.0, < 1.7.0
ibm >= 1.64.0, < 2.0.0
kubernetes >= 2.16.1, < 3.0.0
null >= 3.2.1, < 4.0.0

Modules

Name Source Version
attach_sg_to_api_vpe terraform-ibm-modules/security-group/ibm 2.6.1
attach_sg_to_lb terraform-ibm-modules/security-group/ibm 2.6.1
attach_sg_to_master_vpe terraform-ibm-modules/security-group/ibm 2.6.1
attach_sg_to_registry_vpe terraform-ibm-modules/security-group/ibm 2.6.1
cos_instance terraform-ibm-modules/cos/ibm 8.2.13

Resources

Name Type
ibm_container_addons.addons resource
ibm_container_vpc_cluster.autoscaling_cluster resource
ibm_container_vpc_cluster.cluster resource
ibm_container_vpc_worker_pool.autoscaling_pool resource
ibm_container_vpc_worker_pool.pool resource
ibm_resource_tag.cluster_access_tag resource
ibm_resource_tag.cos_access_tag resource
kubernetes_config_map_v1_data.set_autoscaling resource
null_resource.config_map_status resource
null_resource.confirm_lb_active resource
null_resource.confirm_network_healthy resource
null_resource.reset_api_key resource
ibm_container_addons.existing_addons data source
ibm_container_cluster_config.cluster_config data source
ibm_container_cluster_versions.cluster_versions data source
ibm_container_vpc_worker_pool.all_pools data source
ibm_is_lbs.all_lbs data source
ibm_is_virtual_endpoint_gateways.all_vpes data source

Inputs

Name Description Type Default Required
access_tags A list of access tags to apply to the resources created by the module, see https://cloud.ibm.com/docs/account?topic=account-access-tags-tutorial for more details list(string) [] no
additional_lb_security_group_ids Additional security groups to add to the load balancers associated with the cluster. Ensure that the number_of_lbs is set to the number of LBs associated with the cluster. This comes in addition to the IBM maintained security group. list(string) [] no
additional_vpe_security_group_ids Additional security groups to add to all existing load balancers. This comes in addition to the IBM maintained security group.
object({
master = optional(list(string), [])
registry = optional(list(string), [])
api = optional(list(string), [])
})
{} no
addons Map of OCP cluster add-on versions to install (NOTE: The 'vpc-block-csi-driver' add-on is installed by default for VPC clusters, however you can explicitly specify it here if you wish to choose a later version than the default one). For full list of all supported add-ons and versions, see https://cloud.ibm.com/docs/containers?topic=containers-supported-cluster-addon-versions
object({
debug-tool = optional(string)
image-key-synchronizer = optional(string)
openshift-data-foundation = optional(string)
vpc-file-csi-driver = optional(string)
static-route = optional(string)
cluster-autoscaler = optional(string)
vpc-block-csi-driver = optional(string)
})
null no
attach_ibm_managed_security_group Specify whether to attach the IBM-defined default security group (whose name is kube-) to all worker nodes. Only applicable if custom_security_group_ids is set. bool true no
cluster_config_endpoint_type Specify which type of endpoint to use for for cluster config access: 'default', 'private', 'vpe', 'link'. 'default' value will use the default endpoint of the cluster. string "default" no
cluster_name The name that will be assigned to the provisioned cluster string n/a yes
cluster_ready_when The cluster is ready when one of the following: MasterNodeReady (not recommended), OneWorkerNodeReady, Normal, IngressReady string "IngressReady" no
cos_name Name of the COS instance to provision for OpenShift internal registry storage. New instance only provisioned if 'enable_registry_storage' is true and 'use_existing_cos' is false. Default: '<cluster_name>_cos' string null no
custom_security_group_ids Security groups to add to all worker nodes. This comes in addition to the IBM maintained security group if attach_ibm_managed_security_group is set to true. If this variable is set, the default VPC security group is NOT assigned to the worker nodes. list(string) null no
disable_outbound_traffic_protection Whether to allow public outbound access from the cluster workers. This is only applicable for ocp_version 4.15 bool false no
disable_public_endpoint Whether access to the public service endpoint is disabled when the cluster is created. Does not affect existing clusters. You can't disable a public endpoint on an existing cluster, so you can't convert a public cluster to a private cluster. To change a public endpoint to private, create another cluster with this input set to true. bool false no
enable_registry_storage Set to true to enable IBM Cloud Object Storage for the Red Hat OpenShift internal image registry. Set to false only for new cluster deployments in an account that is allowlisted for this feature. bool true no
existing_cos_id The COS id of an already existing COS instance to use for OpenShift internal registry storage. Only required if 'enable_registry_storage' and 'use_existing_cos' are true string null no
force_delete_storage Flag indicating whether or not to delete attached storage when destroying the cluster - Default: false bool false no
ibmcloud_api_key APIkey that's associated with the account to use, set via environment variable TF_VAR_ibmcloud_api_key string n/a yes
ignore_worker_pool_size_changes Enable if using worker autoscaling. Stops Terraform managing worker count bool false no
kms_config Use to attach a KMS instance to the cluster. If account_id is not provided, defaults to the account in use.
object({
crk_id = string
instance_id = string
private_endpoint = optional(bool, true) # defaults to true
account_id = optional(string) # To attach KMS instance from another account
wait_for_apply = optional(bool, true) # defaults to true so terraform will wait until the KMS is applied to the master, ready and deployed
})
null no
manage_all_addons Instructs Terraform to manage all cluster addons, even if addons were installed outside of the module. If set to 'true' this module will destroy any addons that were installed by other sources. bool false no
number_of_lbs The number of LBs to associated the additional_lb_security_group_names security group with. number 1 no
ocp_entitlement Value that is applied to the entitlements for OCP cluster provisioning string "cloud_pak" no
ocp_version The version of the OpenShift cluster that should be provisioned (format 4.x). If no value is specified, the current default version is used. You can also specify default. This input is used only during initial cluster provisioning and is ignored for updates. To prevent possible destructive changes, update the cluster version outside of Terraform. string null no
operating_system The operating system of the workers in the default worker pool. If no value is specified, the current default version OS will be used. See https://cloud.ibm.com/docs/openshift?topic=openshift-openshift_versions#openshift_versions_available . string null no
region The IBM Cloud region where the cluster will be provisioned. string n/a yes
resource_group_id The Id of an existing IBM Cloud resource group where the cluster will be grouped. string n/a yes
tags Metadata labels describing this cluster deployment, i.e. test list(string) [] no
use_existing_cos Flag indicating whether or not to use an existing COS instance for OpenShift internal registry storage. Only applicable if 'enable_registry_storage' is true bool false no
verify_worker_network_readiness By setting this to true, a script will run kubectl commands to verify that all worker nodes can communicate successfully with the master. If the runtime does not have access to the kube cluster to run kubectl commands, this should be set to false. bool true no
vpc_id Id of the VPC instance where this cluster will be provisioned string n/a yes
vpc_subnets Metadata that describes the VPC's subnets. Obtain this information from the VPC where this cluster will be created
map(list(object({
id = string
zone = string
cidr_block = string
})))
n/a yes
worker_pools List of worker pools
list(object({
subnet_prefix = optional(string)
vpc_subnets = optional(list(object({
id = string
zone = string
cidr_block = string
})))
pool_name = string
machine_type = string
workers_per_zone = number
resource_group_id = optional(string)
labels = optional(map(string))
minSize = optional(number)
maxSize = optional(number)
enableAutoscaling = optional(bool)
boot_volume_encryption_kms_config = optional(object({
crk = string
kms_instance_id = string
kms_account_id = optional(string)
}))
additional_security_group_ids = optional(list(string))
}))
n/a yes
worker_pools_taints Optional, Map of lists containing node taints by node-pool name map(list(object({ key = string, value = string, effect = string }))) null no

Outputs

Name Description
api_vpe Info about the api VPE, if it exists. For more info about schema, see https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/data-sources/is_virtual_endpoint_gateway
cluster_crn CRN for the created cluster
cluster_id ID of cluster created
cluster_name Name of the created cluster
cos_crn CRN of the COS instance
ingress_hostname The hostname that was assigned to your Ingress subdomain.
kms_config KMS configuration details
master_status The status of the Kubernetes master.
master_url The URL of the Kubernetes master.
master_vpe Info about the master, or default, VPE. For more info about schema, see https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/data-sources/is_virtual_endpoint_gateway
ocp_version Openshift Version of the cluster
operating_system The operating system of the workers in the default worker pool.
private_service_endpoint_url Private service endpoint URL
public_service_endpoint_url Public service endpoint URL
region Region cluster is deployed in
registry_vpe Info about the registry VPE, if it exists. For more info about schema, see https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/data-sources/is_virtual_endpoint_gateway
resource_group_id Resource group ID the cluster is deployed in
vpc_id ID of the clusters VPC
vpe_url The virtual private endpoint URL of the Kubernetes cluster.
workerpools Worker pools created

Contributing

You can report issues and request features for this module in GitHub issues in the module repo. See Report an issue or request a feature.

To set up your local development environment, see Local development setup in the project documentation.

terraform-ibm-base-ocp-vpc's People

Contributors

aashiq-j avatar aayush-abhyarthi avatar ak-sky avatar akocbek avatar daniel-butler-irl avatar iamar7 avatar imprateeksh avatar jojustin avatar jor2 avatar khuzaima05 avatar kierramarie avatar marifse avatar matthewlemmond avatar mounika-nalla avatar ocofaigh avatar rajatagarwal-ibm avatar shemau avatar sirspidey avatar soaib024 avatar terraform-ibm-modules-ops avatar toddgiguere avatar vbontempi avatar vburckhardt avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

terraform-ibm-base-ocp-vpc's Issues

[terraform-ibm-base-ocp-vpc] Onboard new custom_sg to catalog

In #342 a new custom_sg example was added. We need a follow up PR to onboard it to catalog by adding it to:

  • ibm_catalog.json
  • .catalog-onboard-pipeline.yaml

NB: Ensure the [catalogValidationValues.json.template (https://github.com/terraform-ibm-modules/terraform-ibm-base-ocp-vpc/blob/main/examples/add_rules_to_sg/catalogValidationValues.json.template) is valid for the example as its used by catalog pipeline during onboarding

"zone" terminology is confusing and misleading

The prefix at https://github.com/terraform-ibm-modules/terraform-ibm-base-ocp-vpc/blob/main/variables.tf#L59 use the "zone-X" terminology. This is very prone to error as could be interpreted as "availability zones" when this actually denotes logical zones (segregation by subnet).

In fact, it seems that the examples are getting into this confusion - see #95

The default in the root module for worker_pools variable does not make sense either - as it is making assumptions on prefix on the subnets passed at https://github.com/terraform-ibm-modules/terraform-ibm-base-ocp-vpc/blob/main/variables.tf#L34

Leverage cos module to create the cos instance

Description

What: At https://github.com/terraform-ibm-modules/terraform-ibm-base-ocp-vpc/blob/main/main.tf#L37 . Use the COS module at https://github.com/terraform-ibm-modules/terraform-ibm-cos. Context is to be able to leverage the default compliant configuration from the COS module when creating the instance.

Note: there may be need to add moved blocks to ensure we do not break backward compatibility. https://developer.hashicorp.com/terraform/language/modules/develop/refactoring

New or affected modules

terraform-ibm-base-ocp-vpc


By submitting this issue, you agree to follow our Code of Conduct

hardcoded region in fscloud examples + some misleading doc

2 small issues:

  1. Here:
  2. description = "CRN of the Hyper Protect Crypto service to use to encrypt the cluster boot volume"
    and
    description = "CRN of the Hyper Protect Crypto service to use to encrypt the worker pool boot volumes"
    documentation that this is the crn to the HPCS service, when it is the crn to keys in HPCS.

Affected modules

Terraform CLI and Terraform provider versions

  • Terraform version:
  • Provider version:

Terraform output

Debug output

Expected behavior

Actual behavior

Steps to reproduce (including links and screen captures)

  1. Run terraform apply

Anything else


By submitting this issue, you agree to follow our Code of Conduct

Add validation block on ocp_version variable

Description

Description indicates to use "x.x" version (eg: 4.x), but consumers used to work with the provider directly may put the kube_version format (eg: "4.3_openshift"). It would be nice to add a validation block on the variable to catch this early at plan time.

(

variable "ocp_version" {
)

New or affected modules


By submitting this issue, you agree to follow our Code of Conduct

output vpe details

Description

If possible FQDN + 3 IP / AZ + ports for VPE master, oauth, container, ...

New or affected modules


By submitting this issue, you agree to follow our Code of Conduct

Automation to enable autoscaling on a given cluster

Description

Kubernetes managed add-ons specifically cluster autoscaler can be managed using ibm_container_addons. Code Engine team are doing this in their infrastructure, so we may be able to collaborate.

Since this related specifically to clusters which are already implemented in base-ocp-vpc it may be good to complete the auto scale exploitation in this module.

This covers the deployment and management of the add on, but I believe there is an additional component, so helm chart configuration and maybe a config map that controls the runtime behaviour.

New or affected modules

https://github.com/terraform-ibm-modules/terraform-ibm-base-ocp-vpc


By submitting this issue, you agree to follow our Code of Conduct

Add support for creating OCP cluster without an underlaying COS bucket

Description

Some regions do not longer require the need to pass a cos crn (allowlisted feature). There is a need to update the module to allow creating a cluster without a reference to a COS bucket. Suggest to allow cos_name to be set to null. If cos_name is null and use_existing_cos is false, then do not create any cos bucket and do not pass any cos reference to ibm_container_vpc_cluster

SG group lookup fails in add_rules_to_sg example

Seeing the following when running with examples/add_rules_to_sg with ocp 4.15

╷
│ Error: [ERROR] No Security Group found with name kube-r010-c3421cd0-e1bc-4c52-847d-c7769ad1220d
│ 
│   with data.ibm_is_security_group.kube_vpc_sg,
│   on main.tf line 61, in data "ibm_is_security_group" "kube_vpc_sg":
│   61: data "ibm_is_security_group" "kube_vpc_sg" {
│ 
╵

Use region and resource group when with ibm_container_cluster_versions

Pass region and resource group to ibm_container_cluster_versions when loading available versions to:

  • reduce loading time through the resource group
  • reduce risks of misalignment along different regions when loading available versions: during IKS platform updates the different regions may temporary return different list of version. By specifying the region the request is routed to the specific region going to be used to create the cluster and the configurations are expected to be coherent during updates.

output master vpe url

Description

Currently the module outputs private (CSE) and public urls only.
"private_service_endpoint_url" and "public_service_endpoint_url"

Version 4.13+ introduce a VPE url as well, ~~returned in the master_url so the module should also output it. Suggest "vpe_service_endpoint_url"

Update: master_url returns the VPE only in 4.13. 4.14 returns the CSE... There is a dependency on the provider returning the VPE address: IBM-Cloud/terraform-provider-ibm#5122

New or affected modules


By submitting this issue, you agree to follow our Code of Conduct

Problem with the deployement of terraform-ibm-base-ocp-vpc basic example

Deploying the basic example of terraform-ibm-base-ocp-vpc/examples/basic at main · terraform-ibm-modules/terraform-ibm-base-ocp-vpc · GitHub produces errors

Affected modules

(https://github.com/terraform-ibm-modules/terraform-ibm-base-ocp-vpc/tree/main/examples/basic)

Terraform CLI and Terraform provider versions

Terraform v1.6.6
on linux_amd64

  • provider registry.terraform.io/hashicorp/kubernetes v2.30.0
  • provider registry.terraform.io/hashicorp/null v3.2.2
  • provider registry.terraform.io/hashicorp/random v3.6.2
  • provider registry.terraform.io/hashicorp/time v0.11.2
  • provider registry.terraform.io/ibm-cloud/ibm v1.65.1

Terraform output

module.ocp_base.ibm_container_vpc_cluster.cluster[0]: Creation complete after 1h3m44s [id=cpg8c6af0nlda104kmp0]
module.ocp_base.data.ibm_container_cluster_config.cluster_config[0]: Reading...
module.ocp_base.data.ibm_container_vpc_worker_pool.all_pools["default"]: Reading...
module.ocp_base.data.ibm_container_addons.existing_addons: Reading...
module.ocp_base.data.ibm_container_vpc_worker_pool.all_pools["default"]: Read complete after 1s [id=cpg8c6af0nlda104kmp0-4233f38]
module.ocp_base.data.ibm_container_addons.existing_addons: Read complete after 1s [id=cpg8c6af0nlda104kmp0]
module.ocp_base.data.ibm_container_cluster_config.cluster_config[0]: Still reading... [10s elapsed]
module.ocp_base.data.ibm_container_cluster_config.cluster_config[0]: Still reading... [20s elapsed]
module.ocp_base.data.ibm_container_cluster_config.cluster_config[0]: Still reading... [30s elapsed]
module.ocp_base.data.ibm_container_cluster_config.cluster_config[0]: Still reading... [40s elapsed]

│ Error: [ERROR] Error downloading the cluster config [cpg8c6af0nlda104kmp0]: Get "https://c113-e.eu-de.containers.cloud.ibm.com:31049/.well-known/oauth-authorization-server": cannotconnect

│ with module.ocp_base.data.ibm_container_cluster_config.cluster_config[0],
│ on .terraform/modules/ocp_base/main.tf line 257, in data "ibm_container_cluster_config" "cluster_config":
│ 257: data "ibm_container_cluster_config" "cluster_config" {

│ ---
│ id: terraform-82a5043b
│ summary: '[ERROR] Error downloading the cluster config [cpg8c6af0nlda104kmp0]: Get
│ "https://c113-e.eu-de.containers.cloud.ibm.com:31049/.well-known/oauth-authorization-server":
│ cannotconnect'
│ severity: error
│ resource: (Data) ibm_container_cluster_config
│ operation: read
│ component:
│ name: github.com/IBM-Cloud/terraform-provider-ibm
│ version: 1.65.1
│ ---

Debug output

trace-log.txt

Expected behavior

Terraform apply exits successfully after creating the cluster

Actual behavior

Error: [ERROR] Error downloading the cluster config [cpg8c6af0nlda104kmp0]: Get "https://c113-e.eu-de.containers.cloud.ibm.com:31049/.well-known/oauth-authorization-server": cannotconnect

│ with module.ocp_base.data.ibm_container_cluster_config.cluster_config[0],
│ on .terraform/modules/ocp_base/main.tf line 257, in data "ibm_container_cluster_config" "cluster_config":
│ 257: data "ibm_container_cluster_config" "cluster_config" {

Steps to reproduce (including links and screen captures)

Terraform apply the basic example provided by the module, subsequent apply or plan will break

  1. Run terraform apply
  2. Run terraform plan or apply

By submitting this issue, you agree to follow our Code of Conduct

Adjust description for ingress hostname

Description

description = "Ingress hostname"

This is returning the subdomain however. Suggest to take the description from https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/container_vpc_cluster#ingress_hostname for now.

There is a separate ticket to change the output name IBM-Cloud/terraform-provider-ibm#5276 in provider. I think the module should change the name after the provider does to avoid confusion.

Ability to pass list of subnets or subnet prefix to support input from SLZ

Description

I'm also thinking that as part of this effort, we may want to give further flexibility in the ocp-base module. The ocp-base module takes a single input (the subnet name prefix) at the moment. The original support in landing-zone module support pointing to specific subnets by name (https://github.com/terraform-ibm-modules/terraform-ibm-landing-zone/blob/main/patterns/roks/override.json#L33). So we may want to also allow pointing to specific subnet names. This could take the form of adding an extra parameter at https://github.com/terraform-ibm-modules/terraform-ibm-base-ocp-vpc/blob/main/variables.tf#L45 that takes the list of subnet names. Either the prefix or the full list would be passed (but not both at the same time, module could add some logic errorring if both properties are set)

Affected modules

terraform-ibm-base-ocp-vpc


By submitting this issue, you agree to follow our Code of Conduct

Error: cannot list resource "pods" in API group

Affected modules

Consumer reporting this:

2024/02/23 16:05:59 Terraform apply | module.roks-cluster.null_resource.confirm_network_healthy[0]: Creating...
2024/02/23 16:05:59 Terraform apply | 2024-02-23T16:05:59.963Z [INFO] Starting apply for module.roks-cluster.null_resource.confirm_network_healthy[0]
2024/02/23 16:05:59 Terraform apply | 2024-02-23T16:05:59.963Z [DEBUG] module.roks-cluster.null_resource.confirm_network_healthy[0]: applying the planned Create change
2024/02/23 16:05:59 Terraform apply | module.roks-cluster.null_resource.confirm_network_healthy[0]: Provisioning with 'local-exec'...
2024/02/23 16:05:59 Terraform apply | module.roks-cluster.null_resource.confirm_network_healthy[0] (local-exec): Executing: ["/bin/bash" "-c" ".terraform/modules/roks-cluster/scripts/confirm_network_healthy.sh"]
2024/02/23 16:05:59 Terraform apply | module.roks-cluster.null_resource.confirm_network_healthy[0] (local-exec): Running script to ensure kube master can communicate with all worker nodes..
2024/02/23 16:06:00 Terraform apply | module.roks-cluster.null_resource.confirm_network_healthy[0] (local-exec): Error from server (Forbidden): pods is forbidden: User "IAM#serviceid-XYZ" cannot list resource "pods" in API group "" in the namespace "calico-system"
2024/02/23 16:06:00 Terraform apply | module.roks-cluster.null_resource.confirm_network_healthy[0] (local-exec): Success! Master can communicate with all worker nodes.
2024/02/23 16:06:00 Terraform apply | module.roks-cluster.null_resource.confirm_network_healthy[0]: Creation complete after 0s [id=]

I suspect this is happening at

while IFS='' read -r line; do PODS+=("$line"); done < <(kubectl get pods -n "${namespace}" | grep calico-node | cut -f1 -d ' ')

Consumer state that serviceId has got necessary permission. Assuming this is correct, the issue could potentially be caused by delays in RBAC sync - would be good to double check if this lines is in the CI logs.

The other aspect is that the check does not happen if the kubectl get pods returns an error (but the message says success).

Terraform CLI and Terraform provider versions

  • Terraform version:
  • Provider version:

Terraform output

Debug output

Expected behavior

Actual behavior

Steps to reproduce (including links and screen captures)

  1. Run terraform apply

Anything else


By submitting this issue, you agree to follow our Code of Conduct

Add kms boot volume encryption on default and additional worker pools

ocp_entitlement should be null by default instead of the value cloud_pak

A partner tried to use the basic examples. The provisioning failed because of the entitlement. Indeed, the basic example does not have not have the ocp_entitlement attribute specified. Thus, the value cloud_pak was used because it's by default. The default value should be null as most of the partners/client may want to start using ROKS with a Cloud Pak.

confirm_lb_active.sh is not functional on private only networks

https://github.com/terraform-ibm-modules/terraform-ibm-base-ocp-vpc/blob/v3.23.0/scripts/confirm_lb_active.sh

This code will attempt to connect through the public endpoint. This won't work when running the terraform logic on a schematics agent that does not have public connectivity.

Suggest to see if we can get the lb status through a kubectl command on the service. The module already allows to specify to go through VPE for kubectl

Other alternatives:

  1. Go through APIs with option to specific api endpoint to call (public,private,vpe)
  2. See whether we can configure the CLI to go through VPE. However, a quick look at indicates that this may not be supported. https://cloud.ibm.com/docs/cli?topic=cli-service-connection#cli-private-vpc

Standard and multiple MZR examples are not actually creating worker pools across AZs

The example at https://github.com/terraform-ibm-modules/terraform-ibm-base-ocp-vpc/blob/main/examples/standard/main.tf#L49 creates 3 worker pools, with one in each availability zone.

A typical MZR cluster would have each of its workpool spread across the 3 availability zones.

I think there is an issue here https://github.com/terraform-ibm-modules/terraform-ibm-base-ocp-vpc/blob/main/examples/standard/main.tf#L49

Instead of

  cluster_vpc_subnets = {
    zone-1 = [{
      id         = module.vpc.subnet_zone_list[0].id
      zone       = module.vpc.subnet_zone_list[0].zone
      cidr_block = module.vpc.subnet_zone_list[0].cidr
    }],
    zone-2 = [{
      id         = module.vpc.subnet_zone_list[1].id
      zone       = module.vpc.subnet_zone_list[1].zone
      cidr_block = module.vpc.subnet_zone_list[1].cidr
    }],
    zone-3 = [{
      id         = module.vpc.subnet_zone_list[2].id
      zone       = module.vpc.subnet_zone_list[2].zone
      cidr_block = module.vpc.subnet_zone_list[2].cidr
    }]
  }

There should probably be something along the lines of (not tested the syntax):

  cluster_vpc_subnets = {
    zone-1 = [
      for zone in module.vpc.subnet_zone_list :
      {
        id         = zone.id
        zone       = zone.zone
        cidr_block = zone.cidr_block
    }
    ]
    }

The other issue here in cluster_vpc_subnets is the prefix set to "zone-1". This is very confusing as this does not actually map to any zone in the ocp-base module. This key "zone-1" is what is referred to as "prefix" in the ocp-base module. I would name it "default" as it is used to defined the default worker pool lower in the code of the example.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.