ContainerSolutions / ContainerSolutions/helm-convert
Improve labels handling
- Dominant language
- Go
- Stars
- 219
- Forks
- 21
- PR merge metrics
- No merged PRs in 30d
Description
Currently, we remove labels based on a list of YAML keys which could break the initial chart. For example, if a custom resource definition contains a key with the same name as provided in the list to remove and this key has nothing to do with labels, then it will break:
```
apiVersion: custom/v1
kind: MyCustomResource
metadata:
name: my-custom-resource
spec:
something:
labels: # << this shouldn't be removed but helm-convert will remove it
someConfig: someValue
someMoreConfig:
labels: ## << this should be removed
some: label
someMoreNestedConfig: someValue
```
To prevent this to happen, we could create a map of safe path per resource using the following format which could be parsed into a GVK type `//`:
```
paths := map[string][]string{} {
"custom/v1/MyCustomResource": []string{
"spec.something.labels.someMoreConfig.labels",
},
}
```
By doing so we would need to provide the path of all the resources and make it possible to pass custom path via the CLI.
For natives resources (apps/v1, policy/v1beta1, etc.). We can keep the current behavior.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.