common

package
v1.0.39 Latest Latest
Warning

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

Go to latest
Published: May 12, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClusterScope        = ""
	FrisbeeInstallation = "frisbee"
	FrisbeeNamespace    = "frisbee"
)
View Source
const (
	FrisbeeRepo  = "https://carv-ics-forth.github.io/frisbee/charts"
	JetstackRepo = "https://charts.jetstack.io"
)
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)`

	NoResources       = `No resources found in .+ namespace.`
	PodNotFound       = `Error from server \(NotFound\): pods ".+" not found`
	NamespaceNotFound = `Error from server \(NotFound\): namespaces ".+" not found`
)
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 = "Chart   Template   Parameters"
View Source
const (
	K8SRemoveFinalizer = `--patch=[{"op":"remove","path":"/metadata/finalizers"}]`
)
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 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=Chart:.metadata.annotations.meta\\.helm\\.sh\\/release-name",
	"Template:.metadata.name",
	"Parameters:spec.inputs.parameters",
}, ",")

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 ErrNamespaceNotFound added in v1.0.37

func ErrNamespaceNotFound(out []byte) bool

func ErrNoResources added in v1.0.37

func ErrNoResources(out []byte) bool

func ErrNotFound added in v1.0.26

func ErrNotFound(out []byte) bool

func ErrPodNotFound added in v1.0.37

func ErrPodNotFound(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 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 KubectlLogs added in v1.0.37

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

KubectlLogs provides convenience on printing the logs from prods. Filter query:

  • Run with '--logs all'. -> monitor all pods (SYS + SUT)
  • Run with '--logs SYS'. -> monitor only SYS pods
  • Run with '--logs SUT'. -> monitor only SUT pods
  • Run with '--logs pod1'. -> monitor a specific pod
  • Run with '--logs pod1,pod2,pod3,...'. -> monitoring multiple pods

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 {
	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