Skip to content

Parse yaml file with `v1.List` (made of nodes) OR `---` separated `v1.Node`s into `[]*v1.Node`.

License

Notifications You must be signed in to change notification settings

vadafoss/node-templates

Repository files navigation

What does this program do?

It parses yaml file with v1.List (made of nodes) OR --- separated v1.Nodes into []*v1.Node.

v1.List made of nodes:

apiVersion: v1
items:
- apiVersion: v1
  kind: Node
  metadata:
    ...
    name: kind-control-plane
    ...
  spec:
    ...
- apiVersion: v1
  kind: Node
  metadata:
    ...
    name: kind-worker
    ...
  spec:
    ...
kind: List
metadata:
  resourceVersion: ""

Check node-templates-list.yaml for an actual example.

--- separated v1.Nodes

apiVersion: v1
kind: Node
metadata:
  ...
  name: kind-control-plane
  ...
spec:
  ...
---

apiVersion: v1
kind: Node
metadata:
  ...
  name: kind-worker
  ...
spec:
  ...

Check node-templates-non-list.yaml for an actual example.

Output

With node-templates-non-list.yaml

$ go run main.go
node kind-control-plane
node kind-worker

With node-templates-list.yaml

$ go run main.go
node kind-control-plane
node kind-worker
node kind-worker2

Why

References

About

Parse yaml file with `v1.List` (made of nodes) OR `---` separated `v1.Node`s into `[]*v1.Node`.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages