![](/img/trans.png)
[英]Is there a way to store arithmetic results into a helm variable?
我有一個變量說: 我需要執行涉及此變量的算術運算並將結果存儲回同一個 ie 例如 我試着做: 但似乎不起作用,拋出此錯誤 ...
[英]Is there a way to store arithmetic results into a helm variable?
我有一個變量說: 我需要執行涉及此變量的算術運算並將結果存儲回同一個 ie 例如 我試着做: 但似乎不起作用,拋出此錯誤 ...
[英]How to parse an embedded template in Go?
我正在嘗試編寫一個生成代碼的 Go 程序,並使用embed的 package 和ParseFS一起解析模板。 代碼最終應該滿足可以從存儲庫中的任何目錄運行的要求。 到目前為止,我有以下使用ParseFiles的工作實現。 使用這個目錄結構, foo.go文件包含代碼生成代碼,package fo ...
[英]Helm: render variable in a block inserted with toYaml
我在 Keda 中有一個變量塊配置觸發器,比例為 object,如下所示:# [...] autoscaling: enabled: true triggers: - type: prometheus metadata: ...
[英]How to replace dot in Helm template string
我正在嘗試用\. ,像這樣: 我想要這個 output - https://endpoint\.index\.up 這給我一個解析錯誤。 我嘗試了很多不同的組合,但沒有任何東西可以替代點字符。 任何幫助表示贊賞! ...
[英]go template split string by the second to last character
我試圖僅按倒數第二個字符拆分字符串,例如:具有此字符串 xxx-xxx-xxx-xxx-xxx 我只想獲取此 xxx-xxx-xxx 並刪除第三個之后的最后一部分“-”或倒數第二個“-”,字符串將始終有 4 個“-”和中間的字符或數字。 目前我有這樣的東西{{ splitList "-".Value ...
[英]How to add an HTML Tag Attribute in GoLang Template
我有以下代碼: 這有效,它按應有的方式放置 onclick 事件。 但是,如果我嘗試將onclick事件動態創建為字符串(在模板中,或作為 Go function,它不起作用。 例子: 或者: 它在 HTML 中呈現如下: 如果我不將它放在<tag>本身<td>{{$Cli ...
[英]Cannot access list elements outside for loop
如果 someElements 不為空,最后一行代碼中的 endList 應該等於 someElements。 它工作正常。 如果 someElements 為空,最后一行代碼中的 endList 應該包含附加在 L6 中的元素。 在這種情況下,endList 總是空的。 這是什么原因呢? ...
[英]Idiomatic way of mapping over list with go templates/helm
所以讓我們假設我有以下values.yaml : services: - MyService1 - MyService2 - MyService3 我想有一種方法來呈現以下內容:someStringField: "myservice1_cert,myservice2_cert,mys ...
[英]Usage of variables in a nested template which is also defined as a variable in a go template?
這個想法是為 go 模板定義一個變量,該模板也是一個使用變量的模板(嵌套模板),如下所示: 然而,上面代碼的結果是: Subtemplate {{.Name}} You have a task named "Test name" with description: "Test descriptio ...
[英]helm using argument in template to check if value exists in Values.yaml
問題如下:我想根據 _helpers.tpl 中提供給模板的參數檢查 Values.yaml 中的字段是否存在: 然后在我的部署中,例如: 我希望結果如下: 但我唯一得到的是以下錯誤:壞字符 U+0024 '$' 我想多次使用模板和各種 arguments。我之前沒有看到有人處理過同樣的問題。 有任 ...
[英]Print with escape characters in go templates
假設我有一個參數,其值是一個帶有一系列轉義字符的字符串: 當我在模板中打印它時,假設模板標記是: 渲染后的 output 變為: 是否有允許打印 RAW 文本(完全原樣)的內置功能? 從而實現以下 output: ...
[英]How to configure github.com/jinliming2/vscode-go-template to accept a custom file extension?
根據https://marketplace.visualstudio.com/items?itemName=jinliming2.vscode-go-template ,此 VS Code 擴展應支持任何自定義文件擴展名的 Go 模板語言語法突出顯示(請參見下面的屏幕截圖)。 然而,我似乎無法從該 ...
[英]Not getting the right value that was specified in the values.yaml file
秘密值返回 NIL 當我運行下面的命令來檢查秘密中的值時 它返回一個 Nil 值。 我如何獲取傳遞給 values.yaml 文件的值? 用於生成秘密的示例代碼 ...
[英]Indentation and text formatting with go templates
給定以下模板: 當我使用以下方式渲染它時: output 類似於: 這意味着如果我想正確地格式化文本,我必須將它重寫為 然后我得到類似的東西: 這是所需的 output。 以第二種方式編寫模板非常難讀且混亂。 有什么方法可以讓我們用適當的縮進編寫模板,但以某種方式配置渲染,使模板占位符不會轉換為新 ...
[英]Helm template - integer value is always rendered as 0
我看到 helm 模板有些奇怪的行為: 我的 tpl function 這樣做: 后來我將它用於 label: 但是無論我在輸入參數中輸入什么數字,它總是呈現為“0”我怎樣才能呈現正確的 integer 值? ...
[英]Hugo: How to set dict value by interpolation?
在 Go (Hugo) 模板中,如何設置dict中單個條目的值? 在這個例子中,我從一個預先填充的dict $vitality開始,也許還有一個字符串.Params.vitality 。 如果字符串有任何內容,我想將字符串作為鍵的dict條目設置為1。<figure class="histo ...
[英]consul-template expand new lines from env var
賞金將在 6 天后到期。 此問題的答案有資格獲得+150聲望賞金。 henry.oswald正在尋找可靠來源的答案。 在 consul-template 中,我想傳遞一個 ENV var,其中包含將擴展的新行,因此"hello\nworld"顯示為: 命令: VARIABLE="hell\nwo ...
[英]Helm chart render string with special characters
我想在掌舵圖中將下一行渲染為字符串。 它包含特殊字符。 文本:'{{ 模板“slack.template.text”。 }}' ...
[英]Use Random Int for a Photo in Go Template
我在傳遞給模板的代碼中有一個簡單的隨機 integer 我的想法是隨機化一張照片(文件夾中有 1563 張)所以在我的模板中 {{范圍.頁數}} src="{{.Photo}}" 使模板崩潰,就像變量未正確傳遞一樣。 也許問題在於這是一個循環,所以我需要為每篇文章分配一個隨機數才能顯示照片? 有沒 ...
[英]Helm - only create if nested values are set
我想知道是否有更有效的方法來排除任何沒有設置值的 yaml 鍵。 我目前的方法是將每個鍵包裝在一個 if 語句中...... 例如 我考慮過將上面的內容包裝在 _helper.tpl function 中以嘗試保持主模板整潔,但它仍將包括編寫多個 if 語句。 有沒有更好的方法來做上面的事情? 謝謝 ...