Documentation
¶
Index ¶
- Constants
- func IsObjectApplyable(obj client.Object) bool
- func IsObjectDeclarable(_ client.Object) bool
- type ErrorSummary
- type NamespacedNameSlice
- type ObjectIDSlice
- type ObjectOperation
- type ObjectSetExpectations
- type Operation
- type Summary
- type SyncExpectations
- type SyncKind
- type SyncSetExpectations
- func (ae *SyncSetExpectations) AddObjectApply(syncKind SyncKind, syncNN types.NamespacedName, obj client.Object)
- func (ae *SyncSetExpectations) AddObjectDelete(syncKind SyncKind, syncNN types.NamespacedName, obj client.Object)
- func (ae *SyncSetExpectations) AddObjectOperation(syncKind SyncKind, syncNN types.NamespacedName, obj client.Object, ...)
- func (ae *SyncSetExpectations) ExpectedObjectCount(syncKind SyncKind, syncNN types.NamespacedName) int
- func (ae *SyncSetExpectations) ExpectedObjectOperations(syncKind SyncKind, syncNN types.NamespacedName) []ObjectOperation
- func (ae *SyncSetExpectations) ExpectedRepoSyncObjectCount(syncNN types.NamespacedName) int
- func (ae *SyncSetExpectations) ExpectedRepoSyncObjectOperations(syncNN types.NamespacedName) []ObjectOperation
- func (ae *SyncSetExpectations) ExpectedRootSyncObjectCount(syncName string) int
- func (ae *SyncSetExpectations) ExpectedRootSyncObjectOperations(syncName string) []ObjectOperation
- func (ae *SyncSetExpectations) RemoveObject(syncKind SyncKind, syncNN types.NamespacedName, obj client.Object)
- func (ae *SyncSetExpectations) Reset()
- func (ae *SyncSetExpectations) ResetRepoSync(syncNN types.NamespacedName)
- func (ae *SyncSetExpectations) ResetRootSync(syncName string)
- func (ae *SyncSetExpectations) String() string
Constants ¶
const ( // RootSyncKind is the kind of the RootSync resource RootSyncKind = SyncKind(configsync.RootSyncKind) // RepoSyncKind is the kind of the RepoSync resource RepoSyncKind = SyncKind(configsync.RepoSyncKind) )
Variables ¶
This section is empty.
Functions ¶
func IsObjectApplyable ¶
IsObjectApplyable returns true if the object will be applied by Config Sync when included in the source.
func IsObjectDeclarable ¶
IsObjectDeclarable returns true if the object should be included in the declared resources passed to the applier.
Types ¶
type ErrorSummary ¶
type ErrorSummary struct {
// Fights is the expected value of the resource_fights_view metric.
Fights int
// Conflicts is the expected value of the resource_conflicts_view metric.
Conflicts int
// Internal is the expected value of the internal_errors_view metric.
Internal int
// Rendering is the expected value of the reconciler_errors_view metric,
// when component=rendering.
Rendering int
// Source is the expected value of the reconciler_errors_view metric, when
// component=source.
Source int
// Sync is the expected value of the reconciler_errors_view metric, when
// component=sync.
Sync int
}
ErrorSummary describes the expected state of a set of standard error metrics.
type NamespacedNameSlice ¶
type NamespacedNameSlice []types.NamespacedName
NamespacedNameSlice attaches the methods of sort.Interface to []types.NamespacedName, sorting in increasing order, namespace > name.
func (NamespacedNameSlice) Len ¶
func (x NamespacedNameSlice) Len() int
Len returns the size of the slice
func (NamespacedNameSlice) Less ¶
func (x NamespacedNameSlice) Less(i, j int) bool
Less returns true if the value at index i is less than the value at index j.
func (NamespacedNameSlice) Sort ¶
func (x NamespacedNameSlice) Sort()
Sort is a convenience method: x.Sort() calls sort.Sort(x).
func (NamespacedNameSlice) Swap ¶
func (x NamespacedNameSlice) Swap(i, j int)
Sort is a convenience method: x.Sort() calls sort.Sort(x).
type ObjectIDSlice ¶
ObjectIDSlice attaches the methods of sort.Interface to []core.ID, sorting in increasing order, group > kind > namespace > name.
func (ObjectIDSlice) Less ¶
func (x ObjectIDSlice) Less(i, j int) bool
Less returns true if the value at index i is less than the value at index j.
func (ObjectIDSlice) Sort ¶
func (x ObjectIDSlice) Sort()
Sort is a convenience method: x.Sort() calls sort.Sort(x).
type ObjectOperation ¶
type ObjectOperation struct {
// Operation performed on the object
Operation Operation
// Count of the times the operation was performed on objects of the
// specified kind
Count int
}
ObjectOperation is used for validating count aggregated metrics that have a "operation" tag (ex: `api_duration_seconds` & `apply_operations`).
func AppendOperations ¶
func AppendOperations(to []ObjectOperation, from ...ObjectOperation) []ObjectOperation
AppendOperations updates a list of ObjectOperations to add the specified operation
type ObjectSetExpectations ¶
ObjectSetExpectations is a map of object IDs to expected operations.
type Operation ¶
type Operation string
Operation is an enum of possible values for the "operation" metric tag.
const ( // UpdateOperation is the value expected for the "operation" metric tag for // objects that have been included in the source and applied/updated/patched. UpdateOperation Operation = "update" // DeleteOperation is the value expected for the "operation" metric tag for // objects that have been removed from source and deleted. DeleteOperation Operation = "delete" // SkipOperation is used to filter out objects that are declared in source, // but not updated/deleted SkipOperation Operation = "skip" // OtelCollectorMetricsPort is the port where prometheus metrics are exposed OtelCollectorMetricsPort = 8675 )
type Summary ¶
type Summary struct {
// Sync is the name and namespace of the RootSync or RepoSync
Sync types.NamespacedName
// ObjectCount is the expected value of the declared_resources_view metric
ObjectCount int
// Operations is a list of operations expected to be represented by the
// operations metrics: api_cal_duration_view, apply_operations_view, &
// remediate_duration_view
Operations []ObjectOperation
// Errors describes the expected state of a set of standard error metrics.
Errors ErrorSummary
// Absolute indicates that the ObjectCount and Operations should not be
// added to the values specified in the ExpectedObjects struct.
Absolute bool
}
Summary describes the expected state for a set of standard metrics.
type SyncExpectations ¶
type SyncExpectations map[types.NamespacedName]ObjectSetExpectations
SyncExpectations is a map of sync name & namespace to ObjectExpectations.
type SyncSetExpectations ¶
type SyncSetExpectations struct {
// contains filtered or unexported fields
}
SyncSetExpectations tracks metrics expectations for a set of RootSyncs and RepoSyncs.
func NewSyncSetExpectations ¶
func NewSyncSetExpectations(t testing.NTB, scheme *runtime.Scheme) *SyncSetExpectations
NewSyncSetExpectations constructs a new map of operations expected to be performed by a set of syncs (specifically, the reconciler appliers, not the remediators).
func (*SyncSetExpectations) AddObjectApply ¶
func (ae *SyncSetExpectations) AddObjectApply(syncKind SyncKind, syncNN types.NamespacedName, obj client.Object)
AddObjectApply specifies that an object is expected to be declared in the source of truth for the specified RSync.
func (*SyncSetExpectations) AddObjectDelete ¶
func (ae *SyncSetExpectations) AddObjectDelete(syncKind SyncKind, syncNN types.NamespacedName, obj client.Object)
AddObjectDelete specifies that an object is expected to be deleted and removed from the source of truth for the specified RSync.
func (*SyncSetExpectations) AddObjectOperation ¶
func (ae *SyncSetExpectations) AddObjectOperation(syncKind SyncKind, syncNN types.NamespacedName, obj client.Object, operation Operation)
AddObjectOperation specifies that an object is expected to be updated or deleted from the source of truth for the specified RSync.
func (*SyncSetExpectations) ExpectedObjectCount ¶
func (ae *SyncSetExpectations) ExpectedObjectCount(syncKind SyncKind, syncNN types.NamespacedName) int
ExpectedObjectCount returns the expected number of declared resource objects for the specified sync.
func (*SyncSetExpectations) ExpectedObjectOperations ¶
func (ae *SyncSetExpectations) ExpectedObjectOperations(syncKind SyncKind, syncNN types.NamespacedName) []ObjectOperation
ExpectedObjectOperations returns the expected operations to be performed by the reconciler for the specified sync.
func (*SyncSetExpectations) ExpectedRepoSyncObjectCount ¶
func (ae *SyncSetExpectations) ExpectedRepoSyncObjectCount(syncNN types.NamespacedName) int
ExpectedRepoSyncObjectCount returns the expected number of declared resource objects in the specified RepoSync.
func (*SyncSetExpectations) ExpectedRepoSyncObjectOperations ¶
func (ae *SyncSetExpectations) ExpectedRepoSyncObjectOperations(syncNN types.NamespacedName) []ObjectOperation
ExpectedRepoSyncObjectOperations returns the expected operations to be performed by the reconciler for the specified RepoSync.
func (*SyncSetExpectations) ExpectedRootSyncObjectCount ¶
func (ae *SyncSetExpectations) ExpectedRootSyncObjectCount(syncName string) int
ExpectedRootSyncObjectCount returns the expected number of declared resource objects in the specified RootSync.
func (*SyncSetExpectations) ExpectedRootSyncObjectOperations ¶
func (ae *SyncSetExpectations) ExpectedRootSyncObjectOperations(syncName string) []ObjectOperation
ExpectedRootSyncObjectOperations returns the expected operations to be performed by the reconciler for the specified RootSync.
func (*SyncSetExpectations) RemoveObject ¶
func (ae *SyncSetExpectations) RemoveObject(syncKind SyncKind, syncNN types.NamespacedName, obj client.Object)
RemoveObject removes an object from the set of objects expected to be declared in the source of truth for the specified RSync.
func (*SyncSetExpectations) Reset ¶
func (ae *SyncSetExpectations) Reset()
Reset the expected operations
func (*SyncSetExpectations) ResetRepoSync ¶
func (ae *SyncSetExpectations) ResetRepoSync(syncNN types.NamespacedName)
ResetRepoSync resets the expected operations for the specified RepoSync
func (*SyncSetExpectations) ResetRootSync ¶
func (ae *SyncSetExpectations) ResetRootSync(syncName string)
ResetRootSync resets the expected operations for the specified RootSync
func (*SyncSetExpectations) String ¶
func (ae *SyncSetExpectations) String() string
String returns the operations in json format, for logging.