kcp-dev / contrib-tmc

An experimental add-on readding some Kubernetes compute APIs and impement transparent multi-cluster scheduling
Apache License 2.0
5 stars 3 forks source link

bug: Report detailed compatibility errors on incompatible `SyncTarget.Status.ResourcesToSync` #33

Open davidfestal opened 1 year ago

davidfestal commented 1 year ago

Describe the bug

When a resource to sync on a SyncTarget is incompatible, there are not details about the compatibility errors between the KCP schema and the SyncTarget schema. That makes it quite hard to understand what happens.

Steps To Reproduce

  1. Create a SyncTarget that binds to the root:compute:kubernetes APIExport
  2. Install this SyncTarget in a Kubernetes physical cluster with an old release (1.21 for example)
  3. See that some of the resources in the SyncTarget.Status.ResourcesToSync list have the Incompatible state, but don't provide any more detail.

Expected Behaviour

We should have a compatibility detailed error message. This should be possible, since the internal code used to do the compatibility check returns a list of errors (missing field, incompatible types, etc...)

Additional Context

Here is the code where the at least the err.Error() of the error coming from the schemacompat.EnsureStructuralSchemaCompatibility() call should be added in a detailed message on the ResourceToSync:

https://github.com/kcp-dev/kcp/blob/60ba17a1780879d4418ab8d1e90abc6ece65cbba/pkg/reconciler/workload/synctargetexports/synctargetcompatible_reconcile.go#L122-L128

rahulii commented 1 year ago

/assign

rahulii commented 1 year ago

hey @davidfestal ,should I add a new field into ResourceToSync type that would indicate errors in case any..?

davidfestal commented 1 year ago

I think we could do that. Something similar to the Message in status conditions:

    // A human readable message indicating details about the compatibility errors 
    // This field may be empty.
    // +optional
    Message string `json:"message,omitempty"`
davidfestal commented 1 year ago

@sttts wdyt about https://github.com/kcp-dev/contrib-tmc/issues/33 ?

mjudeikis commented 1 year ago

/transfer-issue contrib-tmc

mjudeikis commented 1 year ago

/transfer-issue contrib-tmc