flux: github.com/fluxcd/flux/pkg/event Index | Files

package event

import "github.com/fluxcd/flux/pkg/event"


Package Files



const (
    EventCommit       = "commit"
    EventSync         = "sync"
    EventRelease      = "release"
    EventAutoRelease  = "autorelease"
    EventAutomate     = "automate"
    EventDeautomate   = "deautomate"
    EventLock         = "lock"
    EventUnlock       = "unlock"
    EventUpdatePolicy = "update_policy"

    // This is used to label e.g., commits that we _don't_ consider an event in themselves.
    NoneOfTheAbove = "other"

    LogLevelDebug = "debug"
    LogLevelInfo  = "info"
    LogLevelWarn  = "warn"
    LogLevelError = "error"

These are all the types of events.

const (
    // ReleaseImageSpecType is a type of release spec when there are update.Images
    ReleaseImageSpecType = "releaseImageSpecType"
    // ReleaseContainersSpecType is a type of release spec when there are update.Containers
    ReleaseContainersSpecType = "releaseContainersSpecType"

type AutoReleaseEventMetadata Uses

type AutoReleaseEventMetadata struct {
    Spec update.Automated `json:"spec"`

AutoReleaseEventMetadata is for when workloads(s) are released automatically because there's a new image or images

func (*AutoReleaseEventMetadata) Type Uses

func (rem *AutoReleaseEventMetadata) Type() string

type Commit Uses

type Commit struct {
    Revision string `json:"revision"`
    Message  string `json:"message"`

Commit represents the commit information in a sync event. We could use git.Commit, but that would lead to an import cycle, and may anyway represent coupling (of an internal API to serialised data) that we don't want.

type CommitEventMetadata Uses

type CommitEventMetadata struct {
    Revision string        `json:"revision,omitempty"`
    Spec     *update.Spec  `json:"spec"`
    Result   update.Result `json:"result,omitempty"`

CommitEventMetadata is the metadata for when new git commits are created

func (CommitEventMetadata) ShortRevision Uses

func (c CommitEventMetadata) ShortRevision() string

func (*CommitEventMetadata) Type Uses

func (cem *CommitEventMetadata) Type() string

type Event Uses

type Event struct {
    // ID is a UUID for this event. Will be auto-set when saving if blank.
    ID  EventID `json:"id"`

    // Identifiers of workloads affected by this event.
    // TODO: rename to WorkloadIDs after adding versioning.
    ServiceIDs []resource.ID `json:"serviceIDs"`

    // Type is the type of event, usually "release" for now, but could be other
    // things later
    Type string `json:"type"`

    // StartedAt is the time the event began.
    StartedAt time.Time `json:"startedAt"`

    // EndedAt is the time the event ended. For instantaneous events, this will
    // be the same as StartedAt.
    EndedAt time.Time `json:"endedAt"`

    // LogLevel for this event. Used to indicate how important it is.
    // `debug|info|warn|error`
    LogLevel string `json:"logLevel"`

    // Message is a pre-formatted string for errors and other stuff. Included for
    // backwards-compatibility, and is now somewhat unnecessary. Should only be
    // used if metadata is empty.
    Message string `json:"message,omitempty"`

    // Metadata is Event.Type-specific metadata. If an event has no metadata,
    // this will be nil.
    Metadata EventMetadata `json:"metadata,omitempty"`

func (Event) String Uses

func (e Event) String() string

func (*Event) UnmarshalJSON Uses

func (e *Event) UnmarshalJSON(in []byte) error

func (Event) WorkloadIDStrings Uses

func (e Event) WorkloadIDStrings() []string

type EventID Uses

type EventID int64

type EventMetadata Uses

type EventMetadata interface {
    Type() string

EventMetadata is a type safety trick used to make sure that Metadata field of Event is always a pointer, so that consumers can cast without being concerned about encountering a value type instead. It works by virtue of the fact that the method is only defined for pointer receivers; the actual method chosen is entirely arbitrary.

type EventWriter Uses

type EventWriter interface {
    // LogEvent records a message in the history.
    LogEvent(Event) error

type ReleaseEventCommon Uses

type ReleaseEventCommon struct {
    Revision string        // the revision which has the changes for the release
    Result   update.Result `json:"result"`
    // Message of the error if there was one.
    Error string `json:"error,omitempty"`

type ReleaseEventMetadata Uses

type ReleaseEventMetadata struct {
    Spec  ReleaseSpec  `json:"spec"`
    Cause update.Cause `json:"cause"`

ReleaseEventMetadata is the metadata for when workloads(s) are released

func (*ReleaseEventMetadata) Type Uses

func (rem *ReleaseEventMetadata) Type() string

type ReleaseSpec Uses

type ReleaseSpec struct {
    // Type is ReleaseImageSpecType or ReleaseContainersSpecType
    // if empty (for previous version), then use ReleaseImageSpecType
    Type                  string
    ReleaseImageSpec      *update.ReleaseImageSpec
    ReleaseContainersSpec *update.ReleaseContainersSpec

ReleaseSpec is a spec for images and containers release

func (ReleaseSpec) IsKindExecute Uses

func (s ReleaseSpec) IsKindExecute() (bool, error)

IsKindExecute reports whether the release spec s has ReleaseImageSpec or ReleaseImageSpec with Kind execute or error if s has invalid Type

func (*ReleaseSpec) UnmarshalJSON Uses

func (s *ReleaseSpec) UnmarshalJSON(b []byte) error

UnmarshalJSON for old version of spec (update.ReleaseImageSpec) where Type is empty

type ResourceError Uses

type ResourceError struct {
    ID    resource.ID
    Path  string
    Error string

type SyncEventMetadata Uses

type SyncEventMetadata struct {
    // for parsing old events; Commits is now used in preference
    Revs    []string `json:"revisions,omitempty"`
    Commits []Commit `json:"commits,omitempty"`
    // Which "kinds" of commit this includes; release, autoreleases,
    // policy changes, and "other" (meaning things we didn't commit
    // ourselves)
    Includes map[string]bool `json:"includes,omitempty"`
    // Per-resource errors
    Errors []ResourceError `json:"errors,omitempty"`
    // `true` if we have no record of having synced before
    InitialSync bool `json:"initialSync,omitempty"`

SyncEventMetadata is the metadata for when new a commit is synced to the cluster

func (*SyncEventMetadata) Type Uses

func (cem *SyncEventMetadata) Type() string

func (*SyncEventMetadata) UnmarshalJSON Uses

func (ev *SyncEventMetadata) UnmarshalJSON(b []byte) error

Account for old events, which used the revisions field rather than commits

type UnknownEventMetadata Uses

type UnknownEventMetadata map[string]interface{}

func (UnknownEventMetadata) Type Uses

func (uem UnknownEventMetadata) Type() string

Special exception from pointer receiver rule, as UnknownEventMetadata is a type alias for a map

Package event imports 8 packages (graph) and is imported by 6 packages. Updated 2020-11-25. Refresh now. Tools for package owners.