internal

package
v0.0.0-...-479929f Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var JsonLogger zerolog.Logger
View Source
var JsonLogging bool

JsonLogging defines whether the logging should be structured json logging

View Source
var LoggingContext map[string]interface{}
View Source
var Verbosity = false

Verbosity defines whether the functions should print verbose output

Functions

func CreateProcessInstanceOnPartition

func CreateProcessInstanceOnPartition(piCreator ProcessInstanceCreator, requiredPartition int32, timeout time.Duration) error

func CreateZeebeClient

func CreateZeebeClient(port int) (zbc.Client, error)

func DeployChaosModels

func DeployChaosModels(client zbc.Client) error

func DeployDifferentVersions

func DeployDifferentVersions(client zbc.Client, versions int32) error

func DeployModel

func DeployModel(client zbc.Client, fileName string) (int64, error)

func DeployModelBytes

func DeployModelBytes(client zbc.Client, fileName string, bpmnBytes []byte) (int64, error)

func ExtractPartitionIdFromKey

func ExtractPartitionIdFromKey(key int64) int32

func FindCorrelationKeyForPartition

func FindCorrelationKeyForPartition(expectedPartition int, partitionsCount int) (string, error)

func GetBrokerNodeId

func GetBrokerNodeId(zbClient zbc.Client, partitionId int, role string) (int32, error)

func GetBrokerPodForNodeId

func GetBrokerPodForNodeId(k8Client K8Client, brokerNodeId int32) (*v1.Pod, error)

func GetBrokerPodForPartitionAndRole

func GetBrokerPodForPartitionAndRole(k8Client K8Client,
	zbClient zbc.Client,
	partitionId int,
	role string) (*v1.Pod, error)

func GetBrokerPodNameForPartitionAndRole

func GetBrokerPodNameForPartitionAndRole(k8Client K8Client,
	zbClient zbc.Client,
	partitionId int,
	role string) (string, error)

func GetTopology

func GetTopology(zbClient zbc.Client) (*pb.TopologyResponse, error)

func LogInfo

func LogInfo(text string, a ...any)

func LogVerbose

func LogVerbose(text string, a ...any)

func MakeIpReachable

func MakeIpReachable(k8Client K8Client, podName string, ip string) error

func MakeIpReachableForPod

func MakeIpReachableForPod(k8Client K8Client, podName string) error

func MakeIpUnreachableForPod

func MakeIpUnreachableForPod(k8Client K8Client, podIp string, podName string) error

func PutStressOnPod

func PutStressOnPod(k8Client K8Client, timeoutSec string, podName string, containerName string, stressType StressType) error

func SendCountOfCommands

func SendCountOfCommands(commandSender ZCCommandSender, countOfInstances int32, timeout time.Duration) error

func SetInitContainerBlockFlag

func SetInitContainerBlockFlag(k8Client K8Client, nodeId int, flag string) error

If the flag set to true, init container will be caught in a loop and prevents the start up of the zeebe broker. When the flag is set to false, init container exits and zeebe broker will be restarted.

Types

type FakeActivateCommand

type FakeActivateCommand struct {
	commands.ActivateJobsCommandStep2
	commands.ActivateJobsCommandStep3
	commands.DispatchActivateJobsCommand
	// contains filtered or unexported fields
}

func (*FakeActivateCommand) MaxJobsToActivate

func (f *FakeActivateCommand) MaxJobsToActivate(maxActivate int32) commands.ActivateJobsCommandStep3

func (*FakeActivateCommand) Send

type FakeClient

Fake implementation of the Zeebe client.

Can be used for unit tests to verify whether the right properties are set. Should be continously extended to increase test coverage.

func (*FakeClient) BPMNProcessId

func (*FakeClient) JobKey

func (*FakeClient) JobType

func (f *FakeClient) JobType(jobType string) commands.ActivateJobsCommandStep2

func (*FakeClient) NewActivateJobsCommand

func (f *FakeClient) NewActivateJobsCommand() commands.ActivateJobsCommandStep1

func (*FakeClient) NewCompleteJobCommand

func (f *FakeClient) NewCompleteJobCommand() commands.CompleteJobCommandStep1

func (*FakeClient) NewCreateInstanceCommand

func (f *FakeClient) NewCreateInstanceCommand() commands.CreateInstanceCommandStep1

func (*FakeClient) Send

func (*FakeClient) VariablesFromString

func (f *FakeClient) VariablesFromString(json string) (commands.CreateInstanceCommandStep3, error)

func (*FakeClient) Version

func (*FakeClient) WithResult

type FakeCompleteCommand

func (*FakeCompleteCommand) Send

type JobCompleteOptions

type JobCompleteOptions struct {
	JobType string
}

type K8Client

type K8Client struct {
	ClientConfig  clientcmd.ClientConfig
	DynamicClient dynamic.Interface
	Clientset     kubernetes.Interface
	SaaSEnv       bool
}

func CreateK8Client

func CreateK8Client(kubeConfigPath string, namespace string) (K8Client, error)

Creates a kubernetes client, based on the local kubeconfig

func (K8Client) ApplyInitContainerPatch

func (c K8Client) ApplyInitContainerPatch() error
Used for dataloss simulation test, to restrict when a deleted zeebe broker is restarted.

This add an InitContainer to zeebe pods. The init container is blocked in an infinite loop, until the value of `block_{node_id}` in the config map is set to false. To restrict when a deleted pod is restarted, first update the configmap and set the respective `block_{node_id}` true. Then delete the pod. Once it is time to restart the pod, update the config map to set the `block_{nodeId}` to false. The updated config map will be eventually (usually with in a minute) by the init container and breaks out of the loop. The init container exits and the zeebe container will be started.

func (K8Client) AwaitPodReadiness

func (c K8Client) AwaitPodReadiness(podName string, timeout time.Duration) error

func (K8Client) AwaitReadiness

func (c K8Client) AwaitReadiness() error

func (K8Client) AwaitReadinessWithTimeout

func (c K8Client) AwaitReadinessWithTimeout(timeout time.Duration, tickTime time.Duration) error

func (K8Client) CreateWorkerDeployment

func (c K8Client) CreateWorkerDeployment(dockerImageTag string, pollingDelayMs int) error

func (K8Client) CreateWorkerDeploymentDefault

func (c K8Client) CreateWorkerDeploymentDefault() error

func (K8Client) DeletePvcOfBroker

func (c K8Client) DeletePvcOfBroker(podName string) error

func (K8Client) ExecuteCmdOnPod

func (c K8Client) ExecuteCmdOnPod(cmd []string, pod string) error

func (K8Client) ExecuteCmdOnPodWriteIntoOutput

func (c K8Client) ExecuteCmdOnPodWriteIntoOutput(cmd []string, pod string, output io.Writer) error

func (K8Client) ExecuteCommandViaDebugContainer

func (c K8Client) ExecuteCommandViaDebugContainer(podName string, containerName string, debugImage string, cmd []string) error

func (K8Client) GetBrokerPodNames

func (c K8Client) GetBrokerPodNames() ([]string, error)

func (K8Client) GetBrokerPods

func (c K8Client) GetBrokerPods() (*v1.PodList, error)

func (K8Client) GetCurrentNamespace

func (c K8Client) GetCurrentNamespace() string

Returns the current namespace, defined in the kubeconfig

func (K8Client) GetGatewayPodNames

func (c K8Client) GetGatewayPodNames() ([]string, error)

func (K8Client) GetGatewayPods

func (c K8Client) GetGatewayPods() (*v1.PodList, error)

func (K8Client) GetVolume

func (c K8Client) GetVolume(podName string) (*v1.Volume, error)

func (K8Client) GetWorkerPods

func (c K8Client) GetWorkerPods() (*v1.PodList, error)

func (K8Client) GetZeebeStatefulSet

func (c K8Client) GetZeebeStatefulSet() (*v1.StatefulSet, error)

func (K8Client) MustGatewayPortForward

func (c K8Client) MustGatewayPortForward(localPort int, remotePort int) (int, func())

MustGatewayPortForward creates a port forwarding to a zeebe gateway with the given port. Panics when port forwarding fails. localPort can be 0 to let the OS choose a random, free port. Returns the exposed local port and a function to close the port forwarding.

https://github.com/gruntwork-io/terratest/blob/master/modules/k8s/tunnel.go#L187-L196 https://github.com/kubernetes/client-go/issues/51#issuecomment-436200428

func (K8Client) PauseReconciliation

func (c K8Client) PauseReconciliation() error

func (K8Client) RestartPod

func (c K8Client) RestartPod(podName string) error

func (K8Client) RestartPodWithGracePeriod

func (c K8Client) RestartPodWithGracePeriod(podName string, gracePeriodSec *int64) error

func (K8Client) ResumeReconciliation

func (c K8Client) ResumeReconciliation() error

func (K8Client) ScaleZeebeCluster

func (c K8Client) ScaleZeebeCluster(replicas int) (int, error)

ScaleZeebeCluster Scales the StatefulSet for Zeebe. Waits until scaling is complete before returning the initial scale.

func (K8Client) TerminatePod

func (c K8Client) TerminatePod(podName string) error

type KubernetesSettings

type KubernetesSettings struct {
	// contains filtered or unexported fields
}

type ProcessInstanceCreationOptions

type ProcessInstanceCreationOptions struct {
	Version       int32
	BpmnProcessId string
	Variables     string
	AwaitResult   bool
}

type ProcessInstanceCreator

type ProcessInstanceCreator func() (int64, error)

func CreateProcessInstanceCreator

func CreateProcessInstanceCreator(zbClient zbc.Client, options ProcessInstanceCreationOptions) (ProcessInstanceCreator, error)

type StressType

type StressType struct {
	IoStress  bool
	CpuStress bool
	MemStress bool
}

type ZCCommandSender

type ZCCommandSender func() (int64, error)

func CreateJobCompleter

func CreateJobCompleter(zbClient zbc.Client, options JobCompleteOptions) (ZCCommandSender, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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