Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define service attachment interface for lb modules and implement in internal LBs #2122

Merged
merged 14 commits into from Mar 2, 2024

Conversation

ludoo
Copy link
Collaborator

@ludoo ludoo commented Feb 29, 2024

In keeping with the Fabric module design principles, PSC service attachment definition should be supported as an optional but integral part of our load balancer modules.

This PR defines the variable interface for a service attachment, and implements it in two key modules:

  • net-app-lb-int with an interface supporting a single forwarding rule
  • net-lb-int with the same interface but supporting multiple forwarding rules

This is an actual working example of the multi-forwarding rules interface for the passthrough modules, the simpler single forwarding rule interface is identical but with a single object in its type:

module "simple-ilb-l4-producer" {
  source     = "../cloud-foundation-fabric/modules/net-lb-int"
  project_id = module.simple-project.project_id
  region     = "europe-west8"
  name       = "ilb-l4-test-producer"
  backends = [{
    group = module.simple-vm-nginx.group.id
  }]
  forwarding_rules_config = {
    port-80 = {
      ports = [80]
    }
    port-8080 = {
      ports = [8080]
    }
  }
  vpc_config = {
    network    = module.simple-vpc.id
    subnetwork = module.simple-vpc.subnet_ids["europe-west8/default"]
  }
  service_attachments = {
    port-80 = {
      nat_subnets          = [module.simple-vpc.subnets_psc["europe-west8/playground-psc-l4-80"].id]
    }
    port-8080 = {
      nat_subnets          = [module.simple-vpc.subnets_psc["europe-west8/playground-psc-l4-8080"].id]
      automatic_connection = true
    }
  }
}

This PR also contains a small fix to the net-lb-int that allows direct referencing the module-managed group by key, aligning it to the behaviour in more recent lb modules.

It also does some code hygiene by adding missing TOCs to READMEs, and renaming the forwarding rules resource in the passthrough modules to conform it to our usual standard.

@ludoo ludoo requested a review from wiktorn February 29, 2024 23:18
@ludoo ludoo changed the title Define service attachment interface for ln modules and implement in net-lb-app-int Define service attachment interface for lb modules and implement in net-lb-app-int Feb 29, 2024
@ludoo ludoo changed the title Define service attachment interface for lb modules and implement in net-lb-app-int Define service attachment interface for lb modules and implement in internal LBs Mar 1, 2024
@ludoo ludoo enabled auto-merge (squash) March 1, 2024 11:20
Copy link
Collaborator

@wiktorn wiktorn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with psc-glb-and-armor blueprint

modules/net-lb-int/README.md Outdated Show resolved Hide resolved
modules/net-lb-app-int/README.md Outdated Show resolved Hide resolved
modules/net-lb-int/main.tf Outdated Show resolved Hide resolved
modules/net-lb-app-int/main.tf Outdated Show resolved Hide resolved
modules/net-lb-app-int/README.md Show resolved Hide resolved
ludoo and others added 6 commits March 2, 2024 16:15
Co-authored-by: Wiktor Niesiobędzki <wiktorn@google.com>
Co-authored-by: Wiktor Niesiobędzki <wiktorn@google.com>
Co-authored-by: Wiktor Niesiobędzki <wiktorn@google.com>
Co-authored-by: Wiktor Niesiobędzki <wiktorn@google.com>
Co-authored-by: Wiktor Niesiobędzki <wiktorn@google.com>
@ludoo ludoo merged commit 525684f into master Mar 2, 2024
13 checks passed
@ludoo ludoo deleted the ludo/net-lb-service-attachment-interface branch March 2, 2024 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants