|
9 | 9 | "sigs.k8s.io/controller-runtime/pkg/reconcile" |
10 | 10 |
|
11 | 11 | "github.com/operator-framework/operator-registry/alpha/declcfg" |
12 | | - "github.com/operator-framework/operator-registry/alpha/property" |
13 | 12 |
|
14 | 13 | ocv1 "github.com/operator-framework/operator-controller/api/v1" |
15 | 14 | "github.com/operator-framework/operator-controller/internal/operator-controller/bundleutil" |
@@ -65,41 +64,8 @@ func bundleFromFS(bundleFS fs.FS, image string) (*declcfg.Bundle, error) { |
65 | 64 | Image: image, |
66 | 65 | } |
67 | 66 | propertiesJSON := registryBundle.CSV.Annotations[bundlesource.PropertyOLMProperties] |
68 | | - if propertiesJSON == "" { |
69 | | - return nil, fmt.Errorf("bundle %q has no %q package property", bundle.Name, bundlesource.PropertyOLMProperties) |
70 | | - } |
71 | 67 | if err := json.Unmarshal([]byte(propertiesJSON), &bundle.Properties); err != nil { |
72 | 68 | return nil, fmt.Errorf("failed to parse bundle properties: %w", err) |
73 | 69 | } |
74 | | - if err := validatePackageProperty(bundle.Properties, registryBundle.PackageName); err != nil { |
75 | | - return nil, err |
76 | | - } |
77 | 70 | return bundle, nil |
78 | 71 | } |
79 | | - |
80 | | -func validatePackageProperty(properties []property.Property, expectedPackageName string) error { |
81 | | - var packageProperties []property.Property |
82 | | - for _, p := range properties { |
83 | | - if p.Type == property.TypePackage { |
84 | | - packageProperties = append(packageProperties, p) |
85 | | - } |
86 | | - } |
87 | | - if len(packageProperties) != 1 { |
88 | | - return fmt.Errorf("expected exactly one %q package property, found %d", property.TypePackage, len(packageProperties)) |
89 | | - } |
90 | | - |
91 | | - var packageData struct { |
92 | | - PackageName string `json:"packageName"` |
93 | | - Version string `json:"version"` |
94 | | - } |
95 | | - if err := json.Unmarshal(packageProperties[0].Value, &packageData); err != nil { |
96 | | - return fmt.Errorf("failed to parse %q package property: %w", property.TypePackage, err) |
97 | | - } |
98 | | - if packageData.PackageName == "" || packageData.PackageName != expectedPackageName { |
99 | | - return fmt.Errorf("package property name %q does not match bundle package name %q", packageData.PackageName, expectedPackageName) |
100 | | - } |
101 | | - if packageData.Version == "" { |
102 | | - return fmt.Errorf("package property for %q has no version", expectedPackageName) |
103 | | - } |
104 | | - return nil |
105 | | -} |
0 commit comments