| 1 |
// Copyright 2019 The Kubernetes Authors. |
| 2 |
// SPDX-License-Identifier: Apache-2.0 |
| 3 |
|
| 4 |
// Package ifc holds miscellaneous interfaces used by kustomize. |
| 5 |
package ifc |
| 6 |
|
| 7 |
import ( |
| 8 |
"sigs.k8s.io/kustomize/api/types" |
| 9 |
"sigs.k8s.io/kustomize/kyaml/yaml" |
| 10 |
) |
| 11 |
|
| 12 |
// Validator provides functions to validate annotations and labels |
| 13 |
type Validator interface { |
| 14 |
MakeAnnotationValidator() func(map[string]string) error |
| 15 |
MakeAnnotationNameValidator() func([]string) error |
| 16 |
MakeLabelValidator() func(map[string]string) error |
| 17 |
MakeLabelNameValidator() func([]string) error |
| 18 |
ValidateNamespace(string) []string |
| 19 |
ErrIfInvalidKey(string) error |
| 20 |
IsEnvVarName(k string) error |
| 21 |
} |
| 22 |
|
| 23 |
// KvLoader reads and validates KV pairs. |
| 24 |
type KvLoader interface { |
| 25 |
Validator() Validator |
| 26 |
Load(args types.KvPairSources) (all []types.Pair, err error) |
| 27 |
} |
| 28 |
|
| 29 |
// Loader interface exposes methods to read bytes. |
| 30 |
type Loader interface { |
| 31 |
|
| 32 |
// Repo returns the repo location if this Loader was created from a url |
| 33 |
// or the empty string otherwise. |
| 34 |
Repo() string |
| 35 |
|
| 36 |
// Root returns the root location for this Loader. |
| 37 |
Root() string |
| 38 |
|
| 39 |
// New returns Loader located at newRoot. |
| 40 |
New(newRoot string) (Loader, error) |
| 41 |
|
| 42 |
// Load returns the bytes read from the location or an error. |
| 43 |
Load(location string) ([]byte, error) |
| 44 |
|
| 45 |
// Cleanup cleans the loader |
| 46 |
Cleanup() error |
| 47 |
} |
| 48 |
|
| 49 |
// KustHasher returns a hash of the argument |
| 50 |
// or an error. |
| 51 |
type KustHasher interface { |
| 52 |
Hash(*yaml.RNode) (string, error) |
| 53 |
} |
| 54 |
|
| 55 |
// See core.v1.SecretTypeOpaque |
| 56 |
const SecretTypeOpaque = "Opaque" |