-
Notifications
You must be signed in to change notification settings - Fork 560
fix: grpc connections #2386
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
fix: grpc connections #2386
Changes from all commits
77798bf
865cd9b
5ec8c5c
35004ae
7e996bc
9029ea0
29d3f9d
022c691
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 |
---|---|---|
|
@@ -81,6 +81,7 @@ func (s *configMapCatalogSourceDecorator) Service() *v1.Service { | |
Namespace: s.GetNamespace(), | ||
}, | ||
Spec: v1.ServiceSpec{ | ||
ClusterIP: "None", | ||
Ports: []v1.ServicePort{ | ||
{ | ||
Name: "grpc", | ||
|
@@ -419,15 +420,18 @@ func (c *ConfigMapRegistryReconciler) CheckRegistryServer(catalogSource *v1alpha | |
// Check on registry resources | ||
// TODO: more complex checks for resources | ||
// TODO: add gRPC health check | ||
pods := c.currentPods(source, c.Image) | ||
|
||
if c.currentServiceAccount(source) == nil || | ||
c.currentRole(source) == nil || | ||
c.currentRoleBinding(source) == nil || | ||
c.currentService(source) == nil || | ||
len(c.currentPods(source, c.Image)) < 1 { | ||
len(pods) < 1 || | ||
len(pods[0].Status.ContainerStatuses) < 1 || | ||
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. Will this panic if there are not any pods? 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. If I'm reading this right, in that scenario 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. Would it short circuit though if the expression is OR-ed rather than AND-ed? 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. Yes, I think this is prone to a panic 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. Thinking on this again, I believe this may not actually be a problem as Nick mentioned. Thoughts on this? 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. I think I misunderstood the check when I had initially reviewed - if we're essentially just checking for whether the registry-server container is reporting a "healthy" state, then I don't think this kind of check is problematic (albeit difficult to read) due to the short circuiting mentioned earlier. 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. Something else I just noticed - if we're firing off Services with 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. That sounds reasonable -- based on the fact the endpoint has the same name as the service it should be straightforward to query and check that the endpoints.subsets field is non-nil. |
||
!pods[0].Status.ContainerStatuses[0].Ready { | ||
healthy = false | ||
return | ||
} | ||
|
||
healthy = true | ||
return | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,6 +74,7 @@ func (s *grpcCatalogSourceDecorator) Service() *corev1.Service { | |
Namespace: s.GetNamespace(), | ||
}, | ||
Spec: corev1.ServiceSpec{ | ||
ClusterIP: "None", | ||
Ports: []corev1.ServicePort{ | ||
{ | ||
Name: "grpc", | ||
|
@@ -425,7 +426,10 @@ func (c *GrpcRegistryReconciler) CheckRegistryServer(catalogSource *v1alpha1.Cat | |
source := grpcCatalogSourceDecorator{catalogSource} | ||
// Check on registry resources | ||
// TODO: add gRPC health check | ||
if len(c.currentPodsWithCorrectImageAndSpec(source, source.ServiceAccount().GetName())) < 1 || | ||
pods := c.currentPodsWithCorrectImageAndSpec(source, source.ServiceAccount().GetName()) | ||
if len(pods) < 1 || | ||
len(pods[0].Status.ContainerStatuses) < 1 || | ||
tylerslaton marked this conversation as resolved.
Show resolved
Hide resolved
|
||
!pods[0].Status.ContainerStatuses[0].Ready || | ||
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. we would update the service check here as well. In reality configmap based catalogs are deprecated (and only used in our e2e tests anymore from what I can tell) so maybe we should add more to this health check. |
||
c.currentService(source) == nil { | ||
healthy = false | ||
return | ||
|
This file was deleted.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
This makes sense to me - I feel like this is what I've been seeing locally and delaying this check until the pod is reporting a health state seems like like the most logical fix 👍