feat: deserialize object from multiple yaml documents #3862
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.
🤖 Generated by Copilot at c20caa7
Summary
♻️🔧✨
This pull request refactors the YAML handling and parsing across the project by using a new YAML utility package and a stricter unmarshaling mode. It also updates the functions that check or manipulate the configuration files of k3s, crictl, registry, and kubeadm to use the new YAML package and mode. The goal is to improve the code quality, validation, and consistency of working with YAML data and files.
Walkthrough
UnmarshalData
function withUnmarshalToMap
function fromyaml
package for unmarshaling YAML data into maps inCheck
functions ofcrictl_checker.go
andregistry_checker.go
files (link, link)yaml
package inconfig.go
file ofk3s
package (link)Unmarshal
function fromyaml
package inconfig.go
file ofk3s
package (link)UnmarshalData
function withUnmarshalToMap
function fromyaml
package for unmarshaling YAML data into maps insaveNewKubeadmConfig
andmergeWithBuiltinKubeadmConfig
functions ofcerts.go
andkubeadm.go
files ofkubernetes
package (link, link)Unmarshal
function toUnmarshalToMap
and addunmarshalStrict
function for strict unmarshaling of YAML data into structs inyaml.go
file ofyaml
package (link)ToYAMLs
function and addMarshal
function for marshaling objects into YAML data inyaml.go
file ofyaml
package (link)UnmarshalFile
function to useunmarshalStrict
function and addIsNil
function for checking nil or empty YAML data inyaml.go
file ofyaml
package (link)