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

stable apiVersion check not working for kind: Ingress

bcha opened this issue · comments

Which version of kube-score are you using?

kube-score version: 1.13.0. We're building nightly & using latest for kube-score.

What did you do?

We're using kube-score as part of our CICD to catch some common mistakes, deprecations etc. Ran as:

$ kube-score score ./k8s/overlays/${ENVIRONMENT}/kustomized/${ENVIRONMENT}.yml --kubernetes-version "v1.21" --ignore-container-cpu-limit --ignore-test container-image-tag --ignore-test pod-networkpolicy

Full yaml for ingress object:

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  annotations:
    ingress.kubernetes.io/ssl-proxy-headers: X-Forwarded-Proto:https
    ingress.kubernetes.io/ssl-redirect: "true"
    kubernetes.io/ingress.class: public-traefik-v1
  labels:
    env: prod
  name: irrelevant-ingress
spec:
  rules:
  - host: irrelevant.com
    http:
      paths:
      - backend:
          serviceName: irrelevant-service
          servicePort: 8080
        path: /

What did you expect to see?

kube-score should warn about deprecated Ingress apiVersion, it has been deprecated since 1.19 & will be removed in 1.22: https://v1-19.docs.kubernetes.io/docs/setup/release/notes/#api-change
We're currently running on EKS with 1.21 & specifying the kube version to kube-score as well.

What did you see instead?

kube-score warns about deprecated PDB but not about deprecated Ingress apiVersion:

networking.k8s.io/v1beta1/Ingress irrelevant-ingress    ✅
policy/v1beta1/PodDisruptionBudget irrelevant-pdb      🤔
    [WARNING] Stable version
        · The apiVersion and kind policy/v1beta1/PodDisruptionBudget is deprecated
            It's recommended to use policy/v1 instead which has been available
            since Kubernetes v1.21

Thanks for a great bug report, this has been added and will be included in the next release!