Skip to content

Commit

Permalink
fix(statefulsets): port name not included in headless service (#3077) (
Browse files Browse the repository at this point in the history
…#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)](#3077)



### Questions ?
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
  • Loading branch information
cdk8s-automation authored Apr 7, 2024
1 parent 18d4faf commit 7b07bd0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/stateful-set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.`);
}
Expand Down

0 comments on commit 7b07bd0

Please sign in to comment.