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

Output JSON unmarshal error as Admission response #1005

Merged

Conversation

aLekSer
Copy link
Collaborator

@aLekSer aLekSer commented Aug 19, 2019

Add Error into response of AdmissionReview with UT.

Closes #992 .

@aLekSer aLekSer changed the title Output JSON unmarshal error as Admission responce Output JSON unmarshal error as Admission response Aug 19, 2019
@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: fa547dba-9f62-4e1d-82fb-d4f3c9ddd731

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/1005/head:pr_1005 && git checkout pr_1005
  • helm install install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.0.0-e6d78e7

@aLekSer
Copy link
Collaborator Author

aLekSer commented Aug 28, 2019

/lint

Copy link

@google-oss-robot google-oss-robot left a comment

Choose a reason for hiding this comment

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

@aLekSer: 0 warnings.

In response to this:

/lint

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Add Error into response of AdmissionReview with UT.
@aLekSer aLekSer force-pushed the fix/webhooks-errors-details branch from e6d78e7 to c4bc8b9 Compare August 28, 2019 09:11
@aLekSer aLekSer marked this pull request as ready for review August 28, 2019 09:12
@aLekSer
Copy link
Collaborator Author

aLekSer commented Aug 28, 2019

/assign @aLekSer

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 7efe3f00-92b2-4a48-8de6-82ba67f2544d

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/1005/head:pr_1005 && git checkout pr_1005
  • helm install install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.0.0-c4bc8b9

@aLekSer
Copy link
Collaborator Author

aLekSer commented Aug 28, 2019

Now we receive output from kubectl CLI, in such form:

kubectl apply -f ../examples/simple-udp/fleet.yaml
Error from server (InternalError): error when creating "../examples/simple-udp/fleet.yaml": Internal error occurred: admission webhook "mutations.agones.dev" denied the request: error unmarshalling original Fleet json: {"apiVersion":"agones.dev/v1","kind":"Fleet","metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"agones.dev/v1\",\"kind\":\"Fleet\",\"metadata\":{\"annotations\":{},\"name\":\"simple-udp\",\"namespace\":\"default\"},\"spec\":{\"replicas\":2,\"template\":{\"spec\":{\"ports\":[{\"containerPort\":7654,\"name\":false}],\"template\":{\"spec\":{\"containers\":[{\"image\":\"gcr.io/agones-images/udp-server:0.14\",\"name\":\"simple-udp\",\"resources\":{\"limits\":{\"cpu\":\"20m\",\"memory\":\"64Mi\"},\"requests\":{\"cpu\":\"20m\",\"memory\":\"64Mi\"}}}]}}}}}}\n"},"creationTimestamp":null,"name":"simple-udp","namespace":"default"},"spec":{"replicas":2,"template":{"spec":{"ports":[{"containerPort":7654,"name":false}],"template":{"spec":{"containers":[{"image":"gcr.io/agones-images/udp-server:0.14","name":"simple-udp","resources":{"limits":{"cpu":"20m","memory":"64Mi"},"requests":
{"cpu":"20m","memory":"64Mi"}}}]}}}}}}: json: cannot unmarshal bool into Go struct field GameServerPort.name of type string  

Here I set spec.template.spec.ports.name = false for simple-udp/fleet.yaml

@markmandel markmandel added area/user-experience Pertaining to developers trying to use Agones, e.g. SDK, installation, etc kind/feature New features for Agones labels Aug 28, 2019
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.

Love this. This is going to be great for our users!

@google-oss-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: aLekSer, markmandel
To complete the pull request process, please assign
You can assign the PR to them by writing /assign 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

@markmandel markmandel merged commit 9228d20 into googleforgames:master Aug 28, 2019
@aLekSer aLekSer deleted the fix/webhooks-errors-details branch August 28, 2019 16:55
@markmandel markmandel added this to the 1.0.0 milestone Sep 10, 2019
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/feature New features for Agones lgtm size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JSON serialisation error reporting on Mutation/Validation webhooks
4 participants