From 6057a7b51f5aebef7fccad80b98cc65234a2dd9f Mon Sep 17 00:00:00 2001 From: Nicolas De loof Date: Thu, 10 Apr 2025 10:30:57 +0200 Subject: [PATCH] fix use of x-* attribute in go templates (#22403) ## Description fix https://docs.docker.com/compose/bridge/customize/#add-your-own-templates as attributes with a `-` can't be accessed directly using dot-notation in a go template. See https://stackoverflow.com/questions/48146448/range-through-values-within-variable-containing-dashes-in-golang-templates ## Related issues or tickets ## Reviews - [ ] Technical review - [ ] Editorial review - [ ] Product review Signed-off-by: Nicolas De Loof --- content/manuals/compose/bridge/customize.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/manuals/compose/bridge/customize.md b/content/manuals/compose/bridge/customize.md index 62bdcb880d..d978ecf6b9 100644 --- a/content/manuals/compose/bridge/customize.md +++ b/content/manuals/compose/bridge/customize.md @@ -133,8 +133,8 @@ metadata: spec: rules: {{ range $name, $service := .services }} -{{ if $service.x-virtual-host }} - - host: ${{ $service.x-virtual-host }} +{{ range index $service "x-virtual-host" }} + - host: ${{ . }} http: paths: - path: "/"