-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Central build and deploy Services pipeline (#82)
The PR gives us: * Images are building and being pushed to artifact registry via Cloud Build for both the profile and ping-discovery services. * Ping Discovery is being deployed with Cloud Deploy * IAM Roles and Service accounts for the Ping Discovery Service. This should hopefully be a good template for any other services that need this setup going forward. Closes #53 Closes #46 Work on #50
- Loading branch information
1 parent
755438b
commit 29a85b7
Showing
10 changed files
with
233 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
infrastructure/files/services/ping-service-account.yaml.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Copyright 2023 Google LLC All Rights Reserved. | ||
# | ||
# 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. | ||
|
||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: ping-discovery | ||
annotations: | ||
iam.gke.io/gcp-service-account: ${service_email} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Copyright 2023 Google LLC All Rights Reserved. | ||
# | ||
# 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. | ||
|
||
serviceAccount: projects/${PROJECT_ID}/serviceAccounts/cloudbuild-cicd@${PROJECT_ID}.iam.gserviceaccount.com | ||
steps: | ||
|
||
# | ||
# Building of images | ||
# | ||
|
||
- name: gcr.io/cloud-builders/docker | ||
id: ping-discovery | ||
args: ["build", ".", "-t", "${_PING_IMAGE}"] | ||
dir: ping-discovery | ||
- name: gcr.io/cloud-builders/docker | ||
id: profile | ||
args: ["build", ".", "-t", "${_REGISTRY}/profile:${BUILD_ID}"] | ||
dir: profile | ||
|
||
# | ||
# Deployment | ||
# | ||
|
||
- name: gcr.io/google.com/cloudsdktool/cloud-sdk | ||
id: cloud-deploy-release | ||
entrypoint: gcloud | ||
args: | ||
[ | ||
"deploy", "releases", "create", "${_RELEASE_NAME}", | ||
"--delivery-pipeline", "global-game-services", | ||
"--skaffold-file", "skaffold.yaml", | ||
"--skaffold-version", "1.39", | ||
"--images", "ping-discovery=${_PING_IMAGE}", | ||
"--region", "us-central1" | ||
] | ||
|
||
artifacts: | ||
images: | ||
- ${_REGISTRY}/ping-discovery | ||
- ${_REGISTRY}/profile | ||
substitutions: | ||
_PING_IMAGE: ${_REGISTRY}/ping-discovery:${BUILD_ID} | ||
_REGISTRY: us-docker.pkg.dev/${PROJECT_ID}/global-game-images | ||
_RELEASE_NAME: rel-01 | ||
options: | ||
dynamic_substitutions: true | ||
machineType: E2_HIGHCPU_8 | ||
logging: CLOUD_LOGGING_ONLY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Copyright 2023 Google LLC All Rights Reserved. | ||
# | ||
# 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. | ||
|
||
service-account.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Copyright 2023 Google LLC All Rights Reserved. | ||
# | ||
# 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. | ||
|
||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: ping-discovery | ||
spec: | ||
replicas: 3 | ||
selector: | ||
matchLabels: | ||
app: ping-discovery | ||
template: | ||
metadata: | ||
labels: | ||
app: ping-discovery | ||
spec: | ||
containers: | ||
- name: ping-discovery | ||
image: ping-discovery | ||
ports: | ||
- containerPort: 8080 | ||
serviceAccountName: ping-discovery | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: ping-discovery | ||
spec: | ||
type: ClusterIP | ||
selector: | ||
app: ping-discovery | ||
ports: | ||
- port: 80 | ||
targetPort: 8080 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Copyright 2023 Google LLC All Rights Reserved. | ||
# | ||
# 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. | ||
|
||
apiVersion: skaffold/v2beta29 | ||
kind: Config | ||
deploy: | ||
kubectl: | ||
manifests: | ||
- ping-discovery/service-account.yaml | ||
- ping-discovery/deployment.yaml |