https://github.com/orirawlings/multidoc
Convert Kubernetes List Kinds into multidoc YAML
https://github.com/orirawlings/multidoc
kubernetes yaml
Last synced: 5 months ago
JSON representation
Convert Kubernetes List Kinds into multidoc YAML
- Host: GitHub
- URL: https://github.com/orirawlings/multidoc
- Owner: orirawlings
- Created: 2019-09-20T21:49:35.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-08-03T20:25:07.000Z (almost 4 years ago)
- Last Synced: 2024-06-20T15:47:43.465Z (about 2 years ago)
- Topics: kubernetes, yaml
- Language: Go
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# multidoc
Convert Kubernetes List Kinds into multidoc YAML
The Kubernetes API represents a collection of resources using a [List kind](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#types-kinds). This program will read a YAML document containing a List at the top-level and convert it into a [YAML multi-document](https://yaml.org/spec/1.2/spec.html#id2760395), where each document is one of the items in the original List.
## Install
```
go install github.com/orirawlings/multidoc@latest
```
## Use
```
$ kubectl get services -o yaml
apiVersion: v1
items:
- apiVersion: v1
kind: Service
metadata:
creationTimestamp: "2019-09-24T13:32:37Z"
labels:
app: example
name: example
namespace: default
resourceVersion: "1180"
selfLink: /api/v1/namespaces/default/services/example
uid: c5da20a1-decf-11e9-a0dc-025000000001
spec:
externalName: www.example.com
selector:
app: example
sessionAffinity: None
type: ExternalName
status:
loadBalancer: {}
- apiVersion: v1
kind: Service
metadata:
creationTimestamp: "2019-09-24T13:22:34Z"
labels:
component: apiserver
provider: kubernetes
name: kubernetes
namespace: default
resourceVersion: "156"
selfLink: /api/v1/namespaces/default/services/kubernetes
uid: 5e9121fc-dece-11e9-a0dc-025000000001
spec:
clusterIP: 10.96.0.1
ports:
- name: https
port: 443
protocol: TCP
targetPort: 6443
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
kind: List
metadata:
resourceVersion: ""
selfLink: ""
$ kubectl get services -o yaml | multidoc
---
apiVersion: v1
kind: Service
metadata:
creationTimestamp: "2019-09-24T13:32:37Z"
labels:
app: example
name: example
namespace: default
resourceVersion: "1180"
selfLink: /api/v1/namespaces/default/services/example
uid: c5da20a1-decf-11e9-a0dc-025000000001
spec:
externalName: www.example.com
selector:
app: example
sessionAffinity: None
type: ExternalName
status:
loadBalancer: {}
---
apiVersion: v1
kind: Service
metadata:
creationTimestamp: "2019-09-24T13:22:34Z"
labels:
component: apiserver
provider: kubernetes
name: kubernetes
namespace: default
resourceVersion: "156"
selfLink: /api/v1/namespaces/default/services/kubernetes
uid: 5e9121fc-dece-11e9-a0dc-025000000001
spec:
clusterIP: 10.96.0.1
ports:
- name: https
port: 443
protocol: TCP
targetPort: 6443
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
```