-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove Entities and EntitySources (#413)
* Updates codebase to use `catalogmetadata` package Signed-off-by: Mikalai Radchuk <[email protected]> Signed-off-by: Daniel Franz<[email protected]> * Updates resolutioncli to remove entity source Signed-off-by: Mikalai Radchuk <[email protected]> * Removes entity sources and GVK related code * Removes provides+required GVK and associated tests. GVK related code was a dead weight since were never set GVK properties on bundle entity. * Remove entity + entitysource and associated util pkgs Signed-off-by: dtfranz <[email protected]> * Deppy version bump, remove remaining entity/entitysource vestigials Signed-off-by: dtfranz <[email protected]> * Add interface for client mocking Signed-off-by: dtfranz <[email protected]> * Fix tests, bump catalogd, address comments. Signed-off-by: dtfranz <[email protected]> --------- Signed-off-by: Mikalai Radchuk <[email protected]> Signed-off-by: Daniel Franz<[email protected]> Signed-off-by: dtfranz <[email protected]> Co-authored-by: Mikalai Radchuk <[email protected]>
- Loading branch information
Showing
40 changed files
with
1,341 additions
and
2,409 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
Copyright 2023. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package main | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/operator-framework/operator-registry/alpha/action" | ||
|
||
"github.com/operator-framework/operator-controller/internal/catalogmetadata" | ||
"github.com/operator-framework/operator-controller/internal/catalogmetadata/client" | ||
) | ||
|
||
type indexRefClient struct { | ||
renderer action.Render | ||
bundlesCache []*catalogmetadata.Bundle | ||
} | ||
|
||
func newIndexRefClient(indexRef string) *indexRefClient { | ||
return &indexRefClient{ | ||
renderer: action.Render{ | ||
Refs: []string{indexRef}, | ||
AllowedRefMask: action.RefDCImage | action.RefDCDir, | ||
}, | ||
} | ||
} | ||
|
||
func (c *indexRefClient) Bundles(ctx context.Context) ([]*catalogmetadata.Bundle, error) { | ||
if c.bundlesCache == nil { | ||
cfg, err := c.renderer.Run(ctx) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
var ( | ||
channels []*catalogmetadata.Channel | ||
bundles []*catalogmetadata.Bundle | ||
) | ||
|
||
for i := range cfg.Channels { | ||
channels = append(channels, &catalogmetadata.Channel{ | ||
Channel: cfg.Channels[i], | ||
}) | ||
} | ||
|
||
for i := range cfg.Bundles { | ||
bundles = append(bundles, &catalogmetadata.Bundle{ | ||
Bundle: cfg.Bundles[i], | ||
}) | ||
} | ||
|
||
// TODO: update fake catalog name string to be catalog name once we support multiple catalogs in CLI | ||
catalogName := "offline-catalog" | ||
|
||
bundles, err = client.PopulateExtraFields(catalogName, channels, bundles) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
c.bundlesCache = bundles | ||
} | ||
|
||
return c.bundlesCache, nil | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.