Giter Site home page Giter Site logo

crossplane-lint's People

Contributors

mistermx avatar mitsuwa avatar simonvhb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

crossplane-lint's Issues

Linter should not fail on missing claimNames for XRDs that are designed to be XR only

I've tried to execute linter against https://github.com/upbound/platform-ref-aws/ and got the following feedback

dist/crossplane-lint_linux_amd64_v1/crossplane-lint package -f /home/xnull/upbound/platform-ref-aws/package
crossplane-lint: error: failed to register package schemas: failed to build claim CRD: invalid resource claim names: missing names

Related code: https://github.com/crossplane-contrib/crossplane-lint/blob/main/internal/xpkg/lint/schema/xcrd.go#L191-L194

Apparently linter is very opinionated in the expectation that every XRD should have associated Claim and inherently claimNames.

At the same time XR-only XRDs without claimNames defined are totally valid scenario for the cases like

Suggested rules

Thanks for building this - I expect it will be very useful.

What do you think about having the linter warn if folks aren't following "best practices"? These aren't things that would break a Configuration or Composition, but they are things that make them more readable, and in some cases "future proof" them.

The two examples that immediately come to mind are:

  • Warn if any entries in the resources array are missing a name field. When this is the case Composition operates in a kind of "legacy mode". It can't support deleting or reordering entries in the resources array, and can't support Composition Functions.
  • Warn if any type field is missing. This is mostly a readability thing - we introduced a couple of type fields as optional when they probably should have been required. I think writing the type out each time makes it more obvious what the Composition is doing.

only download the layer io.crossplane.xpkg: base

Currently, when including a provider package in .crossplane-lint.yaml all the OCI image layers are downloaded from the registry, including the go binary of the respective provider. However we are just interested in the CRDs so that we can validate the compositions against them.

Following the xpkg specification we should be able to look at the OCI manifest and download only the image with the annotation "io.crossplane.xpkg": "base". It contains a package.yaml with the yaml stream.

Here is a live example. Click on the digest to dive deeper:
https://explore.ggcr.dev/?image=crossplanecontrib/provider-gitlab@sha256:3dd3d5b6f0fe600a2b43adbcf0e2ce289aff3838ffcab43e98ee37e9a231654b&mt=application%2Fvnd.docker.distribution.manifest.v2%2Bjson&size=1006

Check if MR fields do not comply with provider CRDs schema

Thank you for putting this together, the tool is very useful, especially that it's a CLI and can be run in a pipeline.

Are there plans on the roadmap to validate MRs for nonexistent or incorrect fields? We are very conscious about paying compositions tax and often use plain MRs for simpler, non-repeatable deployments. Having validation rules check if fields in a given MR are missing, added or incorrect would help catch errors much earlier.

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.