Documentation ¶
Index ¶
- func ApplyAnnotation(yamlText, k, v string) (string, error)
- func ApplyNamespace(yamlText, ns string) (string, error)
- func ApplyPullSecret(deploymentYaml string, pullSecret string) (string, error)
- func GetMetadata(content string) []metav1.ObjectMeta
- func JoinString(parts ...string) string
- func MustApplyNamespace(t test.Failer, yamlText, ns string) string
- func SplitString(yamlText string) []string
- func SplitYamlByKind(content string) map[string]string
- type Cache
- type CacheKey
- type Descriptor
- type FileWriter
- type Metadata
- type Part
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyAnnotation ¶
func ApplyNamespace ¶
ApplyNamespace applies the given namespaces to the resources in the yamlText if not set.
func ApplyPullSecret ¶
ApplyPullSecrets applies the given pullsecret to the deployment resource
func GetMetadata ¶
func GetMetadata(content string) []metav1.ObjectMeta
SplitYamlByKind splits the given YAML into parts indexed by kind.
func JoinString ¶
JoinString joins the given yaml parts into a single multipart document.
func MustApplyNamespace ¶
MustApplyNamespace applies the given namespaces to the resources in the yamlText if not set.
func SplitString ¶
SplitString splits the given yaml doc if it's multipart document.
func SplitYamlByKind ¶
SplitYamlByKind splits the given YAML into parts indexed by kind.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache tracks the life-cycle of Yaml based resources. It stores single-part Yaml files on disk and updates the files as needed, as the resources change.
func (*Cache) Apply ¶
Apply adds the given yamlText contents as part of a given context name. If there is an existing context with the given name, then a diffgram will be generated.
func (*Cache) GetFileFor ¶
GetFileFor returns the file that keeps the on-disk state for the given key.
type CacheKey ¶
type CacheKey struct {
// contains filtered or unexported fields
}
CacheKey is a key representing a tracked Yaml based resource.
type Descriptor ¶
type Descriptor struct { Kind string `json:"kind"` Group string `json:"group"` APIVersion string `json:"apiVersion"` Metadata Metadata `json:"metadata"` }
Descriptor a descriptor for a kubernetes resource.
func ParseDescriptor ¶
func ParseDescriptor(yamlText string) (Descriptor, error)
ParseDescriptor parses the given single-part yaml and generates the descriptor.
type FileWriter ¶
type FileWriter interface { // WriteYAML writes the given YAML content to one or more YAML files. WriteYAML(filenamePrefix string, contents ...string) ([]string, error) // WriteYAMLOrFail calls WriteYAML and fails the test if an error occurs. WriteYAMLOrFail(t test.Failer, filenamePrefix string, contents ...string) []string }
FileWriter write YAML content to files.
func NewFileWriter ¶
func NewFileWriter(workDir string) FileWriter
NewFileWriter creates a new FileWriter that stores files under workDir.