-
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
GameServer Pod: Stable Network ID #2826
GameServer Pod: Stable Network ID #2826
Conversation
Build Failed 😱 Build Id: a2f5eb53-5503-4f37-9742-ef112879052e To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Legit bug:
|
48fb90d
to
c50003c
Compare
Build Succeeded 👏 Build Id: 08ac1206-8b79-4f51-bf5c-dbf3d0b4c84d 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:
|
A group of `Pods` attached to `GameServers` can use a | ||
[Headless Service](https://kubernetes.io/docs/concepts/services-networking/service/#headless-services) to control | ||
the domain of the Pods, along with providing | ||
a [`subdomain` value to the `GameServer` `PodTemplateSpec`](https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-s-hostname-and-subdomain-fields) |
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 documentation says:
Currently when a Pod is created, its hostname is the Pod's metadata.name value.
Which sounds like k8s already does exactly what you are adding in this PR. Do we need to explicitly set the hostname field?
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 went back and forth on this as well, but then I read this part:
https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-s-hostname-and-subdomain-fields:~:text=Note%3A%20Because,on%20the%20Service.
Note: Because A or AAAA records are not created for Pod names, hostname is required for the Pod's A or AAAA record to be created. A Pod with no hostname but with subdomain will only create the A or AAAA record for the headless Service (default-subdomain.my-namespace.svc.cluster-domain.example), pointing to the Pod's IP address. Also, Pod needs to become ready in order to have a record unless publishNotReadyAddresses=True is set on the Service.
So TL;DR - to have a A record for the pod, it has to have a hostname specified.
This isn't surprising to me - since the (general) formatting for a resource name allows characters and lengths of strings that aren't allowed in host names for DNS entries.
I think where they say "hostname" above, what they mean is the internal hostname to the container - not an external DNS entry.
c50003c
to
3a39772
Compare
Build Succeeded 👏 Build Id: c10faba8-dbd1-41cf-95a3-e8aedde4948a 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:
|
I think I would be more comfortable with this under a feature gate. Honestly, I think it can go straight to |
// replace . with - since it must match RFC 1123 | ||
pod.Spec.Hostname = strings.ReplaceAll(gs.ObjectMeta.Name, ".", "-") | ||
} | ||
|
||
gs.podObjectMeta(pod) |
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.
Just adding this as a formal review comment. I think since this is altering the generated pod in a possibly significant way, we should add a feature gate. It can go straight to beta
, IMO - but especially in a world where we're releasing straight from main
, I think we should be a little cautious.
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.
Sounds good to me - I'll make the change.
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.
...and done!
This change sets the hostName (if not already set) on the Pod of the GameServer, if an end user would like a DNS entry to communicate directly to the GameServer Pod in the cluster. Since this is a relatively minor change, no FeatureFlag was created. Closes googleforgames#2704
3a39772
to
c55a17d
Compare
Build Succeeded 👏 Build Id: 1436c59a-5cb2-4b23-b5bf-c07f8160de75 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:
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: markmandel, zmerlynn 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 |
What type of PR is this?
/kind feature
What this PR does / Why we need it:
This change sets the hostName (if not already set) on the Pod of the GameServer, if an end user would like a DNS entry to communicate directly to the GameServer Pod in the cluster.
Which issue(s) this PR fixes:
Closes #2704
Special notes for your reviewer:
Since this is a relatively minor change, no FeatureFlag was created. Please let me know if you disagree with this approach.