Error out when configuration key is unknown
- Dominant language
- Go
- Stars
- 1.1k
- Forks
- 134
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the problem/challenge you have**
When a user provides configuration to `kapp` but that configuration contains a typo or a key that should not be part of the configuration, `kapp` does not error out or tell the user that the configuration has keys that `kapp` does not know off.
One example would be
```
apiVersion: kapp.k14s.io/v1alpha1
kind: Config
minimumRequiredVersion: 0.23.0
rebaseRules:
- paths:
- [spec, replicas]
type: copy
sources: [existing]
resourcesMatchers:
- hasAnnotationMatcher:
keys:
- cluster.k8s.io/cluster-api-autoscaler-node-group-min-size
unknownKey: 1
```
the key `resourcesMatchers` does not exist
**Describe the solution you'd like**
`kapp` should return an error saying something like
```
Error: Configuration have the following unknown fields:
rebaseRules[0].resourcesMatchers
unknownKey
```
**Anything else you would like to add:**
For a better UX maybe if it would be easy we should provide the line of the file where this error occurs. We should be mindful that maybe the configuration can be piped into `kapp` so there will be no filename.
Contributor guide
Assessment
This issue has not been assessed yet.