Kuadrant / kuadrantctl

Kuadrant configuration command line utility
Apache License 2.0
6 stars 13 forks source link

reduce yaml output verbosity #67

Closed jasonmadigan closed 5 months ago

jasonmadigan commented 5 months ago

Reducing yaml output verbosity (similar to the JSON output, which uses omit's empties)

Before:

./kuadrantctl generate gatewayapi httproute -o yaml --oas examples/oas3/petstore-with-rate-limit-kuadrant-extensions.yaml
typemeta:
  kind: HTTPRoute
  apiversion: gateway.networking.k8s.io/v1beta1
objectmeta:
  name: petstore
  generatename: ""
  namespace: petstore
  selflink: ""
  uid: ""
  resourceversion: ""
  generation: 0
  creationtimestamp: "0001-01-01T00:00:00Z"
  deletiontimestamp: null
  deletiongraceperiodseconds: null
  labels: {}
  annotations: {}
  ownerreferences: []
  finalizers: []
  managedfields: []
spec:
  commonroutespec:
    parentrefs:
    - group: null
      kind: null
      namespace: istio-system
      name: istio-ingressgateway
      sectionname: null
      port: null
  hostnames:
  - example.com
  rules:
  - matches:
    - path:
        type: Exact
        value: /api/v1/cat
      headers: []
      queryparams: []
      method: GET
    filters: []
    backendrefs:
    - backendref:
        backendobjectreference:
          group: null
          kind: null
          name: petstore
          namespace: petstore
          port: 80
        weight: null
      filters: []
  - matches:
    - path:
        type: Exact
        value: /api/v1/dog
      headers: []
      queryparams: []
      method: GET
    filters: []
    backendrefs:
    - backendref:
        backendobjectreference:
          group: null
          kind: null
          name: petstore
          namespace: petstore
          port: 80
        weight: null
      filters: []
  - matches:
    - path:
        type: Exact
        value: /api/v1/dog
      headers: []
      queryparams: []
      method: POST
    filters: []
    backendrefs:
    - backendref:
        backendobjectreference:
          group: null
          kind: null
          name: petstore
          namespace: petstore
          port: 80
        weight: null
      filters: []
status:
  routestatus:
    parents: []

After:

./kuadrantctl generate gatewayapi httproute -o yaml --oas examples/oas3/petstore-with-rate-limit-kuadrant-extensions.yaml
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
  creationTimestamp: null
  name: petstore
  namespace: petstore
spec:
  hostnames:
  - example.com
  parentRefs:
  - name: istio-ingressgateway
    namespace: istio-system
  rules:
  - backendRefs:
    - name: petstore
      namespace: petstore
      port: 80
    matches:
    - method: GET
      path:
        type: Exact
        value: /api/v1/cat
  - backendRefs:
    - name: petstore
      namespace: petstore
      port: 80
    matches:
    - method: POST
      path:
        type: Exact
        value: /api/v1/dog
  - backendRefs:
    - name: petstore
      namespace: petstore
      port: 80
    matches:
    - method: GET
      path:
        type: Exact
        value: /api/v1/dog
status:
  parents: null