enable strict JSON spec unmarshalling#2202
Conversation
c83563c to
6e84dfd
Compare
6e84dfd to
f79c746
Compare
f79c746 to
a984354
Compare
|
I think this would break invalid Prometheus CRs:
Another issue - during upgrade we apply new CRDs when old operator is running:
until operator is upgraded. In existing mode it would just be silently skipped. I'm not convinced we should change existing behaviour, however a good documentation around this choice would be useful |
|
I wonder if we can limit strict parsing to new objects only - perhaps in a webhook? |
|
anyway in a linked issue I've described workaround, created this PR just in case |
seems like expected behavior when webhooks are enabled. currenty webhooks reject CRs with specs that have fields with invalid data type or value and mark resource as failed and allow to apply it when webhooks are disabled. with this change the same behaviour is added for unsupported fields.
we keep noop CR properties for a long time, so this concern should be covered as well |
related issue VictoriaMetrics/helm-charts#2882
Summary by cubic
Enable strict JSON unmarshalling for all Operator CR specs to reject unknown fields and return clear errors. This prevents typos or unsupported keys from being silently accepted.
Bug Fixes
UnmarshalSpecStrict(usesDisallowUnknownFields) and wired all CRUnmarshalJSONpaths (v1,v1alpha1,v1beta1) through it, settingParsingSpecErroron failure.VMAlertmanagerConfigtests/fixtures to use valid fields (e.g.,msteams_configs,custom_fieldsplacement).Migration
Written for commit a984354. Summary will update on new commits. Review in cubic