...

Package generators

import "sigs.k8s.io/kustomize/api/internal/generators"
Overview
Index

Overview ▾

func MakeConfigMap

func MakeConfigMap(
    ldr ifc.KvLoader, args *types.ConfigMapArgs) (rn *yaml.RNode, err error)

MakeConfigMap makes a configmap.

ConfigMap: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#configmap-v1-core

ConfigMaps and Secrets are similar.

Both objects have a `data` field, which contains a map from keys to values that must be UTF-8 valid strings. Such data might be simple text, or whoever made the data may have done so by performing a base64 encoding on binary data. Regardless, k8s has no means to know this, so it treats the data field as a string.

The ConfigMap has an additional field `binaryData`, also a map, but its values are _intended_ to be interpreted as a base64 encoding of []byte, by whatever makes use of the ConfigMap.

In a ConfigMap, any key used in `data` cannot also be used in `binaryData` and vice-versa. A key must be unique across both maps.

func MakeSecret

func MakeSecret(
    ldr ifc.KvLoader, args *types.SecretArgs) (rn *yaml.RNode, err error)

MakeSecret makes a kubernetes Secret.

Secret: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#secret-v1-core

ConfigMaps and Secrets are similar.

Like a ConfigMap, a Secret has a `data` field, but unlike a ConfigMap it has no `binaryData` field.

All of a Secret's data is assumed to be opaque in nature, and assumed to be base64 encoded from its original representation, regardless of whether the original data was UTF-8 text or binary.

This encoding provides no secrecy. It's just a neutral, common means to represent opaque text and binary data. Beneath the base64 encoding is presumably further encoding under control of the Secret's consumer.

A Secret has string field `type` which holds an identifier, used by the client, to choose the algorithm to interpret the `data` field. Kubernetes cannot make use of this data; it's up to a controller or some pod's service to interpret the value, using `type` as a clue as to how to do this.

func ParseFileSource

func ParseFileSource(source string) (keyName, filePath string, err error)

ParseFileSource parses the source given.

Acceptable formats include:

  1. source-path: the basename will become the key name
  2. source-name=source-path: the source-name will become the key name and source-path is the path to the key file.

Key names cannot include '='.