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 Support for subsectioned Values #194

Merged
merged 9 commits into from
Dec 21, 2023
Merged

Conversation

Haepaxlog
Copy link
Contributor

This PR closes #193 by adding section info to necessary structs and also retrieving
this section mapping through # @section -- [section name] annotations.

In order to keep compatibility with regular unsectioned values.yaml files, this means also
introducing a separate Sections field to chartTemplateData , through which a template
similar to valuesTableTemplate called valuesTableSectionedTemplate can be evoked to generate
files similar to this:

## Values

### General
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| controller.extraVolumes[0].name | string | `"config-volume"` |  |
| controller.image.repository | string | `"nginx-ingress-controller"` |  |
| controller.image.tag | string | `"18.0831"` |  |
| controller.name | string | `"controller"` |  |
| controller.service.annotations."external-dns.alpha.kubernetes.io/hostname" | string | `"stupidchess.jmn23.com"` | Hostname to be assigned to the ELB for the service |
| controller.service.type | string | `"LoadBalancer"` |  |

### Some Section
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| controller.extraVolumes[0].configMap.name | string | `"nginx-ingress-config"` | Uses the name of the configmap created by this chart |
| controller.persistentVolumeClaims | list | the chart will construct this list internally unless specified | List of persistent volume claims to create. |
| controller.podLabels | object | `{}` | The labels to be applied to instances of the controller pod |

### Special Attention
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| controller.ingressClass | string | `"nginx"` | You can also specify value comments like this |
| controller.publishService | object | `{"enabled":false}` | This is a publishService |
| controller.replicas | int | `nil` | Number of nginx-ingress pods to load balance between |

or HTML data:

General

Key Type Default Description
controller.extraVolumes[0].name string
"config-volume"
controller.image.repository string
"nginx-ingress-controller"
controller.image.tag string
"18.0831"
controller.name string
"controller"
controller.service.annotations."external-dns.alpha.kubernetes.io/hostname" string
"stupidchess.jmn23.com"
Hostname to be assigned to the ELB for the service
controller.service.type string
"LoadBalancer"

Some Section

Key Type Default Description
controller.extraVolumes[0].configMap.name string
"nginx-ingress-config"
Uses the name of the configmap created by this chart
controller.persistentVolumeClaims list
the chart will construct this list internally unless specified
List of persistent volume claims to create.
controller.podLabels object
{}
The labels to be applied to instances of the controller pod

Special Attention

Key Type Default Description
controller.ingressClass string
"nginx"
You can also specify value comments like this
controller.publishService object
{
  "enabled": false
}
This is a publishService
controller.replicas int
null
Number of nginx-ingress pods to load balance between

I'd be happy if this feature makes it in in some shape or form as I can see the need for documentation people to have it integrated into the tool :)

Haepaxlog and others added 4 commits September 5, 2023 13:34
This adds `@section` comments, which will be parsed into
semantic section info for valueRows. This allows to generate
sectioned Values Tables by adding the templates
`chart.valuesSectionedSection` and `chart.valuesSectionedSectionHTML`
and thereby keeping compatability with default Values Tables
These tests check if sections are recognised and values are grouped
together, if sections still work with annotations (like `@default` or
`@raw`), and if different sections still work and are grouped correctly
…ions

This looks better, because we shouldn't create a table in a sorting function
@Nepo26 Nepo26 self-requested a review September 10, 2023 12:38
@Nepo26 Nepo26 self-assigned this Sep 10, 2023
@Nepo26 Nepo26 added the enhancement New feature or request label Sep 10, 2023
@klaudiagrz
Copy link

klaudiagrz commented Oct 13, 2023

@Nepo26 any chances of implementing this feature in the near future? Looks super helpful!

@Nepo26
Copy link
Collaborator

Nepo26 commented Oct 13, 2023

Hi @klaudiagrz,

It really seems promising, I just need to review it, but I'm with little time recently. I can't promise anything, however I'll try to focus some time in this weekend.

@Nepo26
Copy link
Collaborator

Nepo26 commented Oct 21, 2023

Got some time now. I'm looking into it.

@kenrick-tan-partior
Copy link

Hey @Nepo26, did you manage to look at this PR yet? :)

@norwoodj
Copy link
Owner

norwoodj commented Nov 2, 2023

Hey @Haepaxlog I'm sorry for the slow response on this. I really like the idea here, and I've added some comments that I think would improve things slightly. Thanks so much for the contribution, if you make the couple changes I've proposed, happy to merge it.

pkg/document/model.go Outdated Show resolved Hide resolved
pkg/document/model.go Outdated Show resolved Hide resolved
pkg/document/template.go Outdated Show resolved Hide resolved
pkg/helm/chart_info.go Outdated Show resolved Hide resolved
@ksputo
Copy link

ksputo commented Nov 24, 2023

hey @norwoodj , could you please have a look at the changes? Thank you 🙇

@norwoodj
Copy link
Owner

Sorry for my slowness getting back to this. I've merged. Thank you very much for the very cool contribution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for sections and custom introduction
7 participants