-
Notifications
You must be signed in to change notification settings - Fork 820
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
Allow the ports for gRPC and REST to be configured for the allocator service #2272
Allow the ports for gRPC and REST to be configured for the allocator service #2272
Conversation
Build Succeeded 👏 Build Id: 9b245954-6b49-4557-bc11-16f9c4f60ef5 The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version:
|
{{- end }} | ||
spec: | ||
selector: | ||
multicluster.agones.dev/role: allocator | ||
ports: | ||
- port: {{ .Values.agones.allocator.http.port }} | ||
{{- if .Values.agones.allocator.service.http.enabled }} |
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.
The logic here is similar to what is in cmd/allocator/main.go
but is a bit harder to read due to the templating language.
There are 4 cases to cover:
- If http & grpc are both enabled and use the same port, only configure the http port
- If http & grpc are both enabled and use different ports, configure the http port and the grpc port
- If only http is enabled, only configure the http port
- If only grpc is enabled, only configure the grpc port
The logic to cover the 4 cases has three branches:
- If the http port is enabled, then use it (covers cases 1-3 & skipping covers 4)
- If the grpc port is also enabled and it is different from the http port, use it as well (case 2)
- If the http port is disabled but the grpc port is enabled, use it (case 4)
Locally I tested this by modifying my values.yaml
file and running make gen-install
to see the resulting yaml and verify that the correct number or ports were defined (1 or 2) with the correct values.
691306d
to
56f6f57
Compare
Build Failed 😱 Build Id: 3a5fe140-13ad-4480-abe6-fc1fcf3b5b56 To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Build Succeeded 👏 Build Id: f2a04482-3eaf-4f29-b899-09ad9d4e329e The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version:
|
Build Succeeded 👏 Build Id: 6992a215-2a4a-4552-8aa4-f7ebd8b4e6f2 The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version:
|
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.
Leaving feedback, but not requiring them to be changed for the PR.
@@ -161,8 +184,19 @@ spec: | |||
- name: FEATURE_GATES | |||
value: {{ .Values.agones.featureGates | quote }} | |||
ports: | |||
{{- if .Values.agones.allocator.service.http.enabled }} | |||
- name: https |
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 think that name
should also be a changeable attribute if we're already changing the port values. There are some use cases where changing the port to 80
and leaving the name as https
would be disadvantageous. If not, then perhaps we should statically name this to just be http
to be consistent with the nomenclature of the helm values label.
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.
Done.
containerPort: {{ .Values.agones.allocator.service.http.targetPort }} | ||
{{- if .Values.agones.allocator.service.grpc.enabled }} | ||
{{- if ne .Values.agones.allocator.service.grpc.port .Values.agones.allocator.service.http.port }} | ||
- name: grpc |
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.
Related to the above, it might be worth having this be defined via the helm value 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.
Done.
56f6f57
to
ce8ffd1
Compare
Build Failed 😱 Build Id: dba18489-a5d6-4acc-8d6c-2fb08b16a49e To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Build Succeeded 👏 Build Id: c4da79f8-b978-4d1f-90f0-45792e44c72b The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version:
|
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.
Couple of nits on logging, but otherwise LGTM
cmd/allocator/main.go
Outdated
@@ -92,6 +91,10 @@ func main() { | |||
runtime.SetLevel(logrus.InfoLevel) | |||
} | |||
|
|||
if !validPort(conf.GRPCPort) && !validPort(conf.HTTPPort) { | |||
logger.Fatalf("Must specify a valid gRPC port or an HTTP port for the allocator service. grpc port = %d, http port = %d", conf.GRPCPort, conf.HTTPPort) |
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.
Minor nit:
logger.Fatalf("Must specify a valid gRPC port or an HTTP port for the allocator service. grpc port = %d, http port = %d", conf.GRPCPort, conf.HTTPPort) | |
logger.WithField("grpc-port", conf.GRPCPort).WithField("http-port", conf.HTTPPort).Fatal("Must specify a valid gRPC port or an HTTP port for the allocator service") |
Since we have structured logging.
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.
done.
cmd/allocator/main.go
Outdated
} | ||
|
||
func runREST(h *serviceHandler, httpPort int) { | ||
logger.Infof("Running the rest handler on port %d", httpPort) |
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.
logger.Infof("Running the rest handler on port %d", httpPort) | |
logger.WithField("port", httpPort).Info("Running the rest handler") |
Nit to prefer a structured log 😄
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.
done.
cmd/allocator/main.go
Outdated
err = http.ListenAndServe(":8080", http.DefaultServeMux) | ||
logger.WithError(err).Fatal("allocation service crashed") | ||
func runGRPC(h *serviceHandler, grpcPort int) { | ||
logger.Infof("Running the grpc handler on port %d", grpcPort) |
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.
logger.Infof("Running the grpc handler on port %d", grpcPort) | |
logger.WithField("port", grpcPort).Info("Running the grpc handler on port") |
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.
done.
ce8ffd1
to
e722921
Compare
e722921
to
8a23675
Compare
Build Succeeded 👏 Build Id: b8475669-4045-4091-ac52-5c03d7749439 The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version:
|
Build Failed 😱 Build Id: c94a3e86-132d-44fd-8897-03092274cf82 To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
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.
Flake:
--- FAIL: TestFleetRollingUpdate (0.00s)
--- FAIL: TestFleetRollingUpdate/Use_fleet_Patch_false_10% (118.20s)
fleet_test.go:331:
Error Trace: fleet_test.go:331
Error: Received unexpected error:
new replicas should be less than target + maxSurge + maxUnavailable + shift. Replicas: 11, Expected: 10
Test: TestFleetRollingUpdate/Use_fleet_Patch_false_10%
Retrying!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: markmandel, rcreasey, roberthbailey 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 |
Build Succeeded 👏 Build Id: 720b6260-928d-4f00-9bd7-0647d9e35da1 The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version:
|
What type of PR is this?
/kind breaking
What this PR does / Why we need it: Makes it possible to disable the REST endpoint in the allocator service or to run gRPC and REST on different ports. This allows using the non-experimental gRPC server code.
Which issue(s) this PR fixes:
Closes #2263
Special notes for your reviewer:
This is currently a work-in-progress. I still need to update the documentation before this can be merged.I've added documentation.
This is a breaking change because I'm renaming some helm parameters (which can be seen in the updates to the Makefile and the allocator service documentation). In the 1.18.0 release we should notify folks that if they rely on these helm parameters that they now have different names.