Documentation
¶
Index ¶
- func ContextWithListener(ctx context.Context, listener Listener) context.Context
- func FormatAny(obj any) string
- func ReportDiff(ctx context.Context, diff *Diff)
- func ReportError(ctx context.Context, err error, args ...any)
- func ReportReconcileEnd(ctx context.Context, u *unstructured.Unstructured, result reconcile.Result, ...)
- func ReportReconcileStart(ctx context.Context, u *unstructured.Unstructured, t k8s.ReconcilerType)
- type DebugLogListener
- func (l *DebugLogListener) OnDiff(ctx context.Context, diffs *Diff)
- func (l *DebugLogListener) OnError(ctx context.Context, err error, args ...any)
- func (l *DebugLogListener) OnReconcileEnd(ctx context.Context, u *unstructured.Unstructured, result reconcile.Result, ...)
- func (l *DebugLogListener) OnReconcileStart(ctx context.Context, u *unstructured.Unstructured, t k8s.ReconcilerType)
- type Diff
- type DiffField
- type Listener
- type LogFieldUpdates
- func (l *LogFieldUpdates) OnDiff(ctx context.Context, diffs *Diff)
- func (l *LogFieldUpdates) OnError(ctx context.Context, err error, args ...any)
- func (l *LogFieldUpdates) OnReconcileEnd(ctx context.Context, u *unstructured.Unstructured, result reconcile.Result, ...)
- func (l *LogFieldUpdates) OnReconcileStart(ctx context.Context, u *unstructured.Unstructured, t k8s.ReconcilerType)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextWithListener ¶
func FormatAny ¶ added in v1.150.0
FormatAny is a utility function that will render a string representation of a protobuf message, or any other object.
func ReportDiff ¶
ReportDiff should be called by a controller when it detects diffs
func ReportReconcileEnd ¶ added in v1.134.0
func ReportReconcileEnd(ctx context.Context, u *unstructured.Unstructured, result reconcile.Result, err error, t k8s.ReconcilerType)
func ReportReconcileStart ¶
func ReportReconcileStart(ctx context.Context, u *unstructured.Unstructured, t k8s.ReconcilerType)
Types ¶
type DebugLogListener ¶ added in v1.141.0
type DebugLogListener struct {
}
DebugLogListener is a Listener that logs structured reporting events
func (*DebugLogListener) OnDiff ¶ added in v1.141.0
func (l *DebugLogListener) OnDiff(ctx context.Context, diffs *Diff)
OnDiff is called when a controller calls ReportDiffs
func (*DebugLogListener) OnError ¶ added in v1.141.0
func (l *DebugLogListener) OnError(ctx context.Context, err error, args ...any)
OnError is called when a controller calls ReportError
func (*DebugLogListener) OnReconcileEnd ¶ added in v1.141.0
func (l *DebugLogListener) OnReconcileEnd(ctx context.Context, u *unstructured.Unstructured, result reconcile.Result, err error, t k8s.ReconcilerType)
OnReconcileEnd is called when a controller calls ReportReconcileEnd
func (*DebugLogListener) OnReconcileStart ¶ added in v1.141.0
func (l *DebugLogListener) OnReconcileStart(ctx context.Context, u *unstructured.Unstructured, t k8s.ReconcilerType)
OnReconcileStart is called when a controller calls ReportReconcileStart
type Diff ¶
type Diff struct {
Object *unstructured.Unstructured
// Fields contains field-level diffs
// Likely empty if NewObject is true
Fields []DiffField
// IsNewObject is true if the object does not exist in GCP
IsNewObject bool
}
Diff allows reporting of a detected difference
func (*Diff) AddProtoField ¶ added in v1.150.0
func (d *Diff) AddProtoField(id string, fd protoreflect.FieldDescriptor, old any, new any)
AddProtoField adds the data for a changed field where we know the proto field descriptor.
type DiffField ¶
type DiffField struct {
// ID is the identity of the field. Note that this might be the proto or terraform name.
ID string
// ProtoFieldDescriptor is the proto fieldDescriptor of the field, if known.
ProtoFieldDescriptor protoreflect.FieldDescriptor
Old any
New any
}
type Listener ¶
type Listener interface {
// OnError is called when a controller calls ReportError
OnError(ctx context.Context, err error, args ...any)
// OnDiff is called when a controller calls ReportDiffs
OnDiff(ctx context.Context, diffs *Diff)
// OnReconcileStart is called when a controller calls ReportReconcileStart
OnReconcileStart(ctx context.Context, u *unstructured.Unstructured, t k8s.ReconcilerType)
// OnReconcileEnd is called when a controller calls ReportReconcileEnd
OnReconcileEnd(ctx context.Context, u *unstructured.Unstructured, result reconcile.Result, err error, t k8s.ReconcilerType)
}
Listener is implemented by listeners to the "structured reporting" event stream. Note: these methods are called from performance-sensitive code. If you are doing substantial processing (in production paths), consider copying the arguments and sending them to another goroutine for any heavy lifting.
type LogFieldUpdates ¶ added in v1.141.0
type LogFieldUpdates struct {
}
LogFieldUpdates is a Listener that logs updated fields during reconciliation, only when objects are being updated.
func (*LogFieldUpdates) OnDiff ¶ added in v1.141.0
func (l *LogFieldUpdates) OnDiff(ctx context.Context, diffs *Diff)
OnDiff is called when a controller calls ReportDiffs
func (*LogFieldUpdates) OnError ¶ added in v1.141.0
func (l *LogFieldUpdates) OnError(ctx context.Context, err error, args ...any)
OnError is called when a controller calls ReportError
func (*LogFieldUpdates) OnReconcileEnd ¶ added in v1.141.0
func (l *LogFieldUpdates) OnReconcileEnd(ctx context.Context, u *unstructured.Unstructured, result reconcile.Result, err error, t k8s.ReconcilerType)
OnReconcileEnd is called when a controller calls ReportReconcileEnd
func (*LogFieldUpdates) OnReconcileStart ¶ added in v1.141.0
func (l *LogFieldUpdates) OnReconcileStart(ctx context.Context, u *unstructured.Unstructured, t k8s.ReconcilerType)
OnReconcileStart is called when a controller calls ReportReconcileStart