Skip to content

Latest commit

 

History

History
72 lines (57 loc) · 2.43 KB

7.helm3_builtin_objects.md

File metadata and controls

72 lines (57 loc) · 2.43 KB

inbuiltobjhelm

  1. Release: The object describes the release itself. It has several objects.
helm install my-app --debug --dry-run my_chart/
  • Release.Name
  • Release.Namespace
  • Release.IsUpgrade
  • Release.IsInstall
  • Release.Revision
  • Release.Service
  1. Chart
{{ .Chart.Name }}: The name of the chart as defined in Chart.yaml.
{{ .Chart.Version }}: The version of the chart as defined in Chart.yaml.
{{ .Chart.Description }}: The description of the chart as defined in Chart.yaml.
{{ .Chart.Home }}: The URL to the chart's home page, if provided in Chart.yaml.
{{ .Chart.Icon }}: The URL to an icon representing the chart, if provided in Chart.yaml.
  1. Files Provides access to all non-special files in a chart.
.Files.Get: Get the content of a file.
.Files.GetBytes: Get the content of a file as a byte slice.
.Files.Glob: Get a list of files that match a glob pattern.
.Files.AsConfig: Parse a YAML or JSON file into a ConfigMap or Secret object.
.Files.AsSecrets: Parse a YAML or JSON file into a Kubernetes Secret object.

example:

# config.yaml

apiVersion: v1
kind: ConfigMap
metadata:
  name: my-config
data:
  mydata.txt: |-
    {{ .Files.Get "otherdir/data.txt" | indent 4 }}
  1. Values

These functions help you handle values passed to your Helm chart, set defaults, and manipulate data within your templates.

.Values: Root object holding values passed to the chart during installation. default: Provides default values for optional keys. get: Retrieves a value from .Values using dot notation. has: Checks if a key exists in .Values. include: Includes content of another values file. toYaml: Converts a value to YAML format. toToml: Converts a value to TOML format. toJSON: Converts a value to JSON format.

  1. Capabilities .Capabilities: Root object providing information about the capabilities of the Kubernetes cluster where the chart is being deployed. .Capabilities.APIVersions.Has: Checks if the Kubernetes API server supports a specific API version. .Capabilities.KubeVersion: Provides information about the Kubernetes version of the cluster. .Capabilities.APIVersions.Selector: Returns the Kubernetes API version string that best matches the provided version constraints.

  2. Template .Template.Name: The name of the current template file. .Template.BasePath: The base directory path for the current template file.