Giter VIP home page Giter VIP logo

Comments (5)

mstoetzer avatar mstoetzer commented on May 26, 2024 1

Okay, I'll try to be more precise.

When a service definition and the corresponding deployment is in the same YAML file, kube-linter is able to find both.

But if both definitions are split into two separate YAML files (e.g. services.yaml and deployment.yaml), kube-linter prints that the dangling-service check was not successful for that service, because it can't find a corresponding deployment.

So, it would be a super cool feature, if kube-linter could take care of different YAML files. But I know, this isn't easy.

from kube-linter.

mstoetzer avatar mstoetzer commented on May 26, 2024 1

Well, it works. Did some mistake on my side. Can be closed. Thanks for you time.

from kube-linter.

kreamkorokke avatar kreamkorokke commented on May 26, 2024

Hi @mstoetzer , I am not exactly sure about what is the request here. Do you mean that we should have a check to make sure we have yaml file per each k8s component in the application? And also to your second point, do you mean that we should make sure all relevant yaml definitions are in the same directory?

It will be the easiest for both of us if you could specify some expected input and output, and what is the current behavior vs/. expected behavior:)

We should probably have a template on filing issues moving forwards, and let me work on that in the mean time.

from kube-linter.

viswajithiii avatar viswajithiii commented on May 26, 2024

Hi @mstoetzer, kube-linter actually already does this -- it treats objects found in the same directory as belonging to the same "context", and lints them as a unit. So what you're asking for should already work.

Consider this example. Let's say you have deployment.yaml with the below:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: test
  namespace: test-ns
spec:
  selector:
    matchLabels:
      app: test
  template:
    metadata:
      namespace: test-ns
      labels:
        app: test
    spec:
      containers:
      - name: nginx
        image: nginx
        ports:
          - name: api
            containerPort: 8443

and service.yaml with the below:

apiVersion: v1
kind: Service
metadata:
  name: test
  namespace: test-ns
spec:
  ports:
  - name: https
    port: 443
    targetPort: api
  selector:
    app: test
  type: ClusterIP

in the same directory. If you run kube-linter lint . or kube-linter lint * in that directory, you should not see the dangling-service check fire. I just verified this locally as well.

from kube-linter.

viswajithiii avatar viswajithiii commented on May 26, 2024

Hi @mstoetzer, just wanted to check in on this. Did the above work for you?

from kube-linter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.