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

Alpha field in the stable API should follow best practices #1347

Closed
pooneh-m opened this issue Feb 19, 2020 · 3 comments · Fixed by #1348
Closed

Alpha field in the stable API should follow best practices #1347

pooneh-m opened this issue Feb 19, 2020 · 3 comments · Fixed by #1348
Assignees
Labels
kind/bug These are bugs. kind/cleanup Refactoring code, fixing up documentation, etc
Milestone

Comments

@pooneh-m
Copy link
Contributor

pooneh-m commented Feb 19, 2020

An Alpha field is added but not following best practices of introducing an unstable version to a stable API:

  • The field should be a pointer
  • Use // +optional tag
  • omitempty for GameServerStatus.Alpha
  • Protected by feature gate for the API, storage and validation.
@pooneh-m pooneh-m added the kind/bug These are bugs. label Feb 19, 2020
@markmandel
Copy link
Member

markmandel commented Feb 19, 2020

Thanks for sharing this 👍 ! I went hunting for some kind of best practice here, and couldn't find one!
(Curious - where did you find this? This is a very strange url)

The field should be a pointer

Sounds like a good idea. Let's do this.

// Use // +optional tag
Sounds good! Wondering what the change there will be to the generated client, but we will find out!

emitempty for GameServerStatus.Alpha

I assume you mean omitempty ? We have this, but since it's not a pointer, it's probably not that useful.

Protected by feature gate for the API, storage and validation.

Maybe we clear the Alpha state on "ApplyDefaults" if one exists? Since we can't directly control the storage since we are using CRDs and not a full API Extension.

I feel like creating new mutating webhooks to remove this value on update/create if they don't exist already might not be worth the effort.

How does that sound?

@pooneh-m
Copy link
Contributor Author

Thanks for sharing this ! I went hunting for some kind of best practice here, and couldn't find one!
(Curious - where did you find this? This is a very strange url)

I updated the URL to its origin.

The field should be a pointer

Sounds like a good idea. Let's do this.

// Use // +optional tag
Sounds good! Wondering what the change there will be to the generated client, but we will find out!

emitempty for GameServerStatus.Alpha

I assume you mean omitempty ? We have this, but since it's not a pointer, it's probably not that useful.

We have it on GameServer.Alpha but not GameServerStatus.Alpha
Thanks, yes I mean omitempty. :)

Protected by feature gate for the API, storage and validation.

Maybe we clear the Alpha state on "ApplyDefaults" if one exists? Since we can't directly control the storage since we are using CRDs and not a full API Extension.

ApplyDefaults is a good idea and easy to implement.

I feel like creating new mutating webhooks to remove this value on update/create if they don't exist already might not be worth the effort.

How does that sound?

👍

@markmandel markmandel self-assigned this Feb 19, 2020
@markmandel
Copy link
Member

We have it on GameServer.Alpha but not GameServerStatus.Alpha

Ah! Excellent catch! Good point.

Thanks for finding this - I was wondering how other groups solved this problem - this is great to know there is prior art we can leverage 🙌

markmandel added a commit to markmandel/agones that referenced this issue Feb 19, 2020
@markmandel markmandel added this to the 1.4.0 milestone Feb 26, 2020
@markmandel markmandel added the kind/cleanup Refactoring code, fixing up documentation, etc label Feb 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug These are bugs. kind/cleanup Refactoring code, fixing up documentation, etc
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants