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

static TCPUDP support for the container ports #2505

Closed
wants to merge 6 commits into from
Closed

static TCPUDP support for the container ports #2505

wants to merge 6 commits into from

Conversation

SaitejaTamma
Copy link
Contributor

What type of PR is this?

/kind breaking
/kind bug
/kind cleanup
/kind documentation

/kind feature

/kind hotfix

What this PR does / Why we need it:

Which issue(s) this PR fixes:

Closes #2314

Special notes for your reviewer:

@google-oss-prow
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: SaitejaTamma
To complete the pull request process, please assign markmandel after the PR has been reviewed.
You can assign the PR to them by writing /assign @markmandel in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow google-oss-prow bot requested review from aLekSer and pooneh-m March 8, 2022 00:38
@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: a36def6d-5de9-4a92-8aa6-e78abfe0029b

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@markmandel
Copy link
Collaborator

Failure on linting. Gets us all. Run make lint to run lints locally on your code.

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 069509d2-0fb7-4216-ba3e-f24aa8a35d49

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:

  • git fetch https://github.com/googleforgames/agones.git pull/2505/head:pr_2505 && git checkout pr_2505
  • helm install ./install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.22.0-95066ad

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 09f3f40d-fd1c-4342-9ba9-ed65e1a4e7b4

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@@ -474,6 +477,35 @@ func (c *Controller) syncGameServerPortAllocationState(ctx context.Context, gs *
return gs, nil
}

// Allocate gameserver ports ( containerports ) for dynamic protocols such as TCPUDP
// TODO: Going forward, this needs to be enhanced for other kinds of dynamic protocols
func handleTCPUDPPortAllocationforStaticPortPolicy(gs *agonesv1.GameServer) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I thought we were going to move this logic into GameServer.Pod(...)?

#2314 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The logic for TCPUDP port allocation for static port policy is encapsulated in the method “handleTCPUDPPortAllocationforStaticPortPolicy”. This method is invoked from “syncGameServerPortAllocationState”. Since this is an explicit port allocation action this needs to happen before the event “port allocated” is recorded, “ c.recorder.Event(gs, corev1.EventTypeNormal, string(gs.Status.State), "Port allocated") “

Copy link
Collaborator

Choose a reason for hiding this comment

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

Got it. That makes a certain amount of sense.

I'm not 100% sure, but is there a way to move this duplication of port logic into some kind of centralised function(s) that are shared between the two implementations? Feels like a lot of duplication.

But I can't see it myself, but I thought I'd ask the question?

@@ -474,6 +477,35 @@ func (c *Controller) syncGameServerPortAllocationState(ctx context.Context, gs *
return gs, nil
}

// Allocate gameserver ports ( containerports ) for dynamic protocols such as TCPUDP
// TODO: Going forward, this needs to be enhanced for other kinds of dynamic protocols
func handleTCPUDPPortAllocationforStaticPortPolicy(gs *agonesv1.GameServer) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Got it. That makes a certain amount of sense.

I'm not 100% sure, but is there a way to move this duplication of port logic into some kind of centralised function(s) that are shared between the two implementations? Feels like a lot of duplication.

But I can't see it myself, but I thought I'd ask the question?

@@ -474,6 +477,35 @@ func (c *Controller) syncGameServerPortAllocationState(ctx context.Context, gs *
return gs, nil
}

// Allocate gameserver ports ( containerports ) for dynamic protocols such as TCPUDP
// TODO: Going forward, this needs to be enhanced for other kinds of dynamic protocols
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure I follow this TODO? I feel like the comment should just be something like "Creates duplicate ports for handling TCPUDP protocol with static port policies" - or something simple like that? There isn't dynamic protocols in this?

pkg/gameservers/controller.go Outdated Show resolved Hide resolved
@markmandel
Copy link
Collaborator

Another thought I had this morning, was should we have an e2e test for this so that we check actual connectivity?

The only tricky part is choosing a static port that otherwise is not used, we should have a look to see if there are other e2e tests for static ports? (I'm not sure if there are?)

@markmandel
Copy link
Collaborator

The closest thing I could find is TestUnhealthyGameServersWithoutFreePorts - which uses static ports to cause an error to occur. 🤔

Co-authored-by: Mark Mandel <markmandel@google.com>
@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 227490ab-a69e-494f-b8c9-d40e4a78c501

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: fccea801-37ea-4c39-a130-3bd9d0b7de2c

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 2aa0fb39-53d0-4be6-a55c-d38930975f8b

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TCPUDP not supported
3 participants