@@ -245,6 +245,43 @@ The possible formats are:
245245- `<pn-id>` : will attach a single Private Network to the LB.
246246- `<pn-id>,<pn-id>` : will attach the two Private Networks to the LB.
247247
248+ # ## `service.beta.kubernetes.io/scw-loadbalancer-pn-names`
249+
250+ This is the annotation to configure the Private Networks by name instead of ID.
251+ The private network names will be resolved to IDs at runtime. This is useful when
252+ you want to specify private networks without hardcoding their IDs, which can change
253+ when clusters are recreated.
254+
255+ **Priority order:**
256+ 1. `service.beta.kubernetes.io/scw-loadbalancer-pn-ids` (highest priority)
257+ 2. `service.beta.kubernetes.io/scw-loadbalancer-pn-names`
258+ 3. `PN_ID` environment variable (fallback)
259+
260+ If both `pn-ids` and `pn-names` are set, `pn-ids` takes precedence and `pn-names` is ignored.
261+ This annotation is ignored when `service.beta.kubernetes.io/scw-loadbalancer-externally-managed` is enabled.
262+
263+ The format must be `<vpc-name>/<pn-name>` to specify both the VPC and the private network name.
264+ Multiple entries can be comma-separated.
265+
266+ **Examples:**
267+ ` ` ` yaml
268+ # Single private network
269+ service.beta.kubernetes.io/scw-loadbalancer-pn-names: "default/my-private-network"
270+
271+ # Multiple networks from different VPCs
272+ service.beta.kubernetes.io/scw-loadbalancer-pn-names: "prod-vpc/network-1,staging-vpc/network-2"
273+
274+ # Multiple networks from the same VPC
275+ service.beta.kubernetes.io/scw-loadbalancer-pn-names: "default/network-1,default/network-2"
276+ ` ` `
277+
278+ **Error handling:**
279+ - If the format is invalid (missing VPC or PN name), an error is returned.
280+ - If a private network name is not found, an error is returned.
281+ - If multiple private networks have the same name within the VPC, an error is returned.
282+ - If the specified VPC is not found, an error is returned.
283+ - If multiple VPCs have the same name, an error is returned.
284+
248285# ## `service.beta.kubernetes.io/scw-loadbalancer-health-check-from-service`
249286
250287This is the annotation to configure the load balancer backend to use the service's `healthCheckNodePort` for health checks.
0 commit comments