eventlooptypes

package
v0.0.0-...-d212fee Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const KubeSystemNamespace = "kube-system"

Variables

This section is empty.

Functions

func EventsMatch

func EventsMatch(one *EventLoopEvent, two *EventLoopEvent) string

EventsMatch returns "" if the events match, otherwise returns a string indicating which field did not match

func GetK8sClientForGitOpsEngineInstance

func GetK8sClientForGitOpsEngineInstance(ctx context.Context, gitopsEngineInstance *db.GitopsEngineInstance) (client.Client, error)

GetK8sClientForGitOpsEngineInstance returns a client for accessing resources from a GitOpsEngine cluster based on the environment. Returns a normal client that targets the same cluster as backend.

func GetK8sClientForServiceWorkspace

func GetK8sClientForServiceWorkspace() (client.Client, error)

GetK8sClientForServiceWorkspace returns a client for service provider workspace

func GetWorkspaceIDFromNamespaceID

func GetWorkspaceIDFromNamespaceID(namespace corev1.Namespace) string

func StringEventLoopEvent

func StringEventLoopEvent(obj *EventLoopEvent) string

eventlooptypes.StringEventLoopEvent is a utility function for debug purposes.

Types

type EventLoopEvent

type EventLoopEvent struct {

	// EventType indicates the type of event, usually the modification of a resource
	EventType EventLoopEventType

	// Request from the event context
	Request ctrl.Request

	// Client from the event context
	Client client.Client

	// ReqResource indicates whether the event is for a GitOpsDeployment, or DeploymentSyncRun (or other resources)
	ReqResource GitOpsResourceType

	// WorkspaceID is the UID of the namespace that contains the request
	WorkspaceID string
}

EventLoopEvent tracks an event received from the controllers in the apis/managed-gitops/v1alpha1 package. For example, when a GitOpsDeployment is created/modified/deleted, an EventLoopEvent is created and is then processed by the event loops.

type EventLoopEventType

type EventLoopEventType string
const (
	DeploymentModified           EventLoopEventType = "DeploymentModified"
	RepositoryCredentialModified EventLoopEventType = "RepositoryCredentialModified"
	ManagedEnvironmentModified   EventLoopEventType = "ManagedEnvironmentModified"
	SyncRunModified              EventLoopEventType = "SyncRunModified"
	UpdateDeploymentStatusTick   EventLoopEventType = "UpdateDeploymentStatusTick"
)

type EventLoopMessage

type EventLoopMessage struct {
	MessageType EventLoopMessageType
	Event       *EventLoopEvent

	// ShutdownSignalled is included as part of workComplete message, to indicate that the goroutine has successfully shut down.
	ShutdownSignalled bool
}

Packages an EventLoopEvent as a message between event loop channels. - The type of messages depends on the MessageType

type EventLoopMessageType

type EventLoopMessageType int
const (

	// ApplicationEventLoopMessageType_WorkComplete indicates the message indicates that a particular task has completed.
	// For example:
	ApplicationEventLoopMessageType_WorkComplete EventLoopMessageType = iota

	// ApplicationEventLoopMessageType_Event indicates that the message contains an event
	ApplicationEventLoopMessageType_Event

	// ApplicationEventLoopMessageType_StatusCheck is a periodic ticker that tells the application event loop to
	// check if it should terminate its goroutine
	ApplicationEventLoopMessageType_StatusCheck
)

type GitOpsResourceType

type GitOpsResourceType string
const (
	GitOpsDeploymentTypeName                     GitOpsResourceType = "GitOpsDeployment"
	GitOpsDeploymentSyncRunTypeName              GitOpsResourceType = "GitOpsDeploymentSyncRun"
	GitOpsDeploymentRepositoryCredentialTypeName GitOpsResourceType = "GitOpsDeploymentRepositoryCredential"
	GitOpsDeploymentManagedEnvironmentTypeName   GitOpsResourceType = "GitOpsDeploymentManagedEnvironmentTypeName"
)

Jump to

Keyboard shortcuts

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