fix: optimize validation args - #684
Merged
Merged
Conversation
Signed-off-by: Ilya Drey <ilya.drey@flant.com>
ilya-lesikov
approved these changes
Aug 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Removes the
--local-resource-validationflag together with itsResourceValidationOptions.LocalResourceValidationoption and the plumbing thatcarried it into the kubeconform validator. Embedded-schemas-only validation is
still fully reachable — it is now simply the default, achieved by not passing
--resource-validation-extra-schema.Why
After the validation schemas were embedded into the binary
(
f6ce79b3f feat: embed kubeconform validation schemas into the binary),external schema sources became strictly opt-in:
ValidationExtraSchemasdefaultsto an empty list and the embedded Kubernetes/CRD sources are always appended in
newKubeConformValidator. That made--local-resource-validationa no-op in thedefault case and merely an override that nulls out whatever the user explicitly
asked for — the flag's only effect was
schemaSources = nil, which duplicates"don't pass extra schemas". Dropping it removes a redundant knob from the CLI
surface before it ships.
Key changes
CLI surface —
cmd/nelm/common_flags.go--local-resource-validationflag registration fromAddResourceValidationFlags, along with its global/local env var bindings.Public options —
pkg/common/options.goLocalResourceValidation boolfield (json:"localResourceValidation")from
ResourceValidationOptions.Validator —
pkg/resource/kubeconform.go,pkg/resource/validate.gonewKubeConformValidatorloses itsembeddedSchemasOnlyparameter and theschemaSources = nilshort-circuit; it now always honors the caller-suppliedsources plus the embedded ones.
validateResourceSchemasupdated to the two-argument signature.Review focus / risks
ResourceValidationOptionsis part ofpkg/common, andnewKubeConformValidator's signature changed. Confirm nodownstream consumer (werf in particular) sets
LocalResourceValidationorserializes/deserializes
localResourceValidationin a persisted optionspayload — the JSON tag disappearing means any stored value is now silently
ignored rather than rejected.
--resource-validation-extra-schema <src> --local-resource-validationignored<src>and validated offline; now the extra source is used, which meansnetwork access where there was none. Verify that's the intended semantics and
that no docs/README/e2e invocation relies on the old combination.
cacheSubDirNameis derived from the joinedschemaSources.With the flag gone the hash no longer depends on the (removed) offline mode, so
a cache directory populated by an older binary run with
--local-resource-validationplus extra schemas will now be reused under thesame key with different effective sources. Worth confirming the
--resource-validation-cache-lifetimeexpiry isdouble-check whether a changelog/migration note i