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 option to disable Gossip Router #1667

Merged
merged 5 commits into from
Sep 1, 2022

Conversation

pruivo
Copy link
Member

@pruivo pruivo commented Aug 10, 2022

Closes #1665

Documentation missing.

Type DiscoverySiteType `json:"type,omitempty"`
// Enables (default) or disables the Gossip Router pod and cross-site services
// +optional
LaunchGossipRouter *bool `json:"launchGossipRouter,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

As DiscoverySiteSpec is a new struct, I think we can remove the pointer here.

The infinispan defaulting webhook, api/v1/infinispan_webhook, can add the DiscoverySiteSpec when spec.sites.local.discovery is nil for new CRs so that the default value of LaunchGossipRouter is true.

If upgrading from an old operator version, then spec.sites.local.discovery will remain nil and we can test for this in CrossSiteDiscoveryType and LaunchGossipRouterEnabled as you currently have.

Copy link
Member Author

@pruivo pruivo Aug 11, 2022

Choose a reason for hiding this comment

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

what would happen if a user puts an empty element in the yaml? Like

spec:
  service:
    type: DataGrid
    sites:
      local:
        name: lon
        discovery:
        locations:
           -name: nyc

edit: assuming this is a valid yaml format
edit2: is this considered a nil structure?

Copy link
Member Author

Choose a reason for hiding this comment

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

kept the *bool but added the default in the webhook (and removed the nil checks)

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the valid format would be to have discovery: {} or discovery: ~, but either way it's redundant as we have omitempty defined on the field, so any of these will result in discovery being nil in the struct.

kept the *bool but added the default in the webhook (and removed the nil checks)

I don't think this is necessary due to ^.

// +kubebuilder:validation:Enum=gossiprouter
type DiscoverySiteType string

// GossipRouterType is the only one supported but we may add other like submariner and/or skupper
Copy link
Contributor

Choose a reason for hiding this comment

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

Good thinking 👍


[role="_abstract"]
Only a single Gossip Router is required to route the cross-site traffic however, the {brandname} operator starts a Gossip Route on each site.
You can disable the Gossip Router in one of the sites to save resources.
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the best practice if 3 sites are configured?

If you have a GossipRouter enabled on site 1, but not 2 & 3, does that mean that xsite will fail if Site 1 becomes unavailable?

Copy link
Member Author

Choose a reason for hiding this comment

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

the best practice for 2 or more sites is to let the operator start the Gossip Router on all sites.

This is a customer request that does not want to have a Gossip Router on one of the sites (2 sites total).

In your scenario, the connection will be broken and cross-site becomes available.

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add a note explaining this to the docs, maybe as a NOTE section?

Copy link
Member Author

Choose a reason for hiding this comment

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

+1, I'll leave this for the @infinispan/docs team :)

Copy link
Member

Choose a reason for hiding this comment

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

Cool. I'm looking into it and I'll be back on Monday

@ryanemerson
Copy link
Contributor

@dvagnero @dfitzmau Can you review the doc contributions when you get a chance? Thanks

@dfitzmau
Copy link
Contributor

@dvagnero @dfitzmau Can you review the doc contributions when you get a chance? Thanks

Hi @ryanemerson . Dominika beat me too it.

Just to let you know we created a members group for docs, so you can tag us both with @infinispan/docs

if err != nil {
fmt.Println(err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Adding a comment so we don't forget to remove these before merging.

Copy link
Member Author

Choose a reason for hiding this comment

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

already gone!

}
if i.Spec.Service.Sites.Local.Discovery.LaunchGossipRouter == nil {
i.Spec.Service.Sites.Local.Discovery.LaunchGossipRouter = new(bool)
*i.Spec.Service.Sites.Local.Discovery.LaunchGossipRouter = true
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI you can do this as a one-liner with i.Spec.Service.Sites.Local.Discovery.LaunchGossipRouter = pointer.BoolPtr(true)

@pruivo pruivo force-pushed the t_1665_gr_disable branch 2 times, most recently from 024b761 to 733f955 Compare August 11, 2022 15:39
@domiborges
Copy link
Member

Hey, I added a commit with some docs suggestions. Please let me know what you think


.Prerequisites

* Have multiple working Gossip routers.
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't multiple Gossip Routers is a prerequisite. Rather, it's necessary for a Gossip Router to be enabled on at least one site.


* Have multiple working Gossip routers.
+
You can have an external Gossip router that is not managed by the {ispn_operator}.
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't correct. The Gossip Router will be managed by the Operator, however it will only be enabled on one of the sites, therefore it's only managed by the Operator on the enabled site.

. For the *LON* cluster, set `false` as the value for the `spec.service.sites.local.discovery.launchGossipRouter`.
. For the *LON* cluster, specify the `url` with the `spec.service.sites.locations.url` to connect to the *NYC*.
+
In the *NYC* configuration, do not specify `spec.service.sites.locations.url`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be part of the procedure steps?

@pruivo
Copy link
Member Author

pruivo commented Aug 29, 2022

just rebased on top of main branch.
The docs look good to me. Thanks @dvagnero !
@ryanemerson is there anything that I miss?

@ryanemerson
Copy link
Contributor

@pruivo LGTM. Can you rebase on latest main to fix the webhook tests

@ryanemerson ryanemerson merged commit 3360f34 into infinispan:main Sep 1, 2022
@ryanemerson
Copy link
Contributor

Thanks @pruivo @dvagnero

@pruivo pruivo deleted the t_1665_gr_disable branch September 1, 2022 16:03
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.

Add option to disable Gossip Router
4 participants