Skip to content

missing containerPort not detected #416

@devopsmash

Description

@devopsmash

Which version of kube-score are you using?
1.13.0

What did you do?
deploy.yaml

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: app
          containerPort: 80
          protocol: TCP
        - name: smtp
          containerPort: 
          protocol: TCP

What did you expect to see?

error when missing values like containerPort on that case

What did you see instead?

No error exist, but when your try to deploy it on k8s cluster you get

Error: Failed to render chart: exit status 1: Error: unable to build kubernetes objects from release manifest: error validating "": error validating data: ValidationError(Deployment.spec.template.spec.containers[0].ports[1]): missing required field "containerPort" in io.k8s.api.core.v1.ContainerPort

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions