Skip to content

Commit

Permalink
customresourcestate: don't error on missing status stateSet
Browse files Browse the repository at this point in the history
It's legitimate for new objects to not have status fields. Especially if
controller is unavailable. Such errors are printed for every resource
and can mask actual problems. Instead, log in verbose mode to allow
troubleshooting.

Fixes kubernetes#2482
  • Loading branch information
rsienko committed Aug 23, 2024
1 parent f7304dc commit 53f733a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/customresourcestate/registry_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,10 +397,16 @@ func (c *compiledStateSet) Values(v interface{}) (result []eachValue, errs []err
return c.values(v)
}

const statusPart = "status"

func (c *compiledStateSet) values(v interface{}) (result []eachValue, errs []error) {
comparable := c.ValueFrom.Get(v)
value, ok := comparable.(string)
if !ok {
if len(c.path) > 0 && c.path[0].part == statusPart {
klog.V(2).InfoS("Skipping unavailable resource status", "path", c.path)
return []eachValue{}, []error{}
}
return []eachValue{}, []error{fmt.Errorf("%s: expected value for path to be string, got %T", c.path, comparable)}
}

Expand Down

0 comments on commit 53f733a

Please sign in to comment.