Conversation
05aa0ef to
2943ae0
Compare
Merging this branch changes the coverage (1 decrease, 1 increase)
Coverage by fileChanged files (no unit tests)
Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code. Changed unit test files
|
2943ae0 to
b8d9fdc
Compare
When a gRPC call returns a status code that indicates a permanent failure (e.g. InvalidArgument, NotFound, PermissionDenied, Unauthenticated), retrying the request will not resolve the issue. Without marking these errors as terminal, the controller-runtime reconciler keeps requeuing the reconciliation indefinitely, wasting resources. Introduce a TerminalErrorInterceptor that wraps errors with non-retryable gRPC status codes as reconcile.TerminalError so the reconciler stops retrying immediately. Also fix error wrapping in GetDeviceByName which previously dropped the underlying error, and add documentation to GetDeviceBySerial.
As we plan to use our `gnmiext` package also for other provider implementations of other hardware vendors than Cisco, we now move it outside of the cisco provider package scope. With this change we are introducing a new `transport` package which will house multiple packages related to transport/protocol specific utilities and clients.
Extracts `NewClient`, `Option`, `WithDefaultTimeout`, the interceptors, and the `auth` type from `internal/deviceutil` into a dedicated `internal/transport/grpcext` package, mirroring the existing `internal/transport/gnmiext` sibling. `deviceutil` now only contains device CRD helpers and the `Connection` type.
The Configurable interface is used for both configuration and state data, making the old name misleading. Rename it to DataElement, the term used by the gNMI specification for any item addressable by a path — regardless of whether it represents a leaf, container, or entire subtree. Update variable names in the nxos provider package to reflect the intent of each call site: `updates` for Update, `deletes` for Delete, `patches` for Patch, and `el` for generic slices, replacing the ambiguous `conf` that implied configuration-only usage.
b8d9fdc to
c50156d
Compare
Merging this branch will increase overall coverage
Coverage by fileChanged files (no unit tests)
Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code. Changed unit test files
|
internal/deviceutil/deviceutil.go
Outdated
| var terminalCodes = []codes.Code{ | ||
| codes.Unknown, | ||
| codes.InvalidArgument, | ||
| codes.NotFound, |
There was a problem hiding this comment.
I'm not so sure about this one. It am thinking of a Get that fails with this error code -not sure if this is even the case- and for which the relevant data is later added by the action of a different controller. Selectively picking the doc it states: "[...]", such as gradual feature rollout [...]". So data may appear later and thus maybe this shouldn't be a TerminalError.
I acknowledge we don't have the necessary operational experience to make a sound decision at the moment. This seems however a nice concept we could use.
| return nil | ||
| } | ||
| if string(b) != "[null]" { | ||
| if !nullRe.MatchString(string(b)) { |
There was a problem hiding this comment.
We could think of only checking this only if we find an IOS-XR in client.capabilities.capabilities. That said, this is likely too much for now as we are unlikely to find this being used as valid value in different platform. On the other hand, as we increase the number of platforms supported we may have more of these particularities coming in. Anyhow, I would leave this at it is unless you think otherwise.
| name string | ||
| conn grpc.ClientConnInterface | ||
| conf []Configurable | ||
| conf []DataElement |
There was a problem hiding this comment.
may be we can rename conf to configs to be in line with the terminology above. If we want it generic then d, de, or data might be other options.
| }, | ||
| }, | ||
| conf: []Configurable{new(Hostname)}, | ||
| conf: []DataElement{new(Hostname)}, |
There was a problem hiding this comment.
If we are not generic then we could rename this to updates
As we plan to use our
gnmiextpackage also for other providerimplementations of other hardware vendors than Cisco, we now move it
outside of the cisco provider package scope.
With this change we are introducing a new
transportpackage which willhouse multiple packages related to transport/protocol specific utilities
and clients.
Additionally a new
transport/grpcextpackage is added which refactorsout all the grpc related code from the
deviceutilpackage and add anadditional interceptor for handling non-retryable grpc error codes.