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

CRUD API for GameServerBuild/GameServer CRs (GameServer API) #79

Closed
dgkanatsios opened this issue Nov 17, 2021 · 5 comments · Fixed by #91
Closed

CRUD API for GameServerBuild/GameServer CRs (GameServer API) #79

dgkanatsios opened this issue Nov 17, 2021 · 5 comments · Fixed by #91
Assignees
Labels
area/user-experiences Developer experience and suggestions on how to use thundernetes, installation, getting up & running enhancement New feature or request
Milestone

Comments

@dgkanatsios
Copy link
Collaborator

We should create CRUD APIs for GameServerBuild and GameServer CRs. This API should also serve as a basis for #16

@dgkanatsios dgkanatsios added enhancement New feature or request area/user-experiences Developer experience and suggestions on how to use thundernetes, installation, getting up & running labels Nov 17, 2021
@dgkanatsios dgkanatsios added this to the 0.2.0 milestone Nov 17, 2021
@dgkanatsios dgkanatsios self-assigned this Nov 17, 2021
@AmieDD
Copy link
Collaborator

AmieDD commented Nov 17, 2021

Are we thinking of writing this API in go?

CRUD HTTP
CREATE POST/PUT
READ GET
UPDATE PUT/POST/PATCH
DELETE DELETE
package main

import (
	"encoding/json"
	"fmt"
	"log"
	"net/http"
)

type Article struct {
	Title   string `json:"Title"`
	Desc    string `json:"desc"`
	Content string `json:"content"`
}

type Articles []Article

func allArticles(w http.ResponseWriter, r *http.Request) {
	articles := Articles{
		Article{Title: "thundernetes", Desc: "thundernetes API", Content: "Howdy"},
	}
	fmt.Println("thundernetes endpoint Hit: All Articles Endpoint")
	fmt.Println("All Articles: ", articles)
	json.NewEncoder(w).Encode(articles)
}

func homePage(w http.ResponseWriter, r *http.Request) {
	fmt.Fprintf(w, "thundernetes homepage endpoint hit")
}

func handleRequests() {
	http.HandleFunc("/", homePage)
	http.HandleFunc("/articles", allArticles)
	log.Fatal(http.ListenAndServe(":8081", nil))
}

func main() {
	handleRequests()
}

@dgkanatsios
Copy link
Collaborator Author

yeah, I'd prefer it. It would easily fetch the CRD types from this repo. .NET is kinda tricky to do, check here for some code of the original sidecar (which was written in .NET) https://github.com/PlayFab/thundernetes/blob/72d501ad20dcc5ca76773b6fd6ea18cac62b5185/sidecar-netcore/Controllers/ThundernetesController.cs

@dgkanatsios
Copy link
Collaborator Author

dgkanatsios commented Nov 18, 2021

The APIs we need

  • ListGameServerBuilds
  • CreateGameServerBuild
  • GetGameServerBuild
  • UpdateGameServerBuild (only update standingBy and max)
  • DeleteGameServerBuild
  • ListGameServersForBuild
  • GetGameServer
  • DeleteGameServer
  • ListGameServerDetailsForGameServerBuild
  • GetGameServerDetailForGameServer

comments

  • GameServerBuilds are supposed to be immutable (so no update image)
  • we need DeleteGameServer in case the game server process is stuck

@dgkanatsios
Copy link
Collaborator Author

The API has been created and integrated, we should create some end to end tests as well. Plus, we'd need to modify our publishing pipeline to publish a container image as well. Keeping this open till we complete these tasks.

@dgkanatsios
Copy link
Collaborator Author

Opened #123 to cover the missing end to end tests for the GameServer API, closing this.

@dgkanatsios dgkanatsios changed the title CRUD API for GameServerBuild/GameServer CRs CRUD API for GameServerBuild/GameServer CRs (GameServer API) Dec 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/user-experiences Developer experience and suggestions on how to use thundernetes, installation, getting up & running enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants