resourceutil

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ManagedByLabel is the label used to identify the agent
	// responsible of deploying the resources into the cluster.
	ManagedByLabel = "app.kubernetes.io/managed-by"
	// ManagedByMia is used to identify the resources deployed
	// with `mlp`.
	ManagedByMia = "mia-platform"
	// ConfigMap is the resource kind for ConfigMaps.
	ConfigMap = "ConfigMap"
	// Secret is the resource kind for Secrets.
	Secret = "Secret"
)

Variables

This section is empty.

Functions

func GetChecksum

func GetChecksum(content []byte) string

GetChecksum is used to calculate a checksum using an array of bytes

func GetMiaAnnotation

func GetMiaAnnotation(name string) string

GetMiaAnnotation is used to get an annotation name following a pattern used in mia-platform

func GetPodSpec

func GetPodSpec(volumes *[]corev1.Volume, containers *[]corev1.Container) corev1.PodSpec

GetPodSpec get a podSpec

func GetPodsDependencies

func GetPodsDependencies(podSpec corev1.PodSpec) map[string][]string

GetPodsDependencies returns a map where keys are Secret and ConfigMap and each key has a list of dependencies of that kind

func IsNotUsingSemver

func IsNotUsingSemver(target *Resource) (bool, error)

IsNotUsingSemver is used to check if a resoure is following semver or not

func MapSecretAndConfigMap

func MapSecretAndConfigMap(resources []Resource) (map[string]string, map[string]string, error)

MapSecretAndConfigMap returns two mappings, one for Secret and one for ConfigMap: each map holds the resource name as the key and its checksum as the value

Types

type Resource

type Resource struct {
	Filepath         string
	GroupVersionKind *schema.GroupVersionKind
	Object           unstructured.Unstructured
}

Resource a resource reppresentation

func AddManagedByMiaLabel

func AddManagedByMiaLabel(resources []Resource) []Resource

func MakeResources

func MakeResources(filePaths []string, namespace string) ([]Resource, error)

MakeResources creates a resource list and sorts them according to the standard ordering strategy

func NewResources

func NewResources(filepath, namespace string) ([]Resource, error)

NewResources creates new Resources from a file at `filepath` support multiple documents inside a single file

func SortResourcesByKind

func SortResourcesByKind(resources []Resource, ordering resourceOrder) []Resource

SortResourcesByKind Results are sorted by 'ordering', keeping order of items with equal kind/priority

Jump to

Keyboard shortcuts

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