Skip to content
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

Add search index to generated configmap #205

Merged
merged 6 commits into from
Oct 25, 2024

Conversation

Hyperkid123
Copy link
Contributor

@Hyperkid123 Hyperkid123 commented Oct 22, 2024

https://issues.redhat.com/browse/RHCLOUD-35426

Changes

  • adds search index to generated frontend config map
  • adds services info to generated frontend config map
    • need to figure out how the template will be fed to FEO or if it even should be
  • adds widget info to the generated frontend config map
  • make the API spec optional for frontends (not all frontends have associated backend services)

@Hyperkid123 Hyperkid123 force-pushed the new-data-reconciliation branch from d639480 to 18567fc Compare October 22, 2024 09:35
@Hyperkid123 Hyperkid123 requested a review from a team October 22, 2024 09:35
@Hyperkid123 Hyperkid123 force-pushed the new-data-reconciliation branch from 18567fc to 69441f7 Compare October 22, 2024 09:53
@Hyperkid123 Hyperkid123 force-pushed the new-data-reconciliation branch from 69441f7 to 43f5a52 Compare October 22, 2024 09:58
@Hyperkid123 Hyperkid123 force-pushed the new-data-reconciliation branch from 2ab74e1 to 5af6346 Compare October 22, 2024 14:59
@Hyperkid123 Hyperkid123 force-pushed the new-data-reconciliation branch from 5af6346 to 4902a56 Compare October 22, 2024 15:51
@Hyperkid123 Hyperkid123 requested review from psav and adamrdrew October 22, 2024 15:55
@Hyperkid123 Hyperkid123 marked this pull request as ready for review October 22, 2024 15:55
kuttl-config.yml Outdated Show resolved Hide resolved
controllers/reconcile.go Outdated Show resolved Hide resolved
Copy link
Contributor

@florkbr florkbr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall I think this looks good - just one or 2 small comments.

@Hyperkid123 Hyperkid123 force-pushed the new-data-reconciliation branch from 4902a56 to 3636b39 Compare October 23, 2024 07:35
Copy link
Collaborator

@adamrdrew adamrdrew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm OK merging it as is, but I offered a few nitpicks

Title: searchEntry.Title,
Description: searchEntry.Description,
Href: searchEntry.Href,
AltTitle: searchEntry.AltTitle,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AltTitle is a string slice, so its a reference. So you may want to do a proper deep copy here like

	// Create a deep copy of AltTitle slice
	altTitleCopy := make([]string, len(searchEntry.AltTitle))
	copy(altTitleCopy, searchEntry.AltTitle)


func setupSearchIndex(feList *crd.FrontendList) []crd.SearchEntry {
searchIndex := []crd.SearchEntry{}
for _, frontend := range feList.Items {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Over the course of this change you switch between felist and feList - probably better to just go with one.

*groupTiles = append(*groupTiles, *tile)
} else {
// ignore the tile if destination does not exist
skippedTiles = append(skippedTiles, tile.ID)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this be something you want to log?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we do want to know in case we have some reports of missing elements.

group := crd.FrontendServiceCategoryGroupGenerated{
ID: gr.ID,
Title: gr.Title,
Tiles: &tiles,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can remove the pointer here because slices are already reference types. You might be able to do just Titles: titles but I'm not 100% sure. Might be fun to find out!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I already figured it out. And I can't I need the reference later and without the pointer the slice was not updated and the output was always an empty array.

@@ -853,6 +853,97 @@ func setupFedModules(feEnv *crd.FrontendEnvironment, frontendList *crd.FrontendL
return nil
}

func adjustSearchEntry(searchEntry *crd.SearchEntry, frontend crd.Frontend) crd.SearchEntry {
newSearchEntry := crd.SearchEntry{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to guard on a nil check on searchEntry? I know you are only calling this in a loop that is already guarded on a nil check, but if this ever ended up getting called somewhere else someday could result in a panic.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll do the check in the iteration, the value must exist.

@Hyperkid123
Copy link
Contributor Author

@adamrdrew I'll address them 🙂

@Hyperkid123 Hyperkid123 merged commit 5909e69 into RedHatInsights:main Oct 25, 2024
10 of 11 checks passed
@Hyperkid123 Hyperkid123 deleted the new-data-reconciliation branch October 25, 2024 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants