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

migrate code from googleapis/nodejs-game-servers #2837

Merged
merged 53 commits into from
Nov 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
027e386
Initial client library creation
telpirion Feb 10, 2020
af278cd
feat: updates package.json files and quickstart
telpirion Feb 11, 2020
8caa892
Adds quickstart
telpirion Feb 21, 2020
5ca79e0
build: get the build passing (#17)
yoshi-automation Mar 1, 2020
19e1a8c
build: get sample and system tests passing (#18)
JustinBeckwith Mar 1, 2020
bcb3db6
chore(deps): update dependency @types/mocha (#1)
renovate-bot Mar 1, 2020
0e2442d
chore(deps): update dependency c8 to v7 (#2)
renovate-bot Mar 1, 2020
20bb010
chore: release 1.0.0 (#4)
release-please[bot] Mar 2, 2020
f0f2cd1
feat: adds CRUD samples for GS realms (#21)
telpirion Mar 3, 2020
f707d56
chore: release 1.1.0 (#22)
release-please[bot] Mar 3, 2020
437958d
test: adds cleanup function for tests (#28)
telpirion Mar 10, 2020
eb25adf
build: generator updates and new coverage approach (#59)
yoshi-automation Apr 27, 2020
cd1fe75
feat: adds CRUD samples, tests for GS clusters (#24)
telpirion Apr 29, 2020
55e4774
chore(deps): update dependency uuid to v8 (#63)
renovate-bot May 1, 2020
dbd6766
chore: release 2.0.0 (#38)
release-please[bot] Jun 4, 2020
3a4ed17
chore(deps): update dependency mocha to v8 (#72)
renovate-bot Jun 11, 2020
f640609
chore: release 2.0.1 (#75)
release-please[bot] Jun 16, 2020
cdd0d5e
test: fix sample test by pointing at a shared cluster with Agones (#81)
xwxw-g Jul 9, 2020
3a801b2
chore: release 2.0.2 (#82)
release-please[bot] Jul 10, 2020
df6a323
docs(samples): fix sample formatting issues (#94)
pooneh-m Jul 16, 2020
f9bee80
docs(samples): Add Game Server deployment samples (#92)
pooneh-m Jul 16, 2020
b3744de
docs(samples): change tags to be aligned with golang samples (#97)
pooneh-m Jul 16, 2020
280fdd5
Add samples for GameServerConfigs (#98)
pooneh-m Jul 24, 2020
fc11284
Add sample for game server rollout (#102)
pooneh-m Jul 24, 2020
88e03b8
chore: release 2.1.0 (#110)
release-please[bot] Aug 5, 2020
7888188
chore: release 2.1.1 (#133)
release-please[bot] Nov 11, 2020
53d0d7c
chore: release 2.1.2 (#137)
release-please[bot] Dec 2, 2020
e4836ee
chore: release 2.2.0 (#143)
release-please[bot] Jan 12, 2021
034c46c
chore: release 2.3.0 (#148)
release-please[bot] Mar 2, 2021
1673277
chore: migrate to owl bot (#153)
SurferJeffAtGoogle May 18, 2021
74b48a7
chore: release 2.3.1 (#163)
release-please[bot] May 20, 2021
acb1cdc
chore: release 2.3.2 (#173)
release-please[bot] May 24, 2021
21c26e7
chore: release 2.3.3 (#180)
release-please[bot] Jun 10, 2021
06073a6
chore: release 2.3.4 (#187)
release-please[bot] Jun 22, 2021
b243b40
chore: release 2.3.5 (#193)
release-please[bot] Jun 29, 2021
a74409e
chore: release 2.3.6 (#197)
release-please[bot] Jul 12, 2021
5279fdd
chore: release 2.3.7 (#199)
release-please[bot] Jul 16, 2021
9629897
chore: release 2.3.8 (#207)
release-please[bot] Aug 17, 2021
24a6f06
chore: release 2.4.0 (#210)
release-please[bot] Aug 24, 2021
6460884
chore: release 2.5.0 (#214)
release-please[bot] Aug 30, 2021
9c82bac
chore: show cluster installation state details for get and list metho…
irataxy Sep 2, 2021
4ab00d4
docs(samples): add auto-generated samples for Node with api short nam…
gcf-owl-bot[bot] Sep 28, 2021
c6dc56c
docs: add update samples (#230)
irataxy Nov 18, 2021
0e04fda
build!: update library to use Node 12 (#266)
alexander-fenster May 17, 2022
d018292
chore(main): release 3.0.0 (#267)
release-please[bot] May 18, 2022
2f6b00d
chore(main): release 3.1.0 (#272)
release-please[bot] Jul 5, 2022
189fb36
build: do not test if service is unavailable (#275)
sofisl Jul 12, 2022
712e0d0
chore(main): release 3.1.1 (#307)
release-please[bot] Sep 7, 2022
909231d
chore(deps): update dependency uuid to v9 (#312)
renovate-bot Sep 8, 2022
bae504b
chore(main): release 3.1.2 (#314)
release-please[bot] Sep 22, 2022
efe8793
chore(main): release 3.1.3 (#351)
release-please[bot] Nov 11, 2022
7f0ee5e
Merge remote-tracking branch 'migration/main' into nodejs-game-server…
pattishin Nov 11, 2022
b55833d
chore: adding game-servers snippets to github workflow
pattishin Nov 11, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/game-servers-snippets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: game-servers-snippets
on:
push:
branches:
- main
paths:
- 'game-servers/snippets/**'
pull_request:
paths:
- 'game-servers/snippets/**'
pull_request_target:
types: [labeled]
paths:
- 'game-servers/snippets/**'
schedule:
- cron: '0 0 * * 0'
jobs:
test:
if: ${{ github.event.action != 'labeled' || github.event.label.name == 'actions:force-run' }}
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: 'write'
pull-requests: 'write'
id-token: 'write'
steps:
- uses: actions/[email protected]
with:
ref: ${{github.event.pull_request.head.sha}}
- uses: 'google-github-actions/[email protected]'
with:
workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider'
service_account: '[email protected]'
create_credentials_file: 'true'
access_token_lifetime: 600s
- uses: actions/[email protected]
with:
node-version: 16
- run: npm install
working-directory: game-servers/snippets
- run: npm test
working-directory: game-servers/snippets
env:
MOCHA_REPORTER_SUITENAME: game_servers_snippets
MOCHA_REPORTER_OUTPUT: game_servers_snippets_sponge_log.xml
MOCHA_REPORTER: xunit
- if: ${{ github.event.action == 'labeled' && github.event.label.name == 'actions:force-run' }}
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
try {
await github.rest.issues.removeLabel({
name: 'actions:force-run',
owner: 'GoogleCloudPlatform',
repo: 'nodejs-docs-samples',
issue_number: context.payload.pull_request.number
});
} catch (e) {
if (!e.message.includes('Label does not exist')) {
throw e;
}
}
- if: ${{ github.event_name == 'schedule'}}
run: |
curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L
chmod +x ./flakybot
./flakybot --repo GoogleCloudPlatform/nodejs-docs-samples --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
1 change: 1 addition & 0 deletions .github/workflows/workflows.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"healthcare/dicom",
"healthcare/fhir",
"healthcare/hl7v2",
"game-servers/snippets",
"mediatranslation",
"monitoring/opencensus",
"monitoring/prometheus",
Expand Down
86 changes: 86 additions & 0 deletions game-servers/snippets/create_cluster.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
// Copyright 2020, Google LLC.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

'use strict';

/**
* Create a Game Servers cluster.
* @param {string} projectId string project identifier
* @param {string} location Compute Engine region
* @param {string} realmId the realm to use
* @param {string} gameClusterId unique identifier for the new Game Cluster
* @param {string} gkeClusterName The full resource name of the GKE cluster to use
*/
async function main(
projectId = 'YOUR_PROJECT_ID',
location = 'LOCATION_ID',
realmId = 'REALM_ID',
gameClusterId = 'GAME_CLUSTER_ID',
gkeClusterName = 'GKE_CLUSTER_NAME'
) {
// [START cloud_game_servers_cluster_create]
const {
GameServerClustersServiceClient,
} = require('@google-cloud/game-servers');

const client = new GameServerClustersServiceClient();

async function createGameServerCluster() {
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
// const projectId = 'Your Google Cloud Project ID';
// const location = 'A Compute Engine region, e.g. "us-central1"';
// const realmId = 'The ID of the realm to locate this cluster in';
// const gameClusterId = 'A unique ID for this Game Server Cluster';
// const gkeClusterName= 'The full resource name of the GKE cluster to use';
const request = {
// Provide full resource name of a Game Server Realm
parent: client.realmPath(projectId, location, realmId),
gameServerClusterId: gameClusterId,
gameServerCluster: {
description: 'My Game Server Cluster',
connectionInfo: {
gkeClusterReference: {
// Provide full resource name of a Kubernetes Engine cluster
// In the form of 'projects/<project-id>/locations/<location>/clusters/<gke-cluster-name>'
cluster: gkeClusterName,
},
namespace: 'default',
},
},
};

const [operation] = await client.createGameServerCluster(request);
const [result] = await operation.promise();

console.log('Game Server Cluster created:');
console.log(`\tCluster name: ${result.name}`);
console.log(`\tCluster description: ${result.description}`);
console.log(
`\tGKE cluster: ${result.connectionInfo.gkeClusterReference.cluster}`
);
}

createGameServerCluster();
// [END cloud_game_servers_cluster_create]
}

main(...process.argv.slice(2)).catch(err => {
console.error(err.message);
process.exitCode = 1;
});
process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
144 changes: 144 additions & 0 deletions game-servers/snippets/create_config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
// Copyright 2020, Google LLC.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

'use strict';

/**
* Create a Game Servers Config.
* @param {string} projectId string project identifier
* @param {string} deploymentId unique identifier for the parent Game Server Deployment
* @param {string} configId unique identifier for the new Game Server Config
* @param {string} fleetName fleet name to be stored in Agones
*/
async function main(
projectId = 'YOUR_PROJECT_ID',
deploymentId = 'DEPLOYMENT_ID',
configId = 'CONFIG_ID',
fleetName = 'FLEET_NAME'
) {
// [START cloud_game_servers_config_create]
const {
GameServerConfigsServiceClient,
} = require('@google-cloud/game-servers');

const client = new GameServerConfigsServiceClient();

async function createGameServerConfig() {
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
// const projectId = 'Your Google Cloud Project ID';
// const deploymentId = 'A unique ID for the Game Server Deployment';
// const configId = 'A unique ID for the Game Server Config';
// const fleetName = 'The fleet name to be stored in Agones';
// fleet is the spec portion of an agones Fleet. It must be in JSON format.
// See https://agones.dev/site/docs/reference/fleet/ for more on fleets.
const fleet = `
{
"replicas": 10,
"scheduling": "Packed",
"strategy": {
"type": "RollingUpdate",
"rollingUpdate": {
"maxSurge": "25%",
"maxUnavailable": "25%"
}
},
"template": {
"metadata": {
"labels": {
"gameName": "udp-server"
}
},
"spec": {
"ports": [
{
"name": "default",
"portPolicy": "Dynamic",
"containerPort": 2156,
"protocol": "TCP"
}
],
"health": {
"initialDelaySeconds": 30,
"periodSeconds": 60
},
"sdkServer": {
"logLevel": "Info",
"grpcPort": 9357,
"httpPort": 9358
},
"template": {
"spec": {
"containers": [
{
"name": "dedicated",
"image": "gcr.io/agones-images/udp-server:0.17",
"imagePullPolicy": "Always",
"resources": {
"requests": {
"memory": "200Mi",
"cpu": "500m"
},
"limits": {
"memory": "200Mi",
"cpu": "500m"
}
}
}
]
}
}
}
}
}
`;
const request = {
parent: client.gameServerDeploymentPath(
projectId,
'global',
deploymentId
),
configId: configId,
gameServerConfig: {
fleetConfigs: [
{
name: fleetName,
fleetSpec: fleet,
},
],
description: 'nodejs test config',
},
};

const [operation] = await client.createGameServerConfig(request);
const [result] = await operation.promise();

console.log('Game Server Config created:');
console.log(`\t Config name: ${result.name}`);
console.log(`\t Config description: ${result.description}`);
}

createGameServerConfig();

// [END cloud_game_servers_config_create]
}

main(...process.argv.slice(2)).catch(err => {
console.error(err.message);
process.exitCode = 1;
});
process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
66 changes: 66 additions & 0 deletions game-servers/snippets/create_deployment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// Copyright 2020, Google LLC.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

'use strict';

/**
* Create a Game Servers Deployment.
* @param {string} projectId string project identifier
* @param {string} deploymentId unique identifier for the new Game Server Deployment
*/
async function main(
projectId = 'YOUR_PROJECT_ID',
deploymentId = 'DEPLOYMENT_ID'
) {
// [START cloud_game_servers_deployment_create]
const {
GameServerDeploymentsServiceClient,
} = require('@google-cloud/game-servers');

const client = new GameServerDeploymentsServiceClient();

async function createGameServerDeployment() {
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
// const projectId = 'Your Google Cloud Project ID';
// const deploymentId = 'A unique ID for the Game Server Deployment';
const request = {
parent: `projects/${projectId}/locations/global`,
deploymentId: deploymentId,
gameServerDeployment: {
description: 'nodejs test deployment',
},
};

const [operation] = await client.createGameServerDeployment(request);
const [result] = await operation.promise();

console.log('Game Server Deployment created:');
console.log(`\t Deployment name: ${result.name}`);
console.log(`\t Deployment description: ${result.description}`);
}

createGameServerDeployment();

// [END cloud_game_servers_deployment_create]
}

main(...process.argv.slice(2)).catch(err => {
console.error(err.message);
process.exitCode = 1;
});
process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
Loading