_render.tpl 749 B

12345678910111213141516171819202122232425262728
  1. {{/* Renders a dict of labels */}}
  2. {{/* Call this template:
  3. {{ include "ix.v1.common.lib.metadata.render" (dict "rootCtx" $ "labels" $labels) }}
  4. {{ include "ix.v1.common.lib.metadata.render" (dict "rootCtx" $ "annotations" $annotations) }}
  5. */}}
  6. {{- define "ix.v1.common.lib.metadata.render" -}}
  7. {{- $labels := .labels -}}
  8. {{- $annotations := .annotations -}}
  9. {{- $rootCtx := .rootCtx -}}
  10. {{- with $labels -}}
  11. {{- range $k, $v := . -}}
  12. {{- if and $k $v }}
  13. {{ $k }}: {{ tpl $v $rootCtx | quote }}
  14. {{- end -}}
  15. {{- end -}}
  16. {{- end -}}
  17. {{- with $annotations -}}
  18. {{- range $k, $v := . -}}
  19. {{- if and $k $v }}
  20. {{ $k }}: {{ tpl $v $rootCtx | quote }}
  21. {{- end -}}
  22. {{- end -}}
  23. {{- end -}}
  24. {{- end -}}