Skip to content

Annotations that are given at template level are not considered and complains that annotation doesn't exist. #207

Open
@s-u-b-h-a-k-a-r

Description

@s-u-b-h-a-k-a-r

System info:

  • OS: Linux

Describe the bug
Annotations that are given at template level are not considered and complains that annotation doesn't exist.

To Reproduce

Sample YAML input
config.yaml

checks:
  addAllBuiltIn: false
  doNotAutoAddDefaults: true
  include:
  - no-liveness-probe
  - no-readiness-probe
  - unset-cpu-requirements
  - unset-memory-requirements
  - dangling-service
  - default-service-account
  - deprecated-service-account-field
  - env-var-secret
  - no-extensions-v1beta
  - mismatching-selector
  exclude:
customChecks:
  - name: required-annotation-app-ui
    template: required-annotation
    params:
      key: app/ui
    remediation: set the app/ui  annotation please :)
    scope:
      objectKinds:
        - DeploymentLike

deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: test-deployment
  labels:
    app.kubernetes.io/instance: RELEASE-NAME
spec:
  replicas:
  revisionHistoryLimit: 3
  selector:
    matchLabels:
      app.kubernetes.io/name: test-deployment
      app.kubernetes.io/instance: RELEASE-NAME
  template:
    metadata:
      annotations:
        app/ui: true
      labels:
        app.kubernetes.io/name: test-deployment
        app.kubernetes.io/instance: RELEASE-NAME

Expected behavior
When we run kube-linter lint deployment.yaml --config config.yaml the linter complains that annotation is not present. but it should not complain as we have annotation at template level which will be propogated to pod

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions