zegl / kube-score

Kubernetes object analysis with recommendations for improved reliability and security. kube-score actively prevents downtime and bugs in your Kubernetes YAML and Charts. Static code analysis for Kubernetes.

Home Page:https://kube-score.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: fail if port name is longer than 15 characters

devopsmash opened this issue · comments

in case that you have Deployment.yaml with port name that contains more than 15 character, the k8s will fail the deployment with the following error

Error: Deployment.apps "my-app" is invalid: spec.template.spec.containers[0].ports[0].name: Invalid value: "my-old-app-legacy": must be no more than 15 characters

it will be awesome if kube-score will be able to detect cases like that before the Deployment

example:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: app
  labels:
    app: app
spec:
  selector:
    matchLabels:
      app: app
  template:
    metadata:
      labels:
        app: app
    spec:
      nodeSelector:
        beta.kubernetes.io/os: linux
      containers:
      - name: app
        image: app:dev
        imagePullPolicy: "Always"
        ports:
        - name: my-old-app-legacy
          containerPort: 80
          protocol: TCP

@dsaydon90 and @zegl, I will fix this

@zegl -- This issue can be closed. Fix delivered and merged last May.