common

package
v1.0.30 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NotReadyRegex        = `.* container "(\w+)" in pod "(.*)" is waiting to start: (\w+)`
	NoPodsFoundReg       = `.* pods "\w+" not found`
	NotResourcesFoundReg = `No resources found*`
	NotFound             = `Error from server (NotFound)`
)
View Source
const (
	Scenarios      = "scenarios.frisbee.dev"
	Clusters       = "clusters.frisbee.dev"
	Services       = "services.frisbee.dev"
	Chaos          = "chaos.frisbee.dev"
	Cascades       = "cascades.frisbee.dev"
	Calls          = "calls.frisbee.dev"
	VirtualObjects = "virtualobjects.frisbee.dev"
	Templates      = "templates.frisbee.dev"
)
View Source
const (
	NetworkChaos = "networkchaos.chaos-mesh.org"
	PodChaos     = "podchaos.chaos-mesh.org"
	IOChaos      = "iochaos.chaos-mesh.org"
	KernelChaos  = "kernelchaos.chaos-mesh.org"
	TimeChaos    = "timechaos.chaos-mesh.org"
)
View Source
const (
	K8PODs            = "pods"
	K8PVCs            = "persistentvolumeclaims"
	K8PVs             = "persistentvolumes"
	K8SStorageClasses = "storageclasses.storage.k8s.io"
)
View Source
const EmptyChaosResourceInspectionFields = "Kind   Job   InjectionTime   Phase   Target"
View Source
const EmptyK8SResourceInspectionFields = "API   Kind   Name   Action   Component   Phase*   Reason*   Message*"
View Source
const EmptyResourceInspectionFields = "Name   Kind   Job   Component   Phase   Reason   Message"
View Source
const EmptyTemplateResources = "API   Kind   Name   HelmRelease"
View Source
const (
	FrisbeeRepo = "https://carv-ics-forth.github.io/frisbee/charts"
)
View Source
const (
	JetstackRepo = "https://charts.jetstack.io"
)
View Source
const (
	ManagedNamespace = "app.kubernetes.io/managed-by=Frisbee"
)

Variables

View Source
var ChaosResourceInspectionFields = strings.Join([]string{
	"custom-columns=Kind:.kind",
	"Job:.metadata.name",
	"InjectionTime:.metadata.creationTimestamp",
	"Phase:.status.experiment.desiredPhase",
	"Target:.status.experiment.containerRecords[*].id",
}, ",")
View Source
var FrisbeeResourceInspectionFields = strings.Join([]string{
	"custom-columns=Name:.metadata.namespace",
	"Kind:.kind",
	"Job:.metadata.name",
	"Component:.metadata.labels.scenario\\.frisbee\\.dev\\/component",
	"Phase:.status.phase",
	"Reason:.status.reason",
	"Message:.status.message",
}, ",")
View Source
var K8SRemoveFinalizer = []string{
	"--patch=\\'[", "{",
	"op:", "remove,",
	"path:", "/metadata/finalizers",
	"}", "]\\'",
}
View Source
var K8SResourceInspectionFields = strings.Join([]string{
	"custom-columns=API:.apiVersion",
	"Kind:.kind",
	"Name:.metadata.name",
	"Action:.metadata.labels.scenario\\.frisbee\\.dev\\/action",
	"Component:.metadata.labels.scenario\\.frisbee\\.dev\\/component",
	"Phase*:.status.phase",
	"Reason*:.status.reason",
	"Message*:.status.message",
}, ",")
View Source
var TemplateInspectionFields = strings.Join([]string{
	"custom-columns=API:.apiVersion",
	"Kind:.kind",
	"Name:.metadata.name",
	"HelmRelease:.metadata.annotations.meta\\.helm\\.sh\\/release-name",
}, ",")

Functions

func CRDsExist added in v1.0.28

func CRDsExist(apiresource string) bool

func CreateNamespace

func CreateNamespace(name string, labels ...string) error

func Dashboards

func Dashboards(testName string) error

func DeleteNamespaces

func DeleteNamespaces(selector string, testNames ...string) error

func ErrContainerNotReady added in v1.0.26

func ErrContainerNotReady(out []byte) bool

func ErrNotFound added in v1.0.26

func ErrNotFound(out []byte) bool

func ForceDelete

func ForceDelete(testName string) error

ForceDelete iterates the Frisbee CRDs and remove its finalizers.

func GetChaosResources

func GetChaosResources(testName string) error

func GetFrisbeeResources

func GetFrisbeeResources(testName string, watch bool) error

func GetK8sEvents added in v1.0.28

func GetK8sEvents(testName string) error

func GetK8sResources

func GetK8sResources(testName string) error

func GetPodLogs

func GetPodLogs(testName string, tail bool, lines int, pods ...string) error

GetPodLogs provides convenience on printing the logs from prods. // Filter query: // - Run with '--all' // - Run with '--logs all pod1 ...' // - Run with '--logs all' // - Run with '--logs SYS' // - Run with '--logs SUT' // - Run with '--logs pod1 pod2 ...'

func GetTemplateResources

func GetTemplateResources(testName string) error

func Helm

func Helm(testName string, arguments ...string) ([]byte, error)

func HelmIgnoreNotFound added in v1.0.28

func HelmIgnoreNotFound(err error) error

func InstallFrisbeeOnK8s added in v1.0.28

func InstallFrisbeeOnK8s(command []string, options *FrisbeeInstallOptions)

func Kubectl

func Kubectl(testName string, arguments ...string) ([]byte, error)

func LabelNamespace added in v1.0.25

func LabelNamespace(name string, labels ...string) error

func ListHelm

func ListHelm(testName string) error

func LoggedHelm added in v1.0.28

func LoggedHelm(testName string, arguments ...string) ([]byte, error)

func LoggedKubectl added in v1.0.28

func LoggedKubectl(testName string, arguments ...string) ([]byte, error)

func OpenShell

func OpenShell(testName string, podName string, shellArgs ...string) error

func PopulateInstallFlags added in v1.0.28

func PopulateInstallFlags(cmd *cobra.Command, options *FrisbeeInstallOptions)

func RenderGoTemplate

func RenderGoTemplate(item interface{}, w io.Writer, tpl string) error

func RenderGoTemplateList

func RenderGoTemplateList(list []interface{}, w io.Writer, tpl string) error

func RenderJSON

func RenderJSON(obj interface{}, w io.Writer) error

func RenderList

func RenderList(obj interface{}, w io.Writer) error

func RenderPrettyList

func RenderPrettyList(obj ui.TableData, w io.Writer) error

func RenderYaml

func RenderYaml(obj interface{}, w io.Writer) error

func RunTest

func RunTest(testName string, testFile string, mode ValidationMode) error

func WaitForCondition added in v1.0.27

func WaitForCondition(testName string, condition v1alpha1.ConditionType, timeout string) error

Types

type CliObjRenderer

type CliObjRenderer func(ui *ui.UI, obj interface{}) error

type FrisbeeInstallOptions added in v1.0.28

type FrisbeeInstallOptions struct {
	Name, Namespace string
	NoCertManager   bool
}

type OutputType

type OutputType string
const (
	OutputGoTemplate OutputType = "go"
	OutputJSON       OutputType = "json"
	OutputYAML       OutputType = "yaml"
	OutputPretty     OutputType = "pretty"
)

type ValidationMode added in v1.0.30

type ValidationMode uint8
const (
	ValidationNone ValidationMode = iota
	ValidationClient
	ValidationServer
)

Jump to

Keyboard shortcuts

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