Helm 3 complete tutorial (6): Use Helm functions in templates

Searching for detailed Helm 3 documents on the Internet failed, the official website documents were too messy, and the technical group consulted on the document information and was ridiculed. MD doesn't fight for steamed buns. If there is no good document, I will summarize a document by myself. Part of the content in the document comes from major blogs and official websites, and part of the text content has been rearranged by me. All concept explanations will be accompanied by actual code records and experience. The article is updated from time to time, welcome to follow and subscribe to the column. If you have any questions, please leave a message in the comment area.
Link to the original text of this column: https://blog.csdn.net/xzk9381/category_10895812.html, please indicate the source for reprinting

In the previous article, we learned how to write a simple chart and reference the built-in objects in the template file. Next, explain how to use functions in template files.

Helm provides more than 60 usable functions. By using these functions, we can convert the imported data more conveniently. The next article will give a brief description and examples of all functions. This article only lists a few commonly used functions to get a preliminary understanding of the use of functions in template files.

1. The quote and squote functions

In the previous article, we said that when writing the template file, the part of the template that references the built-in objects should be enclosed in quotation marks, so that the template can process the data and pass it to Kubernetes correctly. In fact, we can also use functions to add quotation marks to the imported string data.

The quote or squote function can achieve such a function. By passing a parameter to the quote or squote function, a double quotation mark (quote) or single quotation mark (squote) can be added to the parameter. For example, the following example:

  1. First enter the following in the value.yaml file:

Guess you like

Origin blog.csdn.net/xzk9381/article/details/115236257