argoevent

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ServiceAccountName indicates the name of the service account for the argo event.
	ServiceAccountName = "nautes-argo-event-sa"
	// AnnotationCodeRepoUsage defines the name of the key for event source annotation.
	AnnotationCodeRepoUsage = "code-repos"
)
View Source
const CacheName = "nautes-argo-event-cache"

CacheName indicates the name of the ConfigMap.

View Source
const ConfigMapNameConsumerCache = "nautes-consumer-cache"
View Source
const LabelConsumer = "nautes.argoevents.consumer"
View Source
const ServiceAccountArgoEvents = "argo-events-sa"

Variables

This section is empty.

Functions

Types

type ArgoEvent

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

func (*ArgoEvent) CleanUp

func (ae *ArgoEvent) CleanUp() error

CleanUp represents when the component generates cache information, implement this method to clean data. This method will be automatically called by the syncer after each tuning is completed.

func (*ArgoEvent) CreateConsumer

func (ae *ArgoEvent) CreateConsumer(ctx context.Context, consumers component.ConsumerSet) error

CreateConsumer calls the implementation of creating consumers.

func (*ArgoEvent) CreateEventSource

func (ae *ArgoEvent) CreateEventSource(ctx context.Context, eventSource component.EventSourceSet) error

CreateEventSource creates the event source to listen to events, that support to create multi-event source. 1. It creates a cache by event from event sources are in requests event sources. 2. It deletes the event sources that are not in the requested event sources. 3. It adds the request event sources to the cache.

func (*ArgoEvent) DeleteConsumer

func (ae *ArgoEvent) DeleteConsumer(ctx context.Context, productName, name string) error

DeleteConsumer calls the implementation of deleting consumers.

func (*ArgoEvent) DeleteEventSource

func (ae *ArgoEvent) DeleteEventSource(ctx context.Context, uniqueID string) error

DeleteEventSource deletes an event source by event source collection unique ID. 1. It checks the old event source in the cache by unique ID. 2. It deletes the old event source. 3. It deletes the old event source in the cache by unique ID.

func (*ArgoEvent) GetComponentMachineAccount added in v0.4.2

func (ae *ArgoEvent) GetComponentMachineAccount() *component.MachineAccount

type Cache

type Cache struct {
	Gitlab   utils.StringSet `yaml:"gitlab"`
	Calendar utils.StringSet `yaml:"calendar"`
}

func (*Cache) GetEventType

func (c *Cache) GetEventType() []component.EventSourceType

GetEventType gets the event source type of current cache.

func (*Cache) GetMissingEventTypes

func (c *Cache) GetMissingEventTypes(pairCache Cache) []component.EventSourceType

GetMissingEventTypes returns the difference between the current saving cache and the request cache.

type CalendarEventSourceGenerator

type CalendarEventSourceGenerator struct {
	Components     *component.ComponentList
	HostEntrypoint utils.EntryPoint
	Namespace      string
	K8sClient      client.Client
	DB             database.Snapshot
	User           component.MachineAccount
	Space          component.Space
}

func (*CalendarEventSourceGenerator) CreateEventSource

func (cg *CalendarEventSourceGenerator) CreateEventSource(ctx context.Context, eventSource component.EventSourceSet) error

CreateEventSource creates an event source resource of calendar type by event source collection unique ID.

func (*CalendarEventSourceGenerator) DeleteEventSource

func (cg *CalendarEventSourceGenerator) DeleteEventSource(ctx context.Context, uniqueID string) error

DeleteEventSource deletes an event source resource of calendar type by event source collection unique ID.

type EventManager

type EventManager interface {
	CreateEventSource() error
	DeleteEventSource() error
	CreateConsumer() error
	DeleteConsumer() error
}

type GitlabEventSourceGenerator

type GitlabEventSourceGenerator struct {
	Components     *component.ComponentList
	HostEntrypoint utils.EntryPoint
	Namespace      string
	K8sClient      client.Client
	DB             database.Snapshot
	User           component.MachineAccount
	Space          component.Space
	// contains filtered or unexported fields
}

func (*GitlabEventSourceGenerator) CreateEntryPoint

func (gel *GitlabEventSourceGenerator) CreateEntryPoint(ctx context.Context, uniqueID string) error

CreateEntryPoint creates an entry point for listening to the event source, the default is the Ingress of Kubernetes.

func (*GitlabEventSourceGenerator) CreateEventSource

func (gel *GitlabEventSourceGenerator) CreateEventSource(ctx context.Context, eventSource component.EventSourceSet) error

CreateEventSource creates an event source resource of GitLab type by event source. 1. It builds an event source resource by unique ID. 2. It gets code repos that are used by the event source. 3. It creates the access token and secret by unique ID and code repo for request event source. 4. It deletes the access token and secret by unique ID and code repo for not in request event source. 5. It creates the entrypoint for event listener by unique ID. 6. It creates the event source resource which in Kubernetes.

func (*GitlabEventSourceGenerator) DeleteEntryPoint

func (gel *GitlabEventSourceGenerator) DeleteEntryPoint(ctx context.Context, uniqueID string) error

DeleteEntryPoint deletes the entry point of listening to the event source by event source collection unique ID.

func (*GitlabEventSourceGenerator) DeleteEventSource

func (gel *GitlabEventSourceGenerator) DeleteEventSource(ctx context.Context, uniqueID string) error

DeleteEventSource deletes an event source by event source collection unique ID. 1. It builds an event source resource by unique ID. 2. It gets code repos that are used by the event source. 3. It deletes the access token and secret by unique ID and code repo. 4. It deletes the entrypoint for event listener by unique ID. 5. It deletes the event source resource which in Kubernetes.

type SensorGenerator

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

func (*SensorGenerator) CreateSensor

func (sg *SensorGenerator) CreateSensor(ctx context.Context, consumer component.ConsumerSet) error

CreateSensor creates the consumer to trigger the init pipeline. The consumers listen to different types of event sources that generate events. 1. It creates or updates all the Sensors by the consumer. 2. Remove out date sensors.

func (*SensorGenerator) DeleteSensor

func (sg *SensorGenerator) DeleteSensor(ctx context.Context, productName, name string) error

DeleteSensor deletes all consumers by product name and name of consumer collection.

Jump to

Keyboard shortcuts

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