-
Notifications
You must be signed in to change notification settings - Fork 716
fix: only insert proxy service once it exists #7424
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
f3db8e5
e0aa3c2
c497e7c
e8b6e58
774837f
61542d9
d3004de
d153d3c
1de6880
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 |
|---|---|---|
|
|
@@ -1605,11 +1605,7 @@ func (r *gatewayAPIReconciler) processServiceClusterForGatewayClass(ep *egv1a1.E | |
| } | ||
| } | ||
|
|
||
| resourceMap.insertBackendRef(gwapiv1.BackendObjectReference{ | ||
| Kind: ptr.To(gwapiv1.Kind("Service")), | ||
| Namespace: gatewayapi.NamespacePtr(proxySvcNamespace), | ||
| Name: gwapiv1.ObjectName(proxySvcName), | ||
| }) | ||
| r.insertProxyServiceIfExists(proxySvcName, proxySvcNamespace, resourceMap) | ||
| } | ||
|
|
||
| // Called on a Gateway when merged gateways mode is not enabled for its parent GatewayClass. | ||
|
|
@@ -1634,10 +1630,24 @@ func (r *gatewayAPIReconciler) processServiceClusterForGateway(ep *egv1a1.EnvoyP | |
| } | ||
| } | ||
|
|
||
| r.insertProxyServiceIfExists(proxySvcName, proxySvcNamespace, resourceMap) | ||
| } | ||
|
|
||
| func (r *gatewayAPIReconciler) insertProxyServiceIfExists(name, namespace string, resourceMap *resourceMappings) { | ||
| svcNN := types.NamespacedName{Name: name, Namespace: namespace} | ||
| svc := new(corev1.Service) | ||
| err := r.client.Get(context.Background(), svcNN, svc) | ||
| // Only insert if service exists | ||
| if err != nil { | ||
| if !kerrors.IsNotFound(err) { | ||
| r.log.Error(err, "failed to get proxy service", "namespace", namespace, "name", name) | ||
|
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. this should be info, since the system is eventually consistent
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. Sure, will update with a follow-up
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. thanks, can we also use existing |
||
| } | ||
| return | ||
| } | ||
| resourceMap.insertBackendRef(gwapiv1.BackendObjectReference{ | ||
| Kind: ptr.To(gwapiv1.Kind("Service")), | ||
| Namespace: gatewayapi.NamespacePtr(proxySvcNamespace), | ||
| Name: gwapiv1.ObjectName(proxySvcName), | ||
| Kind: ptr.To(gwapiv1.Kind(resource.KindService)), | ||
| Namespace: gatewayapi.NamespacePtr(svc.Namespace), | ||
| Name: gwapiv1.ObjectName(svc.Name), | ||
| }) | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.