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

provider: EG should not provision if parametersRef not found #5081

Closed
wants to merge 2 commits into from

Conversation

zirain
Copy link
Member

@zirain zirain commented Jan 16, 2025

fixes: #5080

@zirain zirain requested a review from a team as a code owner January 16, 2025 10:10
Copy link

codecov bot commented Jan 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 66.93%. Comparing base (126d507) to head (dba53d8).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5081      +/-   ##
==========================================
+ Coverage   66.82%   66.93%   +0.10%     
==========================================
  Files         210      210              
  Lines       32957    32945      -12     
==========================================
+ Hits        22024    22052      +28     
+ Misses       9601     9564      -37     
+ Partials     1332     1329       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@zirain zirain force-pushed the eg-daemonset branch 3 times, most recently from ec1bcd6 to 99ed84d Compare January 16, 2025 12:50
@zirain zirain changed the title provider: EG should not provision if not found provider: EG should not provision if parametersRef not found Jan 16, 2025
@@ -138,10 +138,10 @@ kube-demo-undeploy: ## Uninstall the Kubernetes resources installed from the `ma
# tools/hack/run-kube-local.sh

.PHONY: conformance
conformance: create-cluster kube-install-image kube-deploy run-conformance delete-cluster ## Create a kind cluster, deploy EG into it, run Gateway API conformance, and clean up.
conformance: create-cluster kube-install-image kube-deploy install-eg-addons run-conformance delete-cluster ## Create a kind cluster, deploy EG into it, run Gateway API conformance, and clean up.
Copy link
Member Author

Choose a reason for hiding this comment

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

GC(envoy-gateway) refernece EnvoyProxy(proxy-config), that make service monitoring/otel-collector is required.

Copy link
Contributor

Choose a reason for hiding this comment

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

is this because we are using the same GC for conformance and e2e ? should we maintain 2 different GatewayClasses to keep each test suite more lightweight ?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, we can do that later.

Copy link
Member Author

Choose a reason for hiding this comment

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

wait #5091

@@ -568,8 +568,7 @@ func (r *gatewayAPIReconciler) updateStatusForGateway(ctx context.Context, gtw *
r.log.Info("failed to get Service for gateway",
"namespace", gtw.Namespace, "name", gtw.Name)
}
// update accepted condition
status.UpdateGatewayStatusAcceptedCondition(gtw, true)
Copy link
Contributor

Choose a reason for hiding this comment

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

curious why this was removed

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we should respect the logic in controller.go.

Copy link
Member Author

Choose a reason for hiding this comment

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

this made gateway always accepted, even the ref EnvoyProxy is not found.

test/config/gatewayclass.yaml Outdated Show resolved Hide resolved
@zirain zirain force-pushed the eg-daemonset branch 4 times, most recently from 7aabde8 to 68ca8eb Compare January 17, 2025 09:22
}
// Set Gateway as accepted to passed test?
status.SetGatewayAccepted(&gtw, true, gwapiv1.GatewayReasonAccepted, "The Gateway has not been scheduled by Envoy Gateway")
Copy link
Member Author

Choose a reason for hiding this comment

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

@arkodg do you think we should remove this and update the test.
because now we reply the final result in translator.

status: "False"
type: ListenersNotValid
Copy link
Member Author

Choose a reason for hiding this comment

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

this seems not right, GatewayConditionType only allow Accepted and Programmed.

fmt.Sprintf("Invalid metrics backendRefs: %v", err))
return
}

// need explicit setting accepted status to true, as the status may have been set to false in previous loop,
// e.g. when access log backendRefs created later than the Gateway or EnvoyProxy.
Copy link
Member

@zhaohuabing zhaohuabing Jan 21, 2025

Choose a reason for hiding this comment

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

This is unnecessary, as the Gateway status is always set to nil in every translation loop. Addtionally, setting Gatway Accepted status solely based on the listener status here can be confusing and should be avoided.

// Discard Status to reduce memory consumption in watchable
// It will be recomputed by the gateway-api layer
gtw.Status = gwapiv1.GatewayStatus{}
if !resourceMap.allAssociatedGateways.Has(gtwNamespacedName) {
resourceMap.allAssociatedGateways.Insert(gtwNamespacedName)
resourceTree.Gateways = append(resourceTree.Gateways, &gtw)
}
}

Copy link
Member Author

Choose a reason for hiding this comment

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

this's necessary during the test.

if accepted {
status = metav1.ConditionTrue
}
cond := newCondition(string(gwapiv1.GatewayReasonAccepted), status, string(reason), message, time.Now(), gw.Generation)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
cond := newCondition(string(gwapiv1.GatewayReasonAccepted), status, string(reason), message, time.Now(), gw.Generation)
cond := newCondition(string(gwapiv1.GatewayConditionAccepted), status, string(reason), message, time.Now(), gw.Generation)

@@ -940,7 +940,13 @@ func (r *gatewayAPIReconciler) processGateways(ctx context.Context, managedGC *g

if err := r.processGatewayParamsRef(ctx, &gtw, resourceMap, resourceTree); err != nil {
r.log.Error(err, "failed to process infrastructure.parametersRef for gateway", "namespace", gtw.Namespace, "name", gtw.Name)
status.SetGatewayAccepted(&gtw, false, gwapiv1.GatewayReasonInvalidParameters, err.Error())
r.updateGatewayStatus(&gtw)
Copy link
Member

Choose a reason for hiding this comment

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

r.updateGatewayStatus is used to trigger a dummy Gateway Status update event to update the gateway IP address and can't be used for update Accepted status.

I suggest to add the Accepted status to the Gateway resource and pass it to the Gateway API translator to handle it.

@zhaohuabing
Copy link
Member

@zirain I reponed #5117 as I pefer the approach to handle the EnvoyProxy error in that PR.

@zirain zirain closed this Jan 21, 2025
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.

provider: EG should not provision if parametersRef not found
3 participants