https://github.com/obitech/k8s-yaml-test
Evaluating multi-doc parsing in Kubernetes
https://github.com/obitech/k8s-yaml-test
Last synced: 11 months ago
JSON representation
Evaluating multi-doc parsing in Kubernetes
- Host: GitHub
- URL: https://github.com/obitech/k8s-yaml-test
- Owner: obitech
- Created: 2020-01-19T16:46:33.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-02-01T12:33:00.000Z (almost 6 years ago)
- Last Synced: 2024-12-30T08:22:31.954Z (about 1 year ago)
- Language: Go
- Size: 7.81 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Evaluating Multi-Doc Parsing in Kubernetes
Evaluating options to perform multi doc parsing in Kubernetes.
Currently there seem to be two ways on how to parse multi-doc YAML files in
Kubernetes: via [YAMLReader][yamlreader] and [FrameReader][framereader]. The
first is used by `kubeadm` whereas the latter seems to be for parsing YAML
files from streams, as used by `kubectl`.
A third option would be to use [gopkg.in/yaml.v3][yamlv3] which seems to be
both cleaner and faster, but afaik it's not vendored into k/k.
Benchmark:
```
$ go test -benchmem -bench=.
goos: darwin
goarch: amd64
pkg: github.com/obitech/k8s-yaml-test
BenchmarkYAMLReader-4 18910 57976 ns/op 28852 B/op 272 allocs/op
BenchmarkYAMLv3Decoder-4 36643 36277 ns/op 15496 B/op 151 allocs/op
PASS
ok github.com/obitech/k8s-yaml-test 3.776s
```
[yamlreader]: github.com/kubernetes/kubernetes/blob/1e40f93d34802f8a41cb916446f660e226c832ee/staging/src/k8s.io/apimachinery/pkg/util/yaml/decoder.go#L256
[framereader]: https://github.com/kubernetes/kubernetes/blob/470dfbfc4848cee4897a1b176d20611668820492/staging/src/k8s.io/apimachinery/pkg/runtime/serializer/json/json.go#L372
[yamlv3]: https://godoc.org/gopkg.in/yaml.v3