@@ -777,7 +777,8 @@ func (s *sqlLoader) addBundleProperties(tx *sql.Tx, bundle *registry.Bundle) err
777
777
}
778
778
779
779
for _ , prop := range bundle .Properties {
780
- if err := s .addProperty (tx , prop .Type , prop .Value , bundle .Name , bundleVersion , bundle .BundleImage ); err != nil {
780
+ value , _ := json .Marshal (prop .Value )
781
+ if err := s .addProperty (tx , prop .Type , string (value ), bundle .Name , bundleVersion , bundle .BundleImage ); err != nil {
781
782
return err
782
783
}
783
784
}
@@ -805,17 +806,27 @@ func (s *sqlLoader) addBundleProperties(tx *sql.Tx, bundle *registry.Bundle) err
805
806
806
807
// Add label properties
807
808
if csv , err := bundle .ClusterServiceVersion (); err == nil {
808
- for k , v := range csv .GetLabels () {
809
- if strings .HasPrefix (k , registry .LabelType ) {
810
- prop := registry.LabelProperty {
811
- Label : v ,
812
- }
813
- value , err := json .Marshal (prop )
814
- if err != nil {
815
- continue
816
- }
817
- if err := s .addProperty (tx , registry .LabelType , string (value ), bundle .Name , bundleVersion , bundle .BundleImage ); err != nil {
818
- continue
809
+ annotations := csv .ObjectMeta .GetAnnotations ()
810
+ if v , ok := annotations [registry .PropertyKey ]; ok {
811
+ var props []registry.Property
812
+ if err := json .Unmarshal ([]byte (v ), & props ); err == nil {
813
+ for _ , prop := range props {
814
+ // Only add label type from the list
815
+ // TODO: Support more types such as GVK and package
816
+ if prop .Type == registry .LabelType {
817
+ var label registry.LabelProperty
818
+ err := json .Unmarshal (prop .Value , & label )
819
+ if err != nil {
820
+ continue
821
+ }
822
+ value , err := json .Marshal (label )
823
+ if err != nil {
824
+ continue
825
+ }
826
+ if err := s .addProperty (tx , registry .LabelType , string (value ), bundle .Name , bundleVersion , bundle .BundleImage ); err != nil {
827
+ continue
828
+ }
829
+ }
819
830
}
820
831
}
821
832
}
0 commit comments