Skip to content

Commit

Permalink
feat: support version reporting API
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 393476621
  • Loading branch information
Google APIs authored and Copybara-Service committed Aug 28, 2021
1 parent 41635ad commit e9da6f8
Show file tree
Hide file tree
Showing 11 changed files with 194 additions and 99 deletions.
5 changes: 1 addition & 4 deletions google/cloud/gaming/v1/common.proto
@@ -1,4 +1,4 @@
// Copyright 2020 Google LLC
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -122,7 +122,6 @@ message Schedule {
// Encapsulates Agones fleet spec and Agones autoscaler spec sources.
message SpecSource {
// The game server config resource. Uses the form:
//
// `projects/{project}/locations/{location}/gameServerDeployments/{deployment_id}/configs/{config_id}`.
string game_server_config_name = 1;

Expand Down Expand Up @@ -163,12 +162,10 @@ message TargetDetails {
}

// The game server cluster name. Uses the form:
//
// `projects/{project}/locations/{location}/realms/{realm}/gameServerClusters/{cluster}`.
string game_server_cluster_name = 1;

// The game server deployment name. Uses the form:
//
// `projects/{project}/locations/{location}/gameServerDeployments/{deployment_id}`.
string game_server_deployment_name = 2;

Expand Down
138 changes: 118 additions & 20 deletions google/cloud/gaming/v1/game_server_clusters.proto
@@ -1,4 +1,4 @@
// Copyright 2020 Google LLC
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -27,9 +27,24 @@ option go_package = "google.golang.org/genproto/googleapis/cloud/gaming/v1;gamin
option java_multiple_files = true;
option java_package = "com.google.cloud.gaming.v1";

// A view for GameServerCluster objects.
enum GameServerClusterView {
// The default / unset value.
// The API will default to the BASIC view.
GAME_SERVER_CLUSTER_VIEW_UNSPECIFIED = 0;

// Include basic information of a GameServerCluster resource and omit
// `cluster_state`. This is the default value (for ListGameServerClusters,
// GetGameServerCluster and PreviewCreateGameServerCluster).
BASIC = 1;

// Include everything.
FULL = 2;
}

// Request message for GameServerClustersService.ListGameServerClusters.
message ListGameServerClustersRequest {
// Required. The parent resource name. Uses the form:
// Required. The parent resource name, in the following form:
// "projects/{project}/locations/{location}/realms/{realm}".
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
Expand All @@ -38,7 +53,7 @@ message ListGameServerClustersRequest {
}
];

// Optional. The maximum number of items to return. If unspecified, the server
// Optional. The maximum number of items to return. If unspecified, the server
// will pick an appropriate default. The server may return fewer items than
// requested. A caller should only rely on response's
// [next_page_token][google.cloud.gaming.v1.ListGameServerClustersResponse.next_page_token] to
Expand All @@ -54,6 +69,14 @@ message ListGameServerClustersRequest {
// Optional. Specifies the ordering of results following syntax at
// https://cloud.google.com/apis/design/design_patterns#sorting_order.
string order_by = 5 [(google.api.field_behavior) = OPTIONAL];

// Optional. View for the returned GameServerCluster objects. When `FULL` is
// specified, the `cluster_state` field is also returned in the
// GameServerCluster object, which includes the state of the referenced
// Kubernetes cluster such as versions and provider info. The default/unset
// value is GAME_SERVER_CLUSTER_VIEW_UNSPECIFIED, same as BASIC, which does
// not return the `cluster_state` field.
GameServerClusterView view = 6 [(google.api.field_behavior) = OPTIONAL];
}

// Response message for GameServerClustersService.ListGameServerClusters.
Expand All @@ -71,20 +94,27 @@ message ListGameServerClustersResponse {

// Request message for GameServerClustersService.GetGameServerCluster.
message GetGameServerClusterRequest {
// Required. The name of the game server cluster to retrieve. Uses the form:
//
// Required. The name of the game server cluster to retrieve, in the following form:
// `projects/{project}/locations/{location}/realms/{realm-id}/gameServerClusters/{cluster}`.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "gameservices.googleapis.com/GameServerCluster"
}
];

// Optional. View for the returned GameServerCluster objects. When `FULL` is
// specified, the `cluster_state` field is also returned in the
// GameServerCluster object, which includes the state of the referenced
// Kubernetes cluster such as versions and provider info. The default/unset
// value is GAME_SERVER_CLUSTER_VIEW_UNSPECIFIED, same as BASIC, which does
// not return the `cluster_state` field.
GameServerClusterView view = 6 [(google.api.field_behavior) = OPTIONAL];
}

// Request message for GameServerClustersService.CreateGameServerCluster.
message CreateGameServerClusterRequest {
// Required. The parent resource name. Uses the form:
// Required. The parent resource name, in the following form:
// `projects/{project}/locations/{location}/realms/{realm-id}`.
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
Expand All @@ -102,7 +132,7 @@ message CreateGameServerClusterRequest {

// Request message for GameServerClustersService.PreviewCreateGameServerCluster.
message PreviewCreateGameServerClusterRequest {
// Required. The parent resource name. Uses the form:
// Required. The parent resource name, in the following form:
// `projects/{project}/locations/{location}/realms/{realm}`.
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
Expand All @@ -119,6 +149,13 @@ message PreviewCreateGameServerClusterRequest {

// Optional. The target timestamp to compute the preview.
google.protobuf.Timestamp preview_time = 4 [(google.api.field_behavior) = OPTIONAL];

// Optional. This field is deprecated, preview will always return
// KubernetesClusterState.
GameServerClusterView view = 6 [
deprecated = true,
(google.api.field_behavior) = OPTIONAL
];
}

// Response message for
Expand All @@ -129,11 +166,15 @@ message PreviewCreateGameServerClusterResponse {

// The target state.
TargetState target_state = 3;

// Output only. The state of the Kubernetes cluster in preview, this will be available if
// 'view' is set to `FULL` in the relevant List/Get/Preview request.
KubernetesClusterState cluster_state = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Request message for GameServerClustersService.DeleteGameServerCluster.
message DeleteGameServerClusterRequest {
// Required. The name of the game server cluster to delete. Uses the form:
// Required. The name of the game server cluster to delete, in the following form:
// `projects/{project}/locations/{location}/gameServerClusters/{cluster}`.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
Expand All @@ -145,7 +186,7 @@ message DeleteGameServerClusterRequest {

// Request message for GameServerClustersService.PreviewDeleteGameServerCluster.
message PreviewDeleteGameServerClusterRequest {
// Required. The name of the game server cluster to delete. Uses the form:
// Required. The name of the game server cluster to delete, in the following form:
// `projects/{project}/locations/{location}/gameServerClusters/{cluster}`.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
Expand Down Expand Up @@ -176,10 +217,7 @@ message UpdateGameServerClusterRequest {

// Required. Mask of fields to update. At least one path must be supplied in
// this field. For the `FieldMask` definition, see
//
// https:
// //developers.google.com/protocol-buffers
// // /docs/reference/google.protobuf#fieldmask
// https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED];
}

Expand All @@ -191,10 +229,7 @@ message PreviewUpdateGameServerClusterRequest {

// Required. Mask of fields to update. At least one path must be supplied in
// this field. For the `FieldMask` definition, see
//
// https:
// //developers.google.com/protocol-buffers
// // /docs/reference/google.protobuf#fieldmask
// https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED];

// Optional. The target timestamp to compute the preview.
Expand Down Expand Up @@ -244,11 +279,9 @@ message GameServerCluster {
pattern: "projects/{project}/locations/{location}/realms/{realm}/gameServerClusters/{cluster}"
};

// Required. The resource name of the game server cluster. Uses the form:
//
// Required. The resource name of the game server cluster, in the following form:
// `projects/{project}/locations/{location}/realms/{realm}/gameServerClusters/{cluster}`.
// For example,
//
// `projects/my-project/locations/{location}/realms/zanzibar/gameServerClusters/my-onprem-cluster`.
string name = 1 [(google.api.field_behavior) = REQUIRED];

Expand All @@ -271,4 +304,69 @@ message GameServerCluster {

// Human readable description of the cluster.
string description = 7;

// Output only. The state of the Kubernetes cluster, this will be available if
// 'view' is set to `FULL` in the relevant List/Get/Preview request.
KubernetesClusterState cluster_state = 11 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// The state of the Kubernetes cluster.
message KubernetesClusterState {
// The state of the installed versions of Agones/Kubernetes. See also
// https://cloud.google.com/game-servers/docs/versions-and-upgrades.
enum InstallationState {
// The default value. This value is used if the state is omitted.
INSTALLATION_STATE_UNSPECIFIED = 0;

// The combination of Agones and Kubernetes versions is supported by Google
// Cloud Game Servers.
AGONES_KUBERNETES_VERSION_SUPPORTED = 1;

// The installed version of Agones is not supported by Google Cloud Game
// Servers.
AGONES_VERSION_UNSUPPORTED = 2;

// The installed version of Agones is supported by Google Cloud Game
// Servers, but the installed version of Kubernetes is not recommended or
// supported by the version of Agones.
AGONES_KUBERNETES_VERSION_UNSUPPORTED = 3;

// The installed version of Agones is not recognized because the Agones
// controller's image name does not have a version string reported as
// {major}.{minor}(.{patch}).
AGONES_VERSION_UNRECOGNIZED = 4;

// The server version of Kubernetes cluster is not recognized because the
// API server didn't return parsable version info on path/version.
KUBERNETES_VERSION_UNRECOGNIZED = 5;

// Failed to read or verify the version of Agones or Kubernetes. See
// version_installed_error_message for details.
VERSION_VERIFICATION_FAILED = 6;

// Agones is not installed.
AGONES_NOT_INSTALLED = 7;
}

// Output only. The version of Agones currently installed in the registered Kubernetes
// cluster.
string agones_version_installed = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

// Output only. The version of Kubernetes that is currently used in the registered
// Kubernetes cluster (as detected by the Cloud Game Servers service).
string kubernetes_version_installed = 2 [(google.api.field_behavior) = OUTPUT_ONLY];

// Output only. The state for the installed versions of Agones/Kubernetes.
InstallationState installation_state = 3 [(google.api.field_behavior) = OUTPUT_ONLY];

// Output only. The detailed error message for the installed versions of Agones/Kubernetes.
string version_installed_error_message = 4 [(google.api.field_behavior) = OUTPUT_ONLY];

// Output only. The cloud provider type reported by the first node's providerID in the list
// of nodes on the Kubernetes endpoint. On Kubernetes platforms that support
// zero-node clusters (like GKE-on-GCP), the provider type will be empty.
string provider = 5 [(google.api.field_behavior) = OUTPUT_ONLY];

// Output only. The version of Agones that is targeted to be installed in the cluster.
string agones_version_targeted = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
}
2 changes: 1 addition & 1 deletion google/cloud/gaming/v1/game_server_clusters_service.proto
@@ -1,4 +1,4 @@
// Copyright 2020 Google LLC
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
18 changes: 6 additions & 12 deletions google/cloud/gaming/v1/game_server_configs.proto
@@ -1,4 +1,4 @@
// Copyright 2020 Google LLC
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -28,8 +28,7 @@ option java_package = "com.google.cloud.gaming.v1";

// Request message for GameServerConfigsService.ListGameServerConfigs.
message ListGameServerConfigsRequest {
// Required. The parent resource name. Uses the form:
//
// Required. The parent resource name, in the following form:
// `projects/{project}/locations/{location}/gameServerDeployments/{deployment}/configs/*`.
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
Expand Down Expand Up @@ -71,8 +70,7 @@ message ListGameServerConfigsResponse {

// Request message for GameServerConfigsService.GetGameServerConfig.
message GetGameServerConfigRequest {
// Required. The name of the game server config to retrieve. Uses the form:
//
// Required. The name of the game server config to retrieve, in the following form:
// `projects/{project}/locations/{location}/gameServerDeployments/{deployment}/configs/{config}`.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
Expand All @@ -84,8 +82,7 @@ message GetGameServerConfigRequest {

// Request message for GameServerConfigsService.CreateGameServerConfig.
message CreateGameServerConfigRequest {
// Required. The parent resource name. Uses the form:
//
// Required. The parent resource name, in the following form:
// `projects/{project}/locations/{location}/gameServerDeployments/{deployment}/`.
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
Expand All @@ -103,8 +100,7 @@ message CreateGameServerConfigRequest {

// Request message for GameServerConfigsService.DeleteGameServerConfig.
message DeleteGameServerConfigRequest {
// Required. The name of the game server config to delete. Uses the form:
//
// Required. The name of the game server config to delete, in the following form:
// `projects/{project}/locations/{location}/gameServerDeployments/{deployment}/configs/{config}`.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
Expand Down Expand Up @@ -149,11 +145,9 @@ message GameServerConfig {
pattern: "projects/{project}/locations/{location}/gameServerDeployments/{deployment}/configs/{config}"
};

// The resource name of the game server config. Uses the form:
//
// The resource name of the game server config, in the following form:
// `projects/{project}/locations/{location}/gameServerDeployments/{deployment}/configs/{config}`.
// For example,
//
// `projects/my-project/locations/global/gameServerDeployments/my-game/configs/my-config`.
string name = 1;

Expand Down
2 changes: 1 addition & 1 deletion google/cloud/gaming/v1/game_server_configs_service.proto
@@ -1,4 +1,4 @@
// Copyright 2020 Google LLC
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down

0 comments on commit e9da6f8

Please sign in to comment.