Skip to content

Allow specifying loadBalancerClass #3951

Open
@yaraskm

Description

@yaraskm

Overview

When exposing a Service of type LoadBalancer, it can be useful to set the .spec.loadBalancerClass field in case there are multiple implementations in the cluster and none of them are set as the default.

Use Case

Say that you're trying to expose the primary replica via a LoadBalancer. Currently, there is no field in the PostgresClusters spec to set additional properties, such as loadBalancerClass. If this can't be set via the PostgresClusters object, then the options are either:

  • Use a mutating admission webhook on the cluster to set the loadBalancerClass if one is not set

OR

  • Create an additional Service object in the namespace and set it's label selectors to point to the desired Pod

Desired Behavior

The PostgresClusters CRD, and any other resource that allows creating a Service of type LoadBalancer, should allow setting the loadBalancerClass and propagating this onto the generated Service object(s).

Environment

Environment agnostic, but in our case we're using multiple copies of MetalLB to provide multiple LoadBalancer implementations, without a default set for the cluster.

  • Platform: Kubernetes
  • Platform Version: 1.26.17
  • PGO Image Tag: ubi8-5.6.0-0
  • Postgres Version: 15

Additional Information

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions