find

package
v0.49.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 8, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractKindFromManifest

func ExtractKindFromManifest(manifest string) string

ExtractKindFromManifest tries to extract the Kind value from a Kubernetes resource string It returns an empty string, if the Kind cannot be found, or if the string value is not a valid Kubernetes resource

func GetKubernetesFiles

func GetKubernetesFiles(baseDirectory string) []string

GetKubernetesFiles returns the list of Kubernetes files found on the local file system recursively starting at a base directory

func ReadAndSplitKubernetesFile

func ReadAndSplitKubernetesFile(file string) []string

ReadAndSplitKubernetesFile reads and split a single manifest file that may contain several Kubernetes resources into an array of resources (as string) If the file contains a single K8s resource, the returned array will contain a single element

Types

type KubernetesAPI

type KubernetesAPI struct {
	APIVersion string `yaml:"apiVersion"`
	Kind       string `yaml:"kind"`
	Metadata   struct {
		Name      string `yaml:"name"`
		Namespace string `yaml:"namespace"`
		Labels    struct {
			Source string `yaml:"source"`
		} `yaml:"labels"`
	} `yaml:"metadata"`
}

KubernetesAPI is a minimal struct for unmarshaling kubernetes configs into

func GetYamlInfo

func GetYamlInfo(yamlContent string) (*KubernetesAPI, error)

GetYamlInfo unmarshal the YAML into a Kubernetes meta structure that is useful to ensure the unmarshaled YAML is a Kubernetes resource definition. The structure will then contain basic K8S object meta

func (KubernetesAPI) URI

func (m KubernetesAPI) URI() string

URI returns a unique identifier referencing the resource It uses the following patterns: /api/<apiversion>/<kind>/<name> /api/<apiversion>/<kind>/<namespace>/<name>

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL