Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add schema annotations to values.yaml, generate schema using helm-schema #153

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
minimum_pre_commit_version: 1.21.0
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-merge-conflict
args:
- --assume-in-merge
- id: trailing-whitespace
- id: detect-private-key
- id: mixed-line-ending

- repo: https://github.com/dadav/helm-schema
rev: "0.11.2"
hooks:
- id: helm-schema
files: 'helm/hello-world/values\.yaml$'
args:
- --chart-search-root=helm
- --skip-auto-generation=additionalProperties

- repo: https://github.com/giantswarm/schemalint
rev: v2.6.0
hooks:
- id: schemalint-normalize
files: 'helm/hello-world/values\.schema\.json'
pass_filenames: false
args:
- helm/hello-world/values.schema.json
- --output-path
- helm/hello-world/values.schema.json
- --force
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project's packages adheres to [Semantic Versioning](http://semver.org/s

## [Unreleased]

### Changed

- Add annotation comments to `values.yaml` to allow generating a full-fledges `values.schema.json` file, using helm-schema.
- Add pre-commit configuration to generate schema from `values.yaml` using helm-schema, and to normalize the schema.

## [2.3.1] - 2024-01-29

### Fixed
Expand Down
25 changes: 17 additions & 8 deletions helm/hello-world/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# hello-world

![Version: 2.3.0](https://img.shields.io/badge/Version-2.3.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.2.0](https://img.shields.io/badge/AppVersion-0.2.0-informational?style=flat-square)
![Version: 2.3.1](https://img.shields.io/badge/Version-2.3.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.2.0](https://img.shields.io/badge/AppVersion-0.2.0-informational?style=flat-square)

A chart that deploys a basic hello world site and lets you test values merging of user values configmap and secrets.

Expand All @@ -23,8 +23,8 @@ A chart that deploys a basic hello world site and lets you test values merging o
|-----|------|---------|-------------|
| affinity | object | `{}` | |
| autoscaling.enabled | bool | `true` | |
| autoscaling.maxReplicas | int | `100` | |
| autoscaling.minReplicas | int | `1` | |
| autoscaling.maxReplicas | int | `10` | |
| autoscaling.minReplicas | int | `3` | |
| autoscaling.targetCPUUtilizationPercentage | int | `80` | |
| autoscaling.targetMemoryUtilizationPercentage | int | `80` | |
| fullnameOverride | string | `""` | |
Expand All @@ -51,10 +51,10 @@ A chart that deploys a basic hello world site and lets you test values merging o
| podLabels | object | `{}` | |
| podSecurityContext | object | `{}` | |
| replicaCount | int | `1` | |
| resources.limits.cpu | string | `"400m"` | |
| resources.limits.memory | string | `"100Mi"` | |
| resources.requests.cpu | string | `"200m"` | |
| resources.requests.memory | string | `"50Mi"` | |
| resources.limits.cpu | string | `"50m"` | |
| resources.limits.memory | string | `"100M"` | |
| resources.requests.cpu | string | `"10m"` | |
| resources.requests.memory | string | `"50M"` | |
| securityContext.allowPrivilegeEscalation | bool | `false` | |
| securityContext.capabilities.drop[0] | string | `"ALL"` | |
| securityContext.readOnlyRootFilesystem | bool | `true` | |
Expand All @@ -73,6 +73,15 @@ A chart that deploys a basic hello world site and lets you test values merging o
| strategy.rollingUpdate.maxUnavailable | int | `1` | |
| strategy.type | string | `"RollingUpdate"` | |
| tolerations | list | `[]` | |
| topologySpreadConstraints | list | `[]` | |
| topologySpreadConstraints[0].labelSelector.matchLabels."app.kubernetes.io/instance" | string | `"{{ .Release.Name }}"` | |
| topologySpreadConstraints[0].labelSelector.matchLabels."app.kubernetes.io/name" | string | `"{{ include \"hello-world.name\" . }}"` | |
| topologySpreadConstraints[0].maxSkew | int | `1` | |
| topologySpreadConstraints[0].topologyKey | string | `"topology.kubernetes.io/zone"` | |
| topologySpreadConstraints[0].whenUnsatisfiable | string | `"ScheduleAnyway"` | |
| topologySpreadConstraints[1].labelSelector.matchLabels."app.kubernetes.io/instance" | string | `"{{ .Release.Name }}"` | |
| topologySpreadConstraints[1].labelSelector.matchLabels."app.kubernetes.io/name" | string | `"{{ include \"hello-world.name\" . }}"` | |
| topologySpreadConstraints[1].maxSkew | int | `1` | |
| topologySpreadConstraints[1].topologyKey | string | `"kubernetes.io/hostname"` | |
| topologySpreadConstraints[1].whenUnsatisfiable | string | `"ScheduleAnyway"` | |
| volumeMounts | list | `[]` | |
| volumes | list | `[]` | |
3 changes: 3 additions & 0 deletions helm/hello-world/ci/ci-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
podLabels:
labelkey: labelvalue
second-key: "another value"
Loading