-
Notifications
You must be signed in to change notification settings - Fork 2.1k
discovery: remove update if discovery group differs #36472
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -195,6 +195,12 @@ kubernetes matchers are present.`) | |
| } | ||
|
|
||
| c.Log = c.Log.WithField(trace.Component, teleport.ComponentDiscovery) | ||
|
|
||
| if c.DiscoveryGroup == "" { | ||
| c.Log.Warn("discovery_service.discovery_group is not set. This field is required for the discovery service to work properly.\n" + | ||
| "Please set discovery_service.discovery_group according to the documentation: https://goteleport.com/docs/reference/config/#discovery-service") | ||
| } | ||
|
|
||
| c.Matchers.Azure = services.SimplifyAzureMatchers(c.Matchers.Azure) | ||
| return nil | ||
| } | ||
|
|
@@ -1466,3 +1472,15 @@ func splitMatchers[T types.Matcher](matchers []T, matcherTypeCheck func(string) | |
| } | ||
| return | ||
| } | ||
|
|
||
| func (s *Server) updatesEmptyDiscoveryGroup(getter func() (types.ResourceWithLabels, error)) bool { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this function appropriately named? I don't see anything that gets updated, but I may be misunderstanding what this code does. Maybe
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this function checks if we are updating a resource with an empty discovery group. It requires going to the DB and pulling the resource version there because if it's empty we allow the update. I tried to avoid |
||
| if s.DiscoveryGroup == "" { | ||
| return false | ||
| } | ||
| old, err := getter() | ||
| if err != nil { | ||
| return false | ||
| } | ||
| oldDiscoveryGroup, _ := old.GetLabel(types.TeleportInternalDiscoveryGroupName) | ||
| return oldDiscoveryGroup == "" | ||
| } | ||
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.
Is this a customer-facing API? If so, does the next release need to bump the minor version instead of just patch?
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.
No. This is just an interface extension. the underlying stuff already implements that API