yaml-overlay-tool icon indicating copy to clipboard operation
yaml-overlay-tool copied to clipboard

%k formatter does not work on scalar nodes

Open scottd018 opened this issue 4 years ago • 1 comments

Query (attempted in both yamlFiles and commonOverlays):

  - name: "adjust tanzu namespace spec values"
    query:
      - spec[*]
      # - spec.*     # also tried this 
    value: "%v" #+workload:%k:default="%v":type=string
    documentQuery:
      - conditions:
          - query: kind
            value: TanzuNamespace

Output (notice the missing key format input to the output manifest):

spec:
  tanzuNamespaceName: tanzu-identity #+workload::default="tanzu-identity":type=string
  tanzuLimitRangeDefaultCpuLimit: 50m #+workload::default="50m":type=string
  tanzuLimitRangeDefaultMemoryLimit: 64Mi #+workload::default="64Mi":type=string
  tanzuLimitRangeDefaultCpuRequest: 50m #+workload::default="50m":type=string
  tanzuLimitRangeDefaultMemoryRequest: 64Mi #+workload::default="64Mi":type=string
  tanzuLimitRangeMaxCpuLimit: 1000m #+workload::default="1000m":type=string
  tanzuLimitRangeMaxMemoryLimit: 1024Mi #+workload::default="1024Mi":type=string
  tanzuResourceQuotaCpuRequests: "6" #+workload::default="6":type=string
  tanzuResourceQuotaMemoryRequests: 8Gi #+workload::default="8Gi":type=string
  tanzuResourceQuotaCpuLimits: "6" #+workload::default="6":type=string
  tanzuResourceQuotaMemoryLimits: 8Gi #+workload::default="8Gi":type=string

scottd018 avatar May 26 '21 16:05 scottd018

%k is currently not supported on scalar nodes however the following would work for your use case

  - name: "adjust tanzu namespace spec values"
    query: spec
    value: 
      "%k": "%v" #+workload:%k:default="%v":type=string
    documentQuery:
      - conditions:
          - query: kind
            value: TanzuNamespace

JefeDavis avatar May 26 '21 16:05 JefeDavis