utils

package
v0.0.22 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package utils provides utility functions for the CLI

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateKubernetesClient

func CreateKubernetesClient(contextName string) (client.Client, error)

func CreateKubernetesClientOrDie

func CreateKubernetesClientOrDie(contextName string) client.Client

func CreateR

func CreateR(env *ENV, obj client.Object)

CreateR is an helper to create a kubernetes resource.

func CreateTempPlaybookFile

func CreateTempPlaybookFile(content string) (*os.File, error)

func EnsureNamespace

func EnsureNamespace(env *ENV, name string)

func EnsureServiceAccount

func EnsureServiceAccount(env *ENV, name string)

func GetConfigContextOrDie

func GetConfigContextOrDie(contextName string) *rest.Config

func GetFileContent

func GetFileContent(filePath string) ([]byte, error)

func GetKubernetesClientSet

func GetKubernetesClientSet() (*rest.Config, *kubernetes.Clientset)

func GetM

func GetM(env *ENV, name string, obj client.Object) bool

GetM is an helper to fetch a kubernetes resource by name, returns true when it is found.

func GetSF

func GetSF(env *ENV, name string) (sfv1.SoftwareFactory, error)

func GetSecret

func GetSecret(env *ENV, name string) []byte

func IsCRDMissing

func IsCRDMissing(err error) bool

func IsCertManagerRunning

func IsCertManagerRunning(env *ENV) bool

func ParseString

func ParseString(text string, data any) (string, error)

ParseString allows to easilly use templated string.

Pass the template text. And the data structure to be applied to the template

func RemoveTempPlaybookFile

func RemoveTempPlaybookFile(file *os.File)

func RenderYAML

func RenderYAML(o interface{}) string

func RunCmd

func RunCmd(cmdName string, args ...string)

func RunCmdNoPanic

func RunCmdNoPanic(cmdName string, args ...string) error

func RunMake

func RunMake(arg string)

RunMake is a temporary hack until make target are implemented natively

func UpdateR

func UpdateR(env *ENV, obj client.Object) bool

UpdateR is an helper to update a kubernetes resource.

Types

type ENV

type ENV struct {
	Cli client.Client
	Ns  string
	Ctx context.Context
}

Jump to

Keyboard shortcuts

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