Skip to content

Move GameServer validation to a ValidatingAdmissionWebhook#147

Merged
markmandel merged 1 commit intoagones-dev:masterfrom
markmandel:feature/validation-hook
Mar 17, 2018
Merged

Move GameServer validation to a ValidatingAdmissionWebhook#147
markmandel merged 1 commit intoagones-dev:masterfrom
markmandel:feature/validation-hook

Conversation

@markmandel
Copy link
Collaborator

Validation was originally done in a MutationAdmissionWebhook for simplicity, but as we need more validation (for Fleets and supporting CRDs) doing validation work in a Mutation webhook feels like the wrong place to do this work.

This also provides much better validation errors out of kubectl than the Mutation Webhook provides!

$ kubectl create -f ./examples/cpp-simple/gameserver.yaml
The GameServer "" is invalid:
* container: Container is required when using multiple containers in the pod template
* hostPort: HostPort cannot be specified with a Dynamic PortPolicy
* container: Could not find a container named

So this configures a validation webhook and moves the validation logic into that code.

Validation was originally done in a MutationAdmissionWebhook
for simplicity, but as we need more validation (for Fleets and
supporting CRDs) doing validation work in a Mutation webhook
feels like the wrong place to do this work.

This also provides *much* better validation errors out
of kubectl than the Mutation Webhook provides!

```bash
$ kubectl create -f ./examples/cpp-simple/gameserver.yaml
The GameServer "" is invalid:
* container: Container is required when using multiple containers in the pod template
* hostPort: HostPort cannot be specified with a Dynamic PortPolicy
* container: Could not find a container named
```

So this configures a validation webhook and moves the validation
logic into that code.
@markmandel markmandel added kind/cleanup Refactoring code, fixing up documentation, etc area/user-experience Pertaining to developers trying to use Agones, e.g. SDK, installation, etc labels Mar 16, 2018
@markmandel markmandel added this to the 0.2 milestone Mar 16, 2018
@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 32cbca07-4576-45e6-b923-f30634cf05ef

The following development artifacts have been built, and will exist for the next 30 days:

Copy link
Collaborator

@EricFortin EricFortin left a comment

Choose a reason for hiding this comment

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

LGTM!

@markmandel markmandel merged commit 03df9a9 into agones-dev:master Mar 17, 2018
@markmandel markmandel deleted the feature/validation-hook branch March 17, 2018 03:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/user-experience Pertaining to developers trying to use Agones, e.g. SDK, installation, etc kind/cleanup Refactoring code, fixing up documentation, etc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants