utils

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const InClusterNamespacePath = "/var/run/secrets/kubernetes.io/serviceaccount/namespace"

Variables

This section is empty.

Functions

func AddOrSwapString

func AddOrSwapString(strings []string, str string) (bool, []string)

AddOrSwapString Add an element to the string array, swap it with the last element if it is in the array, or append it directly to the end if it does not exist. Gives whether the array has changed

Example:
[], "a" -> true, []string{"a"}
["a"], "b" -> true, []string{"a", "b"}
["a", "b"], "a" -> true, []string{"b", "a"}
["a", "b", "a"], "a" -> false, []string{"a", "b", "a"}

func AddString

func AddString(finalizers []string, f string) []string

func ContainString

func ContainString(finalizers []string, f string) bool

func GetCronJobImage

func GetCronJobImage(obj *unstructured.Unstructured) (image []string)

func GetDeploymentImage

func GetDeploymentImage(obj *unstructured.Unstructured) (image []string)

func GetHTTPEntryName added in v0.1.6

func GetHTTPEntryName(url string) string

func GetJobImage

func GetJobImage(obj *unstructured.Unstructured) (image []string)

func GetNamespace added in v0.1.3

func GetNamespace() (string, error)

func GetOCIEntryName added in v0.1.4

func GetOCIEntryName(url string) string

func GetOperatorUser added in v0.1.3

func GetOperatorUser() string

func GetPodImage

func GetPodImage(obj *unstructured.Unstructured) (image []string)

func GetStatefulSetImage

func GetStatefulSetImage(obj *unstructured.Unstructured) (image []string)

func IgnoreNotFound

func IgnoreNotFound(err error) error

IgnoreNotFound returns the supplied error, or nil if the error indicates a Kubernetes resource was not found.

func OmitManagedFields

func OmitManagedFields(o runtime.Object) runtime.Object

func ParseContainerImage

func ParseContainerImage(containers []corev1.Container) (image []string)

func ParseValues

func ParseValues(dir string, reference *apiextensionsv1.JSON) (fileName string, err error)

ParseValues parses Values

func RemoveString

func RemoveString(finalziers []string, f string) []string

func ResourceDiffStr

func ResourceDiffStr(ctx context.Context, source, exist *unstructured.Unstructured, ignorePaths []string, c client.Client) (string, error)

func SetOperatorUser added in v0.1.3

func SetOperatorUser(ctx context.Context, c client.Client) (string, error)

func SplitYAML

func SplitYAML(yamlData []byte) ([]*unstructured.Unstructured, error)

SplitYAML splits a YAML file into unstructured objects. Returns list of all unstructured objects found in the yaml. If an error occurs, returns objects that have been parsed so far too. inspire by github.com/argoproj/gitops-engine/pkg/utils/kube

func SplitYAMLToString

func SplitYAMLToString(yamlData []byte) ([]string, error)

SplitYAMLToString splits a YAML file into strings. Returns list of yamls found in the yaml. If an error occurs, returns objects that have been parsed so far too. inspire by github.com/argoproj/gitops-engine/pkg/utils/kube

Types

This section is empty.

Jump to

Keyboard shortcuts

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