Disable Helm v3 json schema validation

2 min read 05-10-2024
Disable Helm v3 json schema validation


How to Disable Helm v3's JSON Schema Validation: A Practical Guide

Helm v3 introduced JSON schema validation for charts, ensuring that your chart files adhere to a defined structure and prevent common errors. While this is a powerful feature, there might be situations where you need to temporarily disable it for specific scenarios. This article guides you through the process of disabling JSON schema validation in Helm v3, along with best practices and considerations.

Understanding the Need to Disable Validation

Imagine you're working with a legacy chart that doesn't fully comply with the latest schema requirements. You might encounter errors during installation or upgrade due to these inconsistencies. Disabling schema validation provides a workaround, allowing you to proceed with your tasks while acknowledging the potential risks.

Original Scenario and Code Example

Let's assume you have a legacy chart my-app with a values.yaml file that doesn't follow the current schema:

# values.yaml
myApp:
  # ... (legacy fields) 

When trying to install or upgrade this chart using Helm, you might encounter the following error:

Error: YAML validation failed:
  ...
  ... (errors related to schema violation)
  ...

Disabling Validation - The --validate=false Flag

The simplest method to disable JSON schema validation is to use the --validate=false flag when running your Helm commands:

helm install my-app my-chart --validate=false 

Important Considerations

  • Temporary Solution: Disabling schema validation is meant to be a temporary workaround. Aim to address the underlying schema inconsistencies in your chart to improve long-term stability.
  • Potential Risks: By disabling validation, you risk introducing unforeseen errors due to invalid data structures. Always thoroughly test your charts after applying this workaround.
  • Alternative Solutions: Before disabling validation, consider alternative approaches:
    • Upgrade your chart: Update your chart to meet the latest schema requirements.
    • Customize the schema: If you need to work with a specific version or format, consider creating a custom schema for your chart.

Best Practices

  • Isolate the Workaround: Only disable validation for specific operations or charts where it's absolutely necessary.
  • Document Your Decision: Clearly document why validation was disabled for future reference and troubleshooting.
  • Re-enable Validation: Once the schema inconsistencies are addressed, ensure you re-enable validation to maintain the integrity of your charts.

Additional Information

For a deeper dive into Helm's schema validation, consult the official documentation: https://helm.sh/docs/chart_best_practices/schema/

Conclusion

Disabling Helm v3's JSON schema validation should be used with caution and only as a last resort. Remember to address the root cause of schema violations and re-enable validation to ensure the long-term health and stability of your Helm charts.