From 7b07bd0eaf17dd088928200e054065ae021710ab Mon Sep 17 00:00:00 2001 From: cdk8s-automation <81352262+cdk8s-automation@users.noreply.github.com> Date: Sun, 7 Apr 2024 02:27:59 -0700 Subject: [PATCH] fix(statefulsets): port name not included in headless service (#3077) (#3990) # Backport This will backport the following commits from `k8s-28/main` to `k8s-26/main`: - [fix(statefulsets): port name not included in headless service (#3077)](https://github.com/cdk8s-team/cdk8s-plus/pull/3077) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) --- src/stateful-set.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stateful-set.ts b/src/stateful-set.ts index 82da25f37..79b8527b1 100644 --- a/src/stateful-set.ts +++ b/src/stateful-set.ts @@ -154,7 +154,7 @@ export class StatefulSet extends workload.Workload implements IScalable { const myPorts = container.extractContainerPorts(this); const myPortNumbers = myPorts.map(p => p.number); - const ports: service.ServicePort[] = myPorts.map(p => ({ port: p.number, targetPort: p.number, protocol: p.protocol })); + const ports: service.ServicePort[] = myPorts.map(p => ({ port: p.number, targetPort: p.number, protocol: p.protocol, name: p.name })); if (ports.length === 0) { throw new Error(`Unable to create a service for the stateful set ${this.name}: StatefulSet ports cannot be determined.`); }