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

Add status subresource to fleet and Gameserverset #575

Merged
merged 2 commits into from
Feb 23, 2019

Conversation

aLekSer
Copy link
Collaborator

@aLekSer aLekSer commented Feb 8, 2019

Switch to use UpdateStatus function for Fleets when it is necessary, add RBAC
permissions for "fleets/status" and "gameserversets/status".

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 0ce04f01-27a4-4380-86c3-64c934a75fa4

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/GoogleCloudPlatform/agones.git pull/575/head:pr_575 && git checkout pr_575
  • helm install install/helm/agones --namespace agones-system --name agones --set agones.image.tag=0.8.0-2f3def3

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 2fdfe9e1-b192-4bb0-a569-85e3d2fb5e1b

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/GoogleCloudPlatform/agones.git pull/575/head:pr_575 && git checkout pr_575
  • helm install install/helm/agones --namespace agones-system --name agones --set agones.image.tag=0.8.0-2920e68

@markmandel markmandel added kind/cleanup Refactoring code, fixing up documentation, etc feature-freeze-do-not-merge Only eligible to be merged once we are out of feature freeze (next full release) labels Feb 12, 2019
@@ -48,13 +48,13 @@ rules:
resources: ["customresourcedefinitions"]
verbs: ["get"]
- apiGroups: ["stable.agones.dev"]
resources: ["gameservers", "gameserversets"]
resources: ["gameservers", "gameserversets", "gameserversets/status"]
Copy link
Member

Choose a reason for hiding this comment

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

Is there opportunity here to get more restrictive with our rbac permissions?

I mean - does the controller need to be able to update a gameserverset for example?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I will try to restrict them

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@markmandel I have restricted new subresource permissions.
However cannot restrict gameserversets permissions. In fleets and fleetautoscalers controllers we are using main Resource endpoint gsSetCopy.Spec.Replicas and Spec.Replicas of the fleet:
https://github.com/GoogleCloudPlatform/agones/blob/0e92c90b9f0da86ab34cae53e74382113f56bf6e/pkg/fleets/controller.go#L268
https://github.com/GoogleCloudPlatform/agones/blob/0e92c90b9f0da86ab34cae53e74382113f56bf6e/pkg/fleetautoscalers/controller.go#L220

verbs: ["create", "delete", "get", "list", "update", "watch"]
- apiGroups: ["stable.agones.dev"]
resources: ["gameservers"]
verbs: ["patch"]
- apiGroups: ["stable.agones.dev"]
resources: ["fleets", "fleetallocations", "fleetautoscalers"]
resources: ["fleets", "fleets/status", "fleetallocations", "fleetautoscalers"]
Copy link
Member

Choose a reason for hiding this comment

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

Same as above - could we lock this down a little tighter?

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: a5b93280-06c3-475c-8cf1-ee457ac4f573

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/GoogleCloudPlatform/agones.git pull/575/head:pr_575 && git checkout pr_575
  • helm install install/helm/agones --namespace agones-system --name agones --set agones.image.tag=0.8.0-3a5fca4

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: eb89262a-285b-46bc-82db-5c1f475592e3

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/GoogleCloudPlatform/agones.git pull/575/head:pr_575 && git checkout pr_575
  • helm install install/helm/agones --namespace agones-system --name agones --set agones.image.tag=0.8.0-bb319d9

@aLekSer
Copy link
Collaborator Author

aLekSer commented Feb 20, 2019

The small regression after applying this changes:
If the spec.Replicas in GSS was 0 initially then there are empty values on Status.Replicas , Ready and Allocated:

NAME                                                        SCHEDULING   DESIRED   CURRENT   ALLOCATED   READY     AGE                                                                                   
gameserverset.stable.agones.dev/scale-fleet-0-45ksj-5qrkp   Packed       30        30        0           30        25s 
gameserverset.stable.agones.dev/scale-fleet-1-szfqc-g5b8g   Packed       0                                         25s

@markmandel markmandel removed feature-freeze-do-not-merge Only eligible to be merged once we are out of feature freeze (next full release) labels Feb 21, 2019
@markmandel
Copy link
Member

@aLekSer I'm guessing this is because there is no default values for those status items on creation? I'd be tempted to ask #sig-apimachinery to see why 0 values come as blank? (although not quite sure what the reason for this is -- feels like a k8s bug?)

I'm wondering if its something we need to worry about it? WDYT?

@aLekSer
Copy link
Collaborator Author

aLekSer commented Feb 21, 2019

I think this is because status fields are not defined in yaml file and the only place Status are changed (inited) is here:
https://github.com/GoogleCloudPlatform/agones/blob/3a0e6d1c335413ee30dd8ebce555e18bd8620d75/pkg/gameserversets/controller.go#L557
I am looking for a fix, without it we would see empty printing columns if Spec.Replicas was always 0.

@aLekSer aLekSer force-pushed the fleet-status-subresource branch 2 times, most recently from 1642362 to 9f953b1 Compare February 21, 2019 13:31
@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 897563be-bcc7-4b43-89d2-900e6f3a582d

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

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: b38b858d-20ca-433d-93cb-6a293f93077b

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

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 5bfc7075-5e40-4ec1-8750-ecf685743aa9

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

@aLekSer
Copy link
Collaborator Author

aLekSer commented Feb 21, 2019

Some new error on a test step:
rm: cannot remove './public': No such file or directory
includes/website.mk:35: recipe for target 'site-static' failed
mkdir /workspace/site/public
make[2]: [site-static] Error 1 (ignored)

Main error was on controller_test.go TestControllerSyncFleet
Fixed in upcomming change.

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 7c2c10f3-ab08-4c36-93af-61e1b5e7c5e4

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/GoogleCloudPlatform/agones.git pull/575/head:pr_575 && git checkout pr_575
  • helm install install/helm/agones --namespace agones-system --name agones --set agones.image.tag=0.9.0-b146278

@markmandel
Copy link
Member

I am looking for a fix, without it we would see empty printing columns if Spec.Replicas was always 0.

Is the issue that the value is 0, or that status hasn't been set at all?

If you scale a fleet up to 5, and then back down to 0, does it go back to being blank?

I'm wondering if its because the status hasn't been created yet?

@aLekSer
Copy link
Collaborator Author

aLekSer commented Feb 22, 2019

Hello @markmandel ,
I have fixed the issue. As you can see I added one more updateStatus on creating GameServerSet from fleet controller.

Is the issue that the value is 0, or that status hasn't been set at all?

Status were not set at all, but now it is set on creating GSS with aditional step (above).

If you scale a fleet up to 5, and then back down to 0, does it go back to being blank?

Now it always set right after create of GSS.

I'm wondering if its because the status hasn't been created yet?

Yes, that was the case, no all should be fine with yesterday fix.

gsSetCopy.Status.ReadyReplicas = 0
gsSetCopy.Status.Replicas = 0
gsSetCopy.Status.AllocatedReplicas = 0
_, err = gsSets.UpdateStatus(gsSetCopy)
Copy link
Collaborator Author

@aLekSer aLekSer Feb 22, 2019

Choose a reason for hiding this comment

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

Here is an extra step which set default values.

Switch to using UpdateStatus function when it is necessary, add RBAC
permissions for "fleets/status" and "gameserversets/status".
@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: e406f1b9-7287-4201-b82a-9859e797dee8

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/GoogleCloudPlatform/agones.git pull/575/head:pr_575 && git checkout pr_575
  • helm install install/helm/agones --namespace agones-system --name agones --set agones.image.tag=0.9.0-efbac45

Copy link
Member

@markmandel markmandel left a comment

Choose a reason for hiding this comment

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

🎲

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 38af98c4-be7c-4e7a-8d02-795013154af4

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/GoogleCloudPlatform/agones.git pull/575/head:pr_575 && git checkout pr_575
  • helm install install/helm/agones --namespace agones-system --name agones --set agones.image.tag=0.9.0-eed2fbc

@markmandel markmandel merged commit 68d64e2 into googleforgames:master Feb 23, 2019
@markmandel markmandel added this to the 0.9.0 milestone Feb 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/cleanup Refactoring code, fixing up documentation, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants