-
Notifications
You must be signed in to change notification settings - Fork 181
Support v1alpha1.ScyllaDBDatacenter registration with global ScyllaDB Manager instance #2590
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
base: master
Are you sure you want to change the base?
Conversation
@rzetelskik: GitHub didn't allow me to request PR reviews from the following users: rzetelskik. Note that only scylladb members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rzetelskik The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
c069b48
to
badb7c7
Compare
/cc zimnx mflendrich |
badb7c7
to
557bb7c
Compare
@zimnx one thing I'm unsure about and so I'd like to hear your opinion. This PR introduces verification utils for
|
557bb7c
to
d485a02
Compare
#2096 (comment) |
timed out |
Verify is executed post rollout. It should validate whether main and dependant objects and status are in expected state. |
d485a02
to
77c829a
Compare
|
77c829a
to
206fad0
Compare
|
pkg/api/scylla/validation/scylladbmanagerclusterregistration_validation.go
Outdated
Show resolved
Hide resolved
3213446
to
9432c1f
Compare
c637f08
to
b0fd082
Compare
…propagation to underlying resources
…DB Manager instance: registration and deregistration
b0fd082
to
64def13
Compare
@rzetelskik: The following test failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
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.
first batch
type LocalScyllaDBReference struct { | ||
// kind specifies the type of the resource. | ||
Kind string `json:"kind"` | ||
// name specifies the name of the resource. |
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.
would be worth mentioning that the name references object in the same namespace.
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.
I thought the Local
in the struct name is a conventional way of saying this (by similarity to LocalObjectReference
) - I could add a comment to the entire struct though, if it's not clear enough?
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.
struct name isn't visible in kubectl explain
, while comments are.
@@ -82,6 +82,10 @@ func (o *Observer) GetGenericHandlers() cache.ResourceEventHandlerFuncs { | |||
} | |||
} | |||
|
|||
func (o *Observer) EventRecorder() record.EventRecorder { | |||
return o.eventRecorder |
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 not visible why this getter is necessary from this commit point of view. Either squash it into where it's being used, or add usage to commit introducing it.
globalScyllaDBManagerSelector = labels.SelectorFromSet(labels.Set{ | ||
naming.GlobalScyllaDBManagerRegistrationLabel: naming.LabelValueTrue, | ||
}) | ||
) |
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.
we keep selectors in naming package, this could be moved there as well
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.
we keep selectors in naming package
only some of them, see e.g.
ncSelector := labels.SelectorFromSet(labels.Set{ |
scSelector := labels.SelectorFromSet(labels.Set{ |
Is there a benefit to making it public?
func (gsmc *Controller) getScyllaDBManagerClusterRegistrations() (map[string]*scyllav1alpha1.ScyllaDBManagerClusterRegistration, error) { | ||
smcrs, err := gsmc.scyllaDBManagerClusterRegistrationLister.List(labels.SelectorFromSet(labels.Set{ | ||
naming.GlobalScyllaDBManagerLabel: naming.LabelValueTrue, | ||
})) |
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.
ditto, move selector to naming package
} | ||
|
||
smcrMap := map[string]*scyllav1alpha1.ScyllaDBManagerClusterRegistration{} | ||
for i := range smcrs { |
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.
preallocate space for len(smcrs) keys
|
||
func (gsmc *Controller) getScyllaDBManagerClusterRegistrations() (map[string]*scyllav1alpha1.ScyllaDBManagerClusterRegistration, error) { | ||
smcrs, err := gsmc.scyllaDBManagerClusterRegistrationLister.List(labels.SelectorFromSet(labels.Set{ | ||
naming.GlobalScyllaDBManagerLabel: naming.LabelValueTrue, |
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.
explicitly use .Namespace(corev1.NamespaceAll) if you're listing in all namespaces
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.
Why? Both end up calling ListAll
, it's just syntax sugar?
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.
Because it's explicit about intention, this looks buggy. I had to dive into logic to understand whether it's desired or not.
}() | ||
|
||
scyllaDBDatacenters, err := gsmc.scyllaDBDatacenterLister.List(globalScyllaDBManagerSelector) | ||
if err != nil { |
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.
explicitly use .Namespace(corev1.NamespaceAll) if you're listing in all namespaces
smcrMap := map[string]*scyllav1alpha1.ScyllaDBManagerClusterRegistration{} | ||
for i := range smcrs { | ||
smcrMap[smcrs[i].Name] = smcrs[i] | ||
} |
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.
scmrs having the same name in different namespaces would collide here. It feels like a map[string]map[string]* should be used across this controller to distinguish different namespaces and preserve ability to use our controllerhelper functions suitable for per namespace reconcilation.
pkg/controller/globalscylladbmanager/sync_scylladbmanagerclusterregistrations.go
Show resolved
Hide resolved
old.(*corev1.Namespace), | ||
cur.(*corev1.Namespace), | ||
smcrc.handlers.EnqueueAllWithUntypedFilterFunc(hasGlobalScyllaDBManagerNamespaceName), | ||
smcrc.deleteNamespace, |
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.
EnqueueAll enqueues all ScyllaDBManagerClusterRegistration objects from untypedObj namespace. But this is Namespace so it has empty .Namespace field, which value turns out to be equal to special corev1.NamespaceAll, meaninig it will enqueue all ScyllaDBManagerClusterRegistration from all namespaces. Is this expected behavior?
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.
Yes, e.g. deletion of scylla-manager
namespace should unblock finalization of all existing SMCRs having the global-manager label. Although I can write a dedicated method if you think the route to this behaviour is hacky
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.
it's very much hacky, lets have dedicated method expressing what is desired behavior
Description of your changes: This PR adds integration between ScyllaDB clusters defined by v1alpha1.ScyllaDBDatacenters and the unmanaged, global ScyllaDB Manager instance. ScyllaDBDatacenters can now be automatically created and deleted from state of the global ScyllaDB Manager instance.
Which issue is resolved by this Pull Request:
Resolves #2570
/kind feature
/priority important-soon
/cc