Documentation ¶
Index ¶
- func GetCreatedVersion(store LocatorStatusStore, sessionName string) string
- func GetDeletedVersion(store LocatorStatusStore) string
- func GetSha(version string) string
- func GetVersion(store LocatorStatusStore) string
- type HostName
- type LocatedReporter
- type Locator
- type LocatorStatus
- type LocatorStatusReporter
- type LocatorStatusStore
- type LocatorStore
- type Modificator
- type ModificatorController
- type ModificatorRegistrar
- type ModificatorStatus
- type ModificatorStatusReporter
- type ModificatorStore
- type Ref
- type RefKindName
- type Resource
- type Route
- type SessionContext
- type StatusAction
- type Sync
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCreatedVersion ¶ added in v0.4.0
func GetCreatedVersion(store LocatorStatusStore, sessionName string) string
GetCreatedVersion returns the new calculated version for the created resources if any. Returns unknown if not found.
func GetDeletedVersion ¶ added in v0.4.0
func GetDeletedVersion(store LocatorStatusStore) string
GetDeletedVersion returns the version for the deleted resources if any. Returns unknown if not found.
func GetSha ¶ added in v0.0.9
GetSha computes a hash of the version and returns 8 characters substring of it.
func GetVersion ¶ added in v0.4.0
func GetVersion(store LocatorStatusStore) string
GetVersion returns the version for the created resources if any. Returns unknown if not found.
Types ¶
type HostName ¶ added in v0.0.3
HostName represents the Hostname of a service in a given namespace.
func GetTargetHostNames ¶ added in v0.4.0
func GetTargetHostNames(store LocatorStatusStore) []HostName
GetTargetHostNames returns a list of Host names that the target Deployment can be reached under.
func NewHostName ¶ added in v0.4.0
type LocatedReporter ¶ added in v0.4.0
type LocatedReporter func(LocatorStatusStore)
type Locator ¶
type Locator func(context SessionContext, ref Ref, store LocatorStatusStore, reporter LocatorStatusReporter) error
Locator should report on Resources that need some Action performed on them to satisfy the Ref.
type LocatorStatus ¶ added in v0.4.0
type LocatorStatus struct { Resource TimeStamp time.Time Labels map[string]string Action StatusAction }
LocatorStatus is the action to perform an a given Resource as calculated by the Locators.
type LocatorStatusReporter ¶ added in v0.4.0
type LocatorStatusReporter func(LocatorStatus)
type LocatorStatusStore ¶ added in v0.4.0
type LocatorStatusStore func(kind ...string) []LocatorStatus
type LocatorStore ¶ added in v0.4.0
type LocatorStore struct {
// contains filtered or unexported fields
}
func (*LocatorStore) Clear ¶ added in v0.4.0
func (l *LocatorStore) Clear()
func (*LocatorStore) Report ¶ added in v0.4.0
func (l *LocatorStore) Report(status LocatorStatus)
func (*LocatorStore) Store ¶ added in v0.4.0
func (l *LocatorStore) Store(kind ...string) []LocatorStatus
type Modificator ¶ added in v0.4.0
type Modificator func(context SessionContext, ref Ref, store LocatorStatusStore, reporter ModificatorStatusReporter)
Modificator should perform the provided action on the given Resources provided by the Locator, e.g. Modify or Revert.
type ModificatorController ¶ added in v0.4.0
type ModificatorController func(LocatorStatusStore) bool
type ModificatorRegistrar ¶ added in v0.4.0
type ModificatorRegistrar func() (targetResourceType client.Object, modificator Modificator)
type ModificatorStatus ¶ added in v0.4.0
type ModificatorStatus struct { LocatorStatus Error error Success bool Prop map[string]string Target *Resource }
ModificatorStatus is the status of the given Locator action after it's been attempted performed.
type ModificatorStatusReporter ¶ added in v0.4.0
type ModificatorStatusReporter func(ModificatorStatus)
type ModificatorStore ¶ added in v0.4.0
type ModificatorStore struct {
Stored []ModificatorStatus
}
ModificatorStore Dummy impl for testing purposes.
func (*ModificatorStore) Report ¶ added in v0.4.0
func (m *ModificatorStore) Report(status ModificatorStatus)
type Ref ¶
type Ref struct { KindName RefKindName Remove bool Namespace string Strategy string Args map[string]string }
Ref references the user specified Resource target and configuration.
type RefKindName ¶ added in v0.1.0
RefKindName is the target Resource and optional Resource Kind.
func ParseRefKindName ¶ added in v0.1.0
func ParseRefKindName(exp string) RefKindName
ParseRefKindName parses a String() representation into a Object.
func (RefKindName) String ¶ added in v0.1.0
func (r RefKindName) String() string
String returns the string formatted kind/name.
func (RefKindName) SupportsKind ¶ added in v0.1.0
func (r RefKindName) SupportsKind(kind string) bool
SupportsKind returns true if kind match or the kind is empty.
type Resource ¶ added in v0.4.0
func (*Resource) GetNamespaceName ¶ added in v0.5.3
type SessionContext ¶
type SessionContext struct { context.Context //nolint:containedctx //reason needs refactoring https://github.com/maistra/istio-workspace/issues/1100 Name string Namespace string Route Route Client client.Client Log logr.Logger }
func (*SessionContext) ToNamespacedName ¶ added in v0.0.8
func (s *SessionContext) ToNamespacedName() types.NamespacedName
ToNamespacedName returns a types.NamespaceName object that represents this Session.
type StatusAction ¶ added in v0.4.0
type StatusAction string
StatusAction describes which type of operation was done/attempted to the target resource. Used to determine how to undo it.
const ( // ActionCreate imply the whole Named Kind should be created. ActionCreate StatusAction = "create" // ActionDelete imply the whole Named Kind was created and should be deleted. ActionDelete StatusAction = "delete" // ActionModify imply the Named Kind should be modified. ActionModify StatusAction = "modify" // ActionRevert imply the Named Kind was modified and should be reverted to original state. ActionRevert StatusAction = "revert" // ActionLocated imply the resource was found, but nothing was changed. ActionLocated StatusAction = "located" // StrategyExisting holds the name of the existing strategy. StrategyExisting = "existing" )
func Flip ¶ added in v0.4.0
func Flip(action StatusAction) StatusAction
type Sync ¶ added in v0.4.0
type Sync func(SessionContext, Ref, ModificatorController, LocatedReporter, ModificatorStatusReporter)
Sync is the entry point for ensuring the desired state for the given Ref is up-to-date.
func NewSync ¶ added in v0.4.0
func NewSync(locators []Locator, modificators []Modificator) Sync