public-cloud-examples icon indicating copy to clipboard operation
public-cloud-examples copied to clipboard

Update the wordpress example

Open yomovh opened this issue 1 year ago • 3 comments
trafficstars

  • Add private network
  • Update documentation to access to wordpress backoffice

yomovh avatar Mar 14 '24 13:03 yomovh

Hi, thanks for the PR.

First things, can you fix the conflicts?

Also, I added several suggestions and remarks, please take a look at them.

By the way, in the README file I recommend also to change "Mysql" to "MySQL" Finally, the schema displayed in the README file, does not reflect the actual use case (it seems that there is no Prometheus, Grafana, Fluentd, Opensearch and M3DB) & resources are running in a private network can you edit it?

And, the most important, the example is currently not working for me, when I'm trying to deploy the Kubernetes cluster:

$ terraform apply -var-file=../variables_01.tfvars -auto-approve

data.openstack_networking_network_v2.ext_net: Reading...
data.openstack_networking_network_v2.ext_net: Read complete after 2s [id=6c928965-xxxx-xxxx-xxxx-6d4a152e9745]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the
following symbols:
  + create
 <= read (data resources)

Terraform will perform the following actions:

  # data.ovh_cloud_project_kube_nodepool_nodes.nodes will be read during apply
  # (config refers to values not yet known)
 <= data "ovh_cloud_project_kube_nodepool_nodes" "nodes" {
      + id      = (known after apply)
      + kube_id = (known after apply)
      + name    = "wordpress-node-pool"
      + nodes   = (known after apply)
    }

  # local_file.kubeconfig_file will be created
  + resource "local_file" "kubeconfig_file" {
      + content              = (sensitive value)
      + content_base64sha256 = (known after apply)
      + content_base64sha512 = (known after apply)
      + content_md5          = (known after apply)
      + content_sha1         = (known after apply)
      + content_sha256       = (known after apply)
      + content_sha512       = (known after apply)
      + directory_permission = "0777"
      + file_permission      = "0777"
      + filename             = "kubeconfig.yml"
      + id                   = (known after apply)
    }

  # openstack_networking_network_v2.network will be created
  + resource "openstack_networking_network_v2" "network" {
      + admin_state_up          = (known after apply)
      + all_tags                = (known after apply)
      + availability_zone_hints = (known after apply)
      + dns_domain              = (known after apply)
      + external                = (known after apply)
      + id                      = (known after apply)
      + mtu                     = (known after apply)
      + name                    = "private_network"
      + port_security_enabled   = (known after apply)
      + qos_policy_id           = (known after apply)
      + region                  = (known after apply)
      + shared                  = (known after apply)
      + tenant_id               = (known after apply)
      + transparent_vlan        = (known after apply)
    }

  # openstack_networking_router_interface_v2.router_itf_priv will be created
  + resource "openstack_networking_router_interface_v2" "router_itf_priv" {
      + id        = (known after apply)
      + port_id   = (known after apply)
      + region    = (known after apply)
      + router_id = (known after apply)
      + subnet_id = (known after apply)
    }

  # openstack_networking_router_v2.router will be created
  + resource "openstack_networking_router_v2" "router" {
      + admin_state_up          = (known after apply)
      + all_tags                = (known after apply)
      + availability_zone_hints = (known after apply)
      + distributed             = (known after apply)
      + enable_snat             = (known after apply)
      + external_gateway        = (known after apply)
      + external_network_id     = "6c928965-xxxx-xxxx-xxxx-6d4a152e9745"
      + id                      = (known after apply)
      + name                    = "router"
      + region                  = (known after apply)
      + tenant_id               = (known after apply)
    }

  # openstack_networking_subnet_v2.subnet will be created
  + resource "openstack_networking_subnet_v2" "subnet" {
      + all_tags          = (known after apply)
      + cidr              = "10.0.0.0/24"
      + dns_nameservers   = [
          + "213.186.33.99",
        ]
      + enable_dhcp       = true
      + gateway_ip        = "10.0.0.254"
      + id                = (known after apply)
      + ip_version        = 4
      + ipv6_address_mode = (known after apply)
      + ipv6_ra_mode      = (known after apply)
      + name              = "subnet"
      + network_id        = (known after apply)
      + no_gateway        = false
      + region            = (known after apply)
      + tenant_id         = (known after apply)
    }

  # ovh_cloud_project_kube.wordpress_kube_cluster will be created
  + resource "ovh_cloud_project_kube" "wordpress_kube_cluster" {
      + control_plane_is_up_to_date = (known after apply)
      + id                          = (known after apply)
      + is_up_to_date               = (known after apply)
      + kube_proxy_mode             = (known after apply)
      + kubeconfig                  = (sensitive value)
      + kubeconfig_attributes       = (sensitive value)
      + name                        = "wordpress_kube_cluster"
      + next_upgrade_versions       = (known after apply)
      + nodes_url                   = (known after apply)
      + private_network_id          = (known after apply)
      + region                      = "GRA11"
      + service_name                = "xxxxxxxxxxxxxxxxxxxxxxxx"
      + status                      = (known after apply)
      + update_policy               = (known after apply)
      + url                         = (known after apply)
      + version                     = (known after apply)

      + private_network_configuration {
          + private_network_routing_as_default = true
        }
    }

  # ovh_cloud_project_kube_nodepool.wordpress_node_pool will be created
  + resource "ovh_cloud_project_kube_nodepool" "wordpress_node_pool" {
      + anti_affinity                                = (known after apply)
      + autoscale                                    = (known after apply)
      + autoscaling_scale_down_unneeded_time_seconds = (known after apply)
      + autoscaling_scale_down_unready_time_seconds  = (known after apply)
      + autoscaling_scale_down_utilization_threshold = (known after apply)
      + available_nodes                              = (known after apply)
      + created_at                                   = (known after apply)
      + current_nodes                                = (known after apply)
      + desired_nodes                                = 3
      + flavor                                       = (known after apply)
      + flavor_name                                  = "b2-7"
      + id                                           = (known after apply)
      + kube_id                                      = (known after apply)
      + max_nodes                                    = 3
      + min_nodes                                    = 3
      + monthly_billed                               = (known after apply)
      + name                                         = "wordpress-node-pool"
      + project_id                                   = (known after apply)
      + service_name                                 = "xxxxxxxxxxxxxxxxxxxxxxxx"
      + size_status                                  = (known after apply)
      + status                                       = (known after apply)
      + up_to_date_nodes                             = (known after apply)
      + updated_at                                   = (known after apply)
    }

Plan: 7 to add, 0 to change, 0 to destroy.

Changes to Outputs:
  + network        = {
      + admin_state_up          = (known after apply)
      + all_tags                = (known after apply)
      + availability_zone_hints = (known after apply)
      + description             = null
      + dns_domain              = (known after apply)
      + external                = (known after apply)
      + id                      = (known after apply)
      + mtu                     = (known after apply)
      + name                    = "private_network"
      + port_security_enabled   = (known after apply)
      + qos_policy_id           = (known after apply)
      + region                  = (known after apply)
      + segments                = []
      + shared                  = (known after apply)
      + tags                    = null
      + tenant_id               = (known after apply)
      + timeouts                = null
      + transparent_vlan        = (known after apply)
      + value_specs             = null
    }
  + nodepool_nodes = {
      + id           = (known after apply)
      + kube_id      = (known after apply)
      + name         = "wordpress-node-pool"
      + nodes        = (known after apply)
      + service_name = null
    }
  + subnet         = {
      + all_tags          = (known after apply)
      + allocation_pool   = (known after apply)
      + allocation_pools  = (known after apply)
      + cidr              = "10.0.0.0/24"
      + description       = null
      + dns_nameservers   = [
          + "213.186.33.99",
        ]
      + enable_dhcp       = true
      + gateway_ip        = "10.0.0.254"
      + host_routes       = []
      + id                = (known after apply)
      + ip_version        = 4
      + ipv6_address_mode = (known after apply)
      + ipv6_ra_mode      = (known after apply)
      + name              = "subnet"
      + network_id        = (known after apply)
      + no_gateway        = false
      + prefix_length     = null
      + region            = (known after apply)
      + subnetpool_id     = null
      + tags              = null
      + tenant_id         = (known after apply)
      + timeouts          = null
      + value_specs       = null
    }
openstack_networking_network_v2.network: Creating...
openstack_networking_router_v2.router: Creating...
openstack_networking_network_v2.network: Creation complete after 7s [id=9c5e8dbf-xxxxx-xxxx-xxxxx-5b9b6facd376]
ovh_cloud_project_kube.wordpress_kube_cluster: Creating...
openstack_networking_subnet_v2.subnet: Creating...
openstack_networking_router_v2.router: Still creating... [10s elapsed]
openstack_networking_subnet_v2.subnet: Creation complete after 6s [id=494aeb73-xxxx-xxxx-xxxx-7a9afd5cfa9f]
openstack_networking_router_v2.router: Creation complete after 18s [id=d11021c9-xxxx-xxxx-xxxx-a6eefb0f2e3c]
openstack_networking_router_interface_v2.router_itf_priv: Creating...
openstack_networking_router_interface_v2.router_itf_priv: Creation complete after 9s [id=5fdca75e-xxxx-xxxx-xxxx-92224ccb5f91]
╷
│ Error: calling Post /cloud/project/xxxxxxxxxxxxxxxxxxxxxxxx/kube with params wordpress_kube_cluster (GRA11):
│        OVHcloud API error (status code 400): Client::BadRequest: "[InvalidDataError] 400: Private network 9c5e8dbf-xxxxx-xxxx-xxxxx-5b9b6facd376 does not exist (request ID: d5538400-adbd-4a10-a3a7-518a664a1f80)" (X-OVH-Query-Id: EU.ext-2.xxxxxxxxxxxxxxxxxxxxx)
│ 
│   with ovh_cloud_project_kube.wordpress_kube_cluster,
│   on main.tf line 2, in resource "ovh_cloud_project_kube" "wordpress_kube_cluster":
│    2: resource "ovh_cloud_project_kube" "wordpress_kube_cluster" {

Thanks

scraly avatar Mar 18 '24 14:03 scraly

I have made a change in the content by removing as suggested the dependency towards openstack provider.

The requested changes have normally been adressed (since I updated the content, I may have missed some).

Thanks for the review.

yomovh avatar May 06 '24 10:05 yomovh

@yomovh can you clarify (by closing the request with a comment) when you don't want to apply @scraly's suggestion to have a more readable PR for people like me that comes at the end of the PR (this lets me know if the changes are completed or not).

The main point mentioned by @scraly was that the code wasn't executing, is that fixed with your updates?

philippart-s avatar May 23 '24 11:05 philippart-s

Hello,

@philippart-s It was already running fine on my machine ;-) though the pre requisites list was quite long. This is why I took the remark to remove the openstack provider dependency which should lead to an easier reproducibility.

As you suggested I also closed the comments that I took into account (see my comment)

yomovh avatar May 23 '24 12:05 yomovh

thanks, it's easier for me to valid the PR 😉

philippart-s avatar May 23 '24 12:05 philippart-s