-
Notifications
You must be signed in to change notification settings - Fork 542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UICatalogEntry pruning ALM-438 #269
UICatalogEntry pruning ALM-438 #269
Conversation
I have a work-in-progress branch for Console that eliminates the need for |
@alecmerdler awesome, let's keep this around just in case, and we'll close it when/if the console branch is merged |
This has some catalog fixes that we'll need to include even if we're not using uicatalogentries |
28ddc65
to
ea2ee88
Compare
@@ -40,7 +41,7 @@ var installPlanFailedChecker = func(fip *installplanv1alpha1.InstallPlan) bool { | |||
return fip.Status.Phase == installplanv1alpha1.InstallPlanPhaseFailed | |||
} | |||
|
|||
func FetchUICatalogEntries(t *testing.T, c opClient.Interface, count int) (*opClient.CustomResourceList, error) { | |||
func fetchUICatalogEntries(t *testing.T, c opClient.Interface, count int) (*opClient.CustomResourceList, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
e2e/alm_e2e_test.go
Outdated
c := newKubeClient(t) | ||
|
||
// Load old configmap (contains packages A and B) | ||
oldFile, err := os.Open("e2e/data/catalog.old.yaml") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we make this an absolute path, or explicitly relative?
_, err = fetchUICatalogEntry(t, c, "package-c") | ||
require.NoError(t, err) | ||
|
||
// B should've been updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: it's hard to tell where set up ends and tests begin. Maybe comments delineating?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added comments
pkg/client/uicatalogentry_client.go
Outdated
@@ -17,6 +18,8 @@ import ( | |||
|
|||
type UICatalogEntryInterface interface { | |||
UpdateEntry(csv *v1alpha1.UICatalogEntry) (*v1alpha1.UICatalogEntry, error) | |||
ListEntries(namespace string) (*v1alpha1.UICatalogEntryList, error) | |||
Delete(name, namespace string, options *metav1.DeleteOptions) error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most places have the order namespace, name
. Can we keep it consistent by changing the order here?
// Sync creates UICatalogEntry CRDs for each package in the catalog. Fails immediately on error. | ||
func (store *CustomResourceCatalogStore) Sync(catalog Source) ([]*v1alpha1.UICatalogEntry, error) { | ||
// Sync creates UICatalogEntry CRDs for each package in the catalog and removes old ones. Fails immediately on error. | ||
func (store *CustomResourceCatalogStore) Sync(catalog Source, source *catalogv1alpha1.CatalogSource) ([]*v1alpha1.UICatalogEntry, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about passing in owners []metav1.OwnerReference
instead of source
to keep it more generic and clean? It'd remove the need to import catalogv1alpha1
as well.
existingMap[existing.Name] = existing | ||
} | ||
|
||
// prune things not controlled by any source |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we? seems like unexpected behavior if you manually create one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when we upgrade from tectonic helium, all existing uicatalogentries won't have any owners, so this will clean them up and replace with owned versions.
pkg/registry/uicatalogentries.go
Outdated
} | ||
} | ||
for _, new := range newEntries { | ||
newMap[new.Name] = new |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: since new
is a keyword (as is new(map[string]string)
), even though it's not showing an error, can it be renamed to something else?
ea2ee88
to
3ea6779
Compare
3ea6779
to
ea969e9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…anup UICatalogEntry pruning ALM-438
…anup UICatalogEntry pruning ALM-438
This adds pruning logic for UICatalogEntries