Part 3: Advanced Templates and Values
Introduction
Template Functions and Pipelines
Basic Pipelines
# Basic usage
{{ .Values.image.repository }}
# With function
{{ .Values.name | upper }}
# Multiple functions (pipelines)
{{ .Values.name | upper | quote }}
# Trim and quote
{{ .Values.description | trim | quote }}Common Template Functions
Real-World Example: Dynamic Labels
Conditional Logic
If/Else Statements
Comparison Operators
Practical Example: Environment-Specific Configuration
Loops and Ranges
Range Over Lists
Range Over Maps
Range with Index
Practical Example: Multiple Ingress Hosts
Named Templates and Includes
Defining Named Templates
Using Named Templates
Template vs Include
Complex Values Manipulation
Merging Values
Working with Lists
Working with Dictionaries
Advanced Practical Examples
Multi-Environment TypeScript API Configuration
Dynamic Feature Flags
Dynamic Service Ports
Template Variables and Scope
Local Variables
Variables in Ranges
With Blocks
Template Comments and Formatting
Comments
Whitespace Control
Debugging Templates
Debug Output
Testing Templates
What's Next?
Key Takeaways
Last updated