Skip to content

Proposal: pluggable rulesets for helm lint #2694

Closed

Description

@kyleschlosser

Helm provides a built in linter, accessed through the helm lint command, which provides basic validation of the chart contents.

In corporate and departmental scenarios, a team may want to augment the built in linting capabilities with their own linting rules, for example:

service.type=ClusterIP --> Default service type must be ClusterIP if a service is defined
resources != nil --> resources limits and requests must be defined for all charts

To provide this capability, the existing plugin mechanism within Helm could be utilized, augmenting the plugin.yaml metadata attributes with indicators that a plugin contains linting rules:

name: "mylinter"
...
linter: true

When the helm lint command is run, the internal lint rules would first be evaluated, followed by any lint plugins. The results of the internal linter and various plugins would be accumulated before being presented to the user.

See issue #1495

Activity

  1. changed the title [-]Pluggable lint rules[/-] [+]Proposal: Pluggable lint rules[/+] on Jul 17, 2017
  2. thomastaylor312 commented on Jul 17, 2017

    @thomastaylor312
    Contributor

    @kyleschlosser Can you give an example of what this would look like? I think that would help solidify this a bit

  3. kyleschlosser commented on Jul 17, 2017

    @kyleschlosser
    Author

    My organization requires that the values.yml contain specific content. I suspect that not all organizations would want to enforce some of these rules, for example:

    • service.type=ClusterIP --> Default service type must be ClusterIP if a service is defined
    • resources != nil --> resources limits and requests must be defined for all charts

    Since Helm already has a plugin mechanism, perhaps linters could be accounted for within that framework rather than trying to find another way to plugin validation rules.

  4. thomastaylor312 commented on Jul 19, 2017

    @thomastaylor312
    Contributor

    So the proposal is to flag a plugin as containing a linting plugin, and add the logic to helm to handle that properly, correct? Just want to make sure it is as clear as possible 🙂. Then we'll see if anyone has comments and I'll close the original issue

  5. kyleschlosser commented on Aug 10, 2017

    @kyleschlosser
    Author

    Yes, that's right. I have updated the opening comment to better reflect that.

  6. changed the title [-]Proposal: Pluggable lint rules[/-] [+]Proposal: pluggable rulesets for helm lint[/+] on Nov 1, 2017
  7. added this to the Upcoming - Major milestone on Nov 1, 2017
  8. fejta-bot commented on Jan 30, 2018

    @fejta-bot

    Issues go stale after 90d of inactivity.
    Mark the issue as fresh with /remove-lifecycle stale.
    Stale issues rot after an additional 30d of inactivity and eventually close.

    If this issue is safe to close now please do so with /close.

    Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
    /lifecycle stale

  9. bacongobbler commented on Jan 31, 2018

    @bacongobbler
    Member

    /remove-lifecycle stale
    /lifecycle frozen

  10. darrenhaken commented on Aug 2, 2018

    @darrenhaken

    Has any work been done on this?

  11. Overbryd commented on Sep 10, 2018

    @Overbryd

    I am commenting here to not let this get stale or deleted.
    This would help us in validating packages submitted in our CI.

    I can image optional checks like would be pretty common, and could greatly enhance the value of helm lint:

    # checks if a livenessProbe, readinessProbe is present and properly configured
    --check=livenessProbe
    --check=readinessProbe
    # checks if resource requests (memory and cpu) are configured
    --check=resources.requests
    # checks if memory resource requests are configured
    --check=resources.requests.memory
    # checks if cpu resource limits are configured
    --check=resources.limits.cpu
    

    Edit: For everybody who lands here through a Google search, you may want to have a look at this 3rd party project: https://github.com/helm/chart-testing
    It combines a YAML-schema validator with helm lint into a docker image that can run custom chart linting + validation.

  12. kbambridge commented on Mar 23, 2019

    @kbambridge

    I would like to be able to use .helm extensions without the linter complaining to differentiate from standard yaml for our file validators.

  13. added
    v3.x
    and removed
    v3.x
    on Mar 23, 2019
  14. cabrinoob commented on May 16, 2019

    @cabrinoob

    This feature would be very useful. I vote for it!

  15. removed this from the Upcoming - Major milestone on Sep 5, 2020
  16. bridgetkromhout commented on Sep 5, 2020

    @bridgetkromhout
    Member

    Hi, all - many changes have been made to the linter since this issue was opened. If you have a remaining request, we now have a defined process so that if you'd like, you can submit a Helm Improvement Proposal so as to work in the community to make these ideas a reality: https://github.com/helm/community/blob/master/hips/hip-0001.md - meanwhile, I will close this issue. Thanks!

  17. jspiro commented on Oct 22, 2020

    @jspiro

    +1 – I came looking specifically for a way to ensure certain resources exist, e.g. limits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    proposalv3.x

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions