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

CRD OpenAPI Spec for ObjectMeta & PodTemplateSpec #1956

Merged
merged 4 commits into from
Jan 22, 2021

Conversation

markmandel
Copy link
Member

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespace from that line:

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

/kind feature

/kind hotfix

What this PR does / Why we need it:

This PR provides the mechanisms to pull core Kubernetes resource OpenAPI schemas out of the API, and customise and convert them into a format that is embeddable in our own CRD specifications.

This has been used to extract OpenAPI schemas for ObjectMeta, and PodTemplateSpec, and then embedded in GameServer as well as parent CRDs, creating a layer of validation for Pods definitions that are implemented via a GameServer.

Also included in a new helm config option of gameservers.podPreserveUnknownFields in case a user needs to escape
the field pruning on a Pod, or if PR causes a bug of any kind.

Which issue(s) this PR fixes:

Work on #1298

Special notes for your reviewer:

  • The code generation portion is split into it's own commit, so it's easier to review just the logic changes
  • We should make special note of this in the release notes, so that people know it exists, and the workaround if it causes issues.
  • This is not comprehensive validation, and therefore I have not closed the the referenced issue.

@markmandel markmandel added kind/feature New features for Agones area/build-tools Development tooling. I.e. pretty much everything in the `build` directory. area/user-experience Pertaining to developers trying to use Agones, e.g. SDK, installation, etc area/operations Installation, updating, metrics etc labels Jan 20, 2021
@google-cla google-cla bot added the cla: yes label Jan 20, 2021
@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 3222c780-8894-4cf7-aabd-3b7ddf40f31b

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

@markmandel
Copy link
Member Author

Well this is a weird one, helm hangs on doing the upgrade.

This is what I see when I enable debugging: - it just stops at the blank line, and never continues. The helm release is still marked as active, and successfully deployed.

       helm upgrade --install --wait --namespace=agones-system \
        --create-namespace \
        --debug \
        --set agones.image.tag=1.12.0-40bb824,agones.image.registry=gcr.io/agones-mark \
        --set agones.image.controller.pullPolicy="Always",agones.image.sdk.alwaysPull=true \
        --set agones.image.controller.pullSecret= \
        --set agones.ping.http.serviceType="LoadBalancer",agones.ping.udp.serviceType="LoadBalancer" \
        --set agones.allocator.http.serviceType="LoadBalancer" \
        --set agones.controller.logLevel="debug" \
        --set agones.crds.cleanupOnDelete=true \
        --set agones.featureGates="PlayerTracking=true&SDKWatchSendOnExecute=true&RollingUpdateOnReady=true" \
        --set agones.allocator.http.loadBalancerIP=34.82.197.230 \
         \
        agones /go/src/agones.dev/agones/install/helm/agones/
history.go:52: [debug] getting history for release agones
upgrade.go:121: [debug] preparing upgrade for agones
upgrade.go:129: [debug] performing update for agones
upgrade.go:308: [debug] creating upgraded release for agones
client.go:173: [debug] checking 32 resources for changes
client.go:440: [debug] Looks like there are no changes for ServiceAccount "agones-allocator"
client.go:440: [debug] Looks like there are no changes for ServiceAccount "agones-controller"
client.go:440: [debug] Looks like there are no changes for ServiceAccount "agones-sdk"

^Cmake: *** [Makefile:319: install] Error 2

@markmandel
Copy link
Member Author

Repro'd locally, but looks like an upgrade to Helm solved it. 🤞

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 3a81777f-f10d-4ec4-a9e4-12407df7f542

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/1956/head:pr_1956 && git checkout pr_1956
  • helm install ./install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.12.0-3b5586e

Copy link
Member

@roberthbailey roberthbailey left a comment

Choose a reason for hiding this comment

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

My only concern here is that by expanding object meta (in particular) we add documentation for a ton of new fields which users really shouldn't care about. The extra validation may be useful, but I don't expect anyone using Agones will need anything other than labels and annotations, and now there are a bunch of other documented and validated fields each place we have metadata that only serve to distract from the fields that are relevant.

test/e2e/gameserver_test.go Outdated Show resolved Hide resolved
@roberthbailey
Copy link
Member

https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/object-meta/ presents the fields nicely. Maybe folks will just read that and the validation is primarily for machine consumption.

build/boilerplate.yaml.txt Outdated Show resolved Hide resolved
@markmandel
Copy link
Member Author

My only concern here is that by expanding object meta (in particular) we add documentation for a ton of new fields which users really shouldn't care about. The extra validation may be useful, but I don't expect anyone using Agones will need anything other than labels and annotations, and now there are a bunch of other documented and validated fields each place we have metadata that only serve to distract from the fields that are relevant.

I would posit that we don't need to change any documentation above what we have now. Prior to 1.11 we did support the full ObjectMeta, so 1.11 is technically a regression in functionality (who knows who might want to add a finaliser to their Pod/GameServer one day????), and we have links to the existing Kubernetes reference documentation for ObjectMeta.

We currently document ObjectMeta in the GameServer reference by pointing to https://v1-17.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#podtemplate-v1-core and letting people go from there.

Similarly https://agones.dev/site/docs/reference/agones_crd_api_reference/#agones.dev/v1.GameServer points to the K8s reference as well, similarly in https://agones.dev/site/docs/reference/agones_crd_api_reference/#agones.dev/v1.GameServerTemplateSpec

So I think our current docs have good coverage in this area.

https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/object-meta/ presents the fields nicely. Maybe folks will just read that and the validation is primarily for machine consumption.

That's a really nice page 👍 maybe that's something we can add in our docs instead of / in addition to the reference docs.

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 32a1ec5b-adef-45f9-a3fd-0573fdb26c77

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

@markmandel
Copy link
Member Author

markmandel commented Jan 21, 2021

Note to self when writing the release notes:

  • Note that there is a big CRD validation change, and that everything should be backward compatible, but in case it isn't, there is a config option to turn off pruning and validation for the PodTemplateSpec.
  • Note that with this big a CRD change, if you are using Helm, you might need to update your Helm version and/or do a clean install. to apply it to your cluster if you already have a version of Agones installed.

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 292d17ff-8fdb-4f7c-8f37-b5a19834bab7

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/1956/head:pr_1956 && git checkout pr_1956
  • helm install ./install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.12.0-c6962b6

@google-oss-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: markmandel, 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:
  • OWNERS [markmandel,roberthbailey]

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

This PR provides the mechanisms to pull core Kubernetes resource OpenAPI
schemas out of the API, and customise and convert them into a format
that is embeddable in our own CRD specifications.

This has been used to extract OpenAPI schemas for `ObjectMeta`, and
`PodTemplateSpec`, and then embedded in `GameServer` as well as parent
CRDs, creating a layer of validation for Pods definitions that are
implemented via a GameServer.

Also included in a new helm config option of
`gameservers.podPreserveUnknownFields` in case a user needs to escape
the field pruning on a Pod, or if PR causes a bug of any kind.

Also worth noting, this is not comprehensive validation, and therefore I
have not closed the the referenced issue.

Work on googleforgames#1298
Needed upgrade to fix bug wth upgrade.
- Fix for typo in license.
- Fix comment in test to be more clear.
- Rebase against master and regen index.yaml
@google-oss-robot
Copy link

New changes are detected. LGTM label has been removed.

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 81740574-83c6-4fc9-a0a4-b41f961bcbe8

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/1956/head:pr_1956 && git checkout pr_1956
  • helm install ./install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.12.0-e47fc8b

@markmandel markmandel merged commit 8b8bb34 into googleforgames:master Jan 22, 2021
@markmandel markmandel deleted the feature/pod-openapi branch January 22, 2021 18:26
@markmandel markmandel added this to the 1.12.0 milestone Jan 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved area/build-tools Development tooling. I.e. pretty much everything in the `build` directory. area/operations Installation, updating, metrics etc area/user-experience Pertaining to developers trying to use Agones, e.g. SDK, installation, etc cla: yes kind/feature New features for Agones size/XXL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants