@@ -43,6 +43,23 @@ func ClusterPathFrom(ctx context.Context) (logicalcluster.Path, bool) {
4343 return path , true
4444}
4545
46+ func contentConfigurationWithResult (cc * unstructured.UnstructuredList ) []unstructured.Unstructured {
47+
48+ // TODO: this works with unstructed and breaks on api changes, maybe we parse into typed structs instead
49+ var results []unstructured.Unstructured
50+ for _ , cc := range cc .Items {
51+ _ , hasField , err := unstructured .NestedFieldNoCopy (cc .Object , "status" , "configurationResult" )
52+ if err != nil || ! hasField {
53+ klog .V (8 ).Info (err , "failed to get configurationResult from contentconfiguration" , "cc" , cc .GetName ())
54+ continue
55+ }
56+
57+ results = append (results , cc )
58+ }
59+
60+ return results
61+ }
62+
4663func ContentConfigurationLookup (client dynamic.ClusterInterface , cfg config.ServiceConfig , providerWorkspaceID string ) forwardingregistry.StorageWrapper {
4764
4865 return forwardingregistry .StorageWrapperFunc (func (resource schema.GroupResource , storage * forwardingregistry.StoreFuncs ) {
@@ -56,6 +73,7 @@ func ContentConfigurationLookup(client dynamic.ClusterInterface, cfg config.Serv
5673 }
5774
5875 ul , _ := result .(* unstructured.UnstructuredList )
76+ ul .Items = contentConfigurationWithResult (ul )
5977
6078 path , ok := ClusterPathFrom (ctx )
6179 if ! ok {
@@ -120,7 +138,7 @@ func ContentConfigurationLookup(client dynamic.ClusterInterface, cfg config.Serv
120138 return err
121139 }
122140
123- ul .Items = append (ul .Items , apiExportCCs .(* unstructured.UnstructuredList ). Items ... )
141+ ul .Items = append (ul .Items , contentConfigurationWithResult ( apiExportCCs .(* unstructured.UnstructuredList )) ... )
124142
125143 return nil
126144 })
@@ -143,7 +161,7 @@ func ContentConfigurationLookup(client dynamic.ClusterInterface, cfg config.Serv
143161 return nil , err
144162 }
145163
146- ul .Items = append (ul .Items , providerCCs .(* unstructured.UnstructuredList ). Items ... )
164+ ul .Items = append (ul .Items , contentConfigurationWithResult ( providerCCs .(* unstructured.UnstructuredList )) ... )
147165
148166 return ul , nil
149167 }
0 commit comments