Skip to main content

unique-container-port-name

Rec
Enabled in recommended preset.

Require container port names to be unique within a pod.

Examples

Correct manifest for this rule:

new Pod({
spec: {
containers: [
{
name: "a",
ports: [
{ containerPort: 80, name: "http" },
{ containerPort: 443, name: "https" }
]
}
]
}
});

Incorrect manifest for this rule:

new Pod({
spec: {
containers: [
{
name: "a",
ports: [
{ containerPort: 80, name: "http" },
{ containerPort: 443, name: "http" }
]
}
]
}
});
new Pod({
spec: {
containers: [
{
name: "a",
ports: [{ containerPort: 80, name: "http" }]
},
{
name: "b",
ports: [{ containerPort: 443, name: "http" }]
}
]
}
});