diff --git a/pkg/cli/events.go b/pkg/cli/events.go index 71c18d162..a086935b9 100644 --- a/pkg/cli/events.go +++ b/pkg/cli/events.go @@ -46,12 +46,6 @@ func NewEvent(c CommandContext) *cobra.Command { # Get a single event by name acorn events 4b2ba097badf2031c4718609b9179fb5 - - # Getting Details - # The 'details' field provides additional information about an event. - # By default, this field is elided from this command's output, but can be enabled via the '--details' flag. - # This flag must be used in conjunction with a non-table output format, like '-o=yaml'. - acorn events --details -o yaml `}) return cmd } @@ -71,9 +65,8 @@ func (e *Events) Run(cmd *cobra.Command, args []string) error { } opts := &client.EventStreamOptions{ - Tail: e.Tail, - Follow: e.Follow, - Details: e.Details, + Tail: e.Tail, + Follow: e.Follow, } if len(args) > 0 { diff --git a/pkg/client/client.go b/pkg/client/client.go index 85da3964b..2c265d184 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -328,7 +328,6 @@ type ContainerReplicaListOptions struct { type EventStreamOptions struct { Tail int `json:"tail,omitempty"` Follow bool `json:"follow,omitempty"` - Details bool `json:"details,omitempty"` Prefix string `json:"prefix,omitempty"` ResourceVersion string `json:"resourceVersion,omitempty"` } @@ -338,9 +337,9 @@ func (o EventStreamOptions) ListOptions() *kclient.ListOptions { if o.Prefix != "" { fieldSet["prefix"] = o.Prefix } - if o.Details { - fieldSet["details"] = strconv.FormatBool(o.Details) - } + + // Set details selector to get details from older runtime APIs that don't return details by default. + fieldSet["details"] = strconv.FormatBool(true) return &kclient.ListOptions{ Limit: int64(o.Tail), diff --git a/pkg/server/registry/apigroups/acorn/events/strategy.go b/pkg/server/registry/apigroups/acorn/events/strategy.go index 422198756..d448b50c8 100644 --- a/pkg/server/registry/apigroups/acorn/events/strategy.go +++ b/pkg/server/registry/apigroups/acorn/events/strategy.go @@ -4,7 +4,6 @@ import ( "context" "fmt" "sort" - "strconv" "strings" "github.com/acorn-io/mink/pkg/strategy" @@ -62,10 +61,6 @@ func (s *eventStrategy) List(ctx context.Context, namespace string, opts storage } type query struct { - // details determines if the details field is elided from query results. - // If true keep details, otherwise strip them. - details bool - // tail when > 0, determines the number of latest events to return. tail int64 @@ -137,8 +132,8 @@ func (q query) filter(events ...apiv1.Event) []apiv1.Event { tail = int(q.tail) } - if q.details && q.prefix.all() { - // Query selects all remaining events and includes details + if q.prefix.all() { + // Query selects all remaining events return events[len(events)-tail:] } @@ -149,10 +144,6 @@ func (q query) filter(events ...apiv1.Event) []apiv1.Event { continue } - if !q.details { - event.Details = nil - } - results = append(results, event) } @@ -171,7 +162,9 @@ func stripQuery(opts storage.ListOptions) (q query, stripped storage.ListOptions var err error switch f { case "details": - q.details, err = strconv.ParseBool(v) + // Detail elision is deprecated, so clients should always get details. + // We still strip it from the selector here in order to maintain limited backwards compatibility with old + // clients that still specify it. case "prefix": q.prefix = prefix(v) default: