Skip to content

Commit dc6240b

Browse files
Update base images (GoogleCloudPlatform#435)
* currencyservice: node:8-alpine --> node:12-alpine * paymentservice: node:8-alpine --> node:12-alpine * recommendationservice: python:2.7-slim --> python:3.7-slim * serviceAccountName: default * make it compliant with py3 * serviceAccountName: default * gcloud services enable cloudprofiler.googleapis.com * workload identity: add missing roles/cloudprofiler.agent role * workload identity: add missing roles/clouddebugger.agent role * update cartservice with mcr.microsoft.com/dotnet/core/sdk:3.1
1 parent c91fade commit dc6240b

File tree

13 files changed

+56
-42
lines changed

13 files changed

+56
-42
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ We offer the following installation methods:
177177
178178
```sh
179179
gcloud services enable container.googleapis.com
180+
gcloud services enable cloudprofiler.googleapis.com
180181
```
181182
182183
```sh

docs/workload-identity.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ gcloud projects add-iam-policy-binding ${PROJECT_ID} \
2121
gcloud projects add-iam-policy-binding ${PROJECT_ID} \
2222
--member "serviceAccount:${GSA_NAME}@${PROJECT_ID}.iam.gserviceaccount.com" \
2323
--role roles/monitoring.metricWriter
24+
25+
gcloud projects add-iam-policy-binding ${PROJECT_ID} \
26+
--member "serviceAccount:${GSA_NAME}@${PROJECT_ID}.iam.gserviceaccount.com" \
27+
--role roles/cloudprofiler.agent
28+
29+
gcloud projects add-iam-policy-binding ${PROJECT_ID} \
30+
--member "serviceAccount:${GSA_NAME}@${PROJECT_ID}.iam.gserviceaccount.com" \
31+
--role roles/clouddebugger.agent
2432
```
2533

2634
3. **Generate OnlineBoutique manifests** using your KSA as the Pod service account. In `kubernetes-manifests/`, replace `serviceAccountName: default` with the name of your KSA. (**Note** - sample below is Bash.)
@@ -37,4 +45,4 @@ done
3745
```bash
3846
NAMESPACE=<your-ksa-namespace>
3947
kubectl apply -n ${NAMESPACE} -f release/wi-kubernetes-manifests.yaml
40-
```
48+
```

kubernetes-manifests/recommendationservice.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ spec:
2525
labels:
2626
app: recommendationservice
2727
spec:
28+
serviceAccountName: default
2829
terminationGracePeriodSeconds: 5
2930
containers:
3031
- name: server

kubernetes-manifests/shippingservice.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ spec:
2525
labels:
2626
app: shippingservice
2727
spec:
28+
serviceAccountName: default
2829
containers:
2930
- name: server
3031
image: shippingservice

src/cartservice/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
FROM microsoft/dotnet:2.1-sdk-alpine as builder
15+
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 as builder
1616
WORKDIR /app
1717
COPY . .
1818
RUN dotnet restore && \
@@ -22,7 +22,7 @@ RUN dotnet restore && \
2222
# cartservice
2323
FROM alpine:3.8
2424

25-
RUN GRPC_HEALTH_PROBE_VERSION=v0.2.0 && \
25+
RUN GRPC_HEALTH_PROBE_VERSION=v0.3.2 && \
2626
wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 && \
2727
chmod +x /bin/grpc_health_probe
2828

src/cartservice/cartservice.csproj

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>netcoreapp2.1</TargetFramework>
5+
<TargetFramework>netcoreapp3.1</TargetFramework>
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="CommandLineParser" Version="2.2.1" />
10-
<PackageReference Include="Google.Protobuf" Version="3.6.1" />
11-
<PackageReference Include="Google.Protobuf.Tools" Version="3.5.1" />
12-
<PackageReference Include="grpc" Version="1.12.0" />
13-
<PackageReference Include="Grpc.HealthCheck" Version="1.12.0" />
14-
<PackageReference Include="grpc.tools" Version="1.12.0" />
15-
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.1.1" />
16-
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.1.1" />
17-
<PackageReference Include="StackExchange.Redis" Version="2.0.601" />
9+
<PackageReference Include="CommandLineParser" Version="2.8.0" />
10+
<PackageReference Include="Google.Protobuf" Version="3.13.0" />
11+
<PackageReference Include="Google.Protobuf.Tools" Version="3.13.0" />
12+
<PackageReference Include="grpc" Version="1.22.1" />
13+
<PackageReference Include="Grpc.HealthCheck" Version="1.22.1" />
14+
<PackageReference Include="grpc.tools" Version="1.22.1" />
15+
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.9" />
16+
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.9" />
17+
<PackageReference Include="StackExchange.Redis" Version="2.1.58" />
1818
</ItemGroup>
1919

2020
<ItemGroup>

src/cartservice/tests/cartservice.tests.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.0</TargetFramework>
4+
<TargetFramework>netcoreapp3.1</TargetFramework>
55

66
<IsPackable>false</IsPackable>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Google.Protobuf" Version="3.6.0" />
11-
<PackageReference Include="Google.Protobuf.Tools" Version="3.6.0" />
12-
<PackageReference Include="Grpc" Version="1.12.0" />
13-
<PackageReference Include="Grpc.Tools" Version="1.12.0" />
10+
<PackageReference Include="Google.Protobuf" Version="3.13.0" />
11+
<PackageReference Include="Google.Protobuf.Tools" Version="3.13.0" />
12+
<PackageReference Include="Grpc" Version="1.22.1" />
13+
<PackageReference Include="Grpc.Tools" Version="1.22.1" />
1414
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.0" />
1515
<PackageReference Include="xunit" Version="2.3.1" />
1616
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />

src/currencyservice/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
FROM node:8-alpine as base
15+
FROM node:12-alpine as base
1616

1717
FROM base as builder
1818

src/paymentservice/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
FROM node:8-alpine as base
15+
FROM node:12-alpine as base
1616

1717
FROM base as builder
1818

src/recommendationservice/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
FROM python:2.7-slim
15+
FROM python:3.7-slim
1616
RUN apt-get update -qqy && \
1717
apt-get -qqy install wget g++ && \
1818
rm -rf /var/lib/apt/lists/*

src/recommendationservice/recommendation_server.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def initStackdriverProfiling():
4646
# Environment variable not set
4747
pass
4848

49-
for retry in xrange(1,4):
49+
for retry in range(1,4):
5050
try:
5151
if project_id:
5252
googlecloudprofiler.start(service='recommendation_server', service_version='1.0.0', verbose=0, project_id=project_id)
@@ -86,6 +86,10 @@ def Check(self, request, context):
8686
return health_pb2.HealthCheckResponse(
8787
status=health_pb2.HealthCheckResponse.SERVING)
8888

89+
def Watch(self, request, context):
90+
return health_pb2.HealthCheckResponse(
91+
status=health_pb2.HealthCheckResponse.UNIMPLEMENTED)
92+
8993

9094
if __name__ == "__main__":
9195
logger.info("initializing recommendationservice")
@@ -124,7 +128,7 @@ def Check(self, request, context):
124128
module='recommendationserver',
125129
version='1.0.0'
126130
)
127-
except Exception, err:
131+
except (Exception, err):
128132
logger.error("Could not enable debugger")
129133
logger.error(traceback.print_exc())
130134
pass
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
google-api-core==1.6.0
2-
google-python-cloud-debugger==2.9
3-
grpcio-health-checking==1.13.0
4-
grpcio==1.16.1
1+
google-api-core==1.22.0
2+
google-python-cloud-debugger==2.15
3+
grpcio-health-checking==1.30.0
4+
grpcio==1.30.0
55
opencensus[stackdriver]==0.1.10
66
python-json-logger==0.1.9
77
google-cloud-profiler==1.0.8
8+
requests==2.24.0

src/recommendationservice/requirements.txt

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,31 @@
44
#
55
# pip-compile --output-file requirements.txt requirements.in
66
#
7-
cachetools==3.1.0 # via google-auth
7+
cachetools==3.1.1 # via google-auth
88
certifi==2018.11.29 # via requests
99
chardet==3.0.4 # via requests
10-
enum34==1.1.10 # via grpcio
11-
futures==3.3.0 # via google-api-core, grpcio
12-
google-api-core[grpc]==1.6.0 # via -r requirements.in, google-cloud-core, google-cloud-trace, opencensus
13-
google-api-python-client==1.7.8 # via google-cloud-profiler, google-python-cloud-debugger
14-
google-auth-httplib2==0.0.3 # via google-api-python-client, google-cloud-profiler, google-python-cloud-debugger
15-
google-auth==1.6.2 # via google-api-core, google-api-python-client, google-auth-httplib2, google-cloud-profiler, google-python-cloud-debugger
10+
google-api-core[grpc]==1.22.0 # via -r requirements.in, google-api-python-client, google-cloud-core, google-cloud-trace, opencensus
11+
google-api-python-client==1.10.0 # via google-cloud-profiler, google-python-cloud-debugger
12+
google-auth-httplib2==0.0.4 # via google-api-python-client, google-cloud-profiler, google-python-cloud-debugger
13+
google-auth==1.19.2 # via google-api-core, google-api-python-client, google-auth-httplib2, google-cloud-profiler, google-python-cloud-debugger
1614
google-cloud-core==0.29.1 # via google-cloud-trace
1715
google-cloud-profiler==1.0.8 # via -r requirements.in
1816
google-cloud-trace==0.20.2 # via opencensus
1917
google-python-cloud-debugger==2.9 # via -r requirements.in
20-
googleapis-common-protos==1.5.6 # via google-api-core
21-
grpcio-health-checking==1.13.0 # via -r requirements.in
22-
grpcio==1.16.1 # via -r requirements.in, google-api-core, grpcio-health-checking
23-
httplib2==0.18.0 # via google-api-python-client, google-auth-httplib2
24-
idna==2.8 # via requests
18+
googleapis-common-protos==1.52.0 # via google-api-core
19+
grpcio-health-checking==1.30.0 # via -r requirements.in
20+
grpcio==1.30.0 # via -r requirements.in, google-api-core, grpcio-health-checking
21+
httplib2==0.18.1 # via google-api-python-client, google-auth-httplib2
22+
idna==2.10 # via requests
2523
opencensus[stackdriver]==0.1.10 # via -r requirements.in
26-
protobuf==3.6.1 # via google-api-core, google-cloud-profiler, googleapis-common-protos, grpcio-health-checking
24+
protobuf==3.12.2 # via google-api-core, google-cloud-profiler, googleapis-common-protos, grpcio-health-checking
2725
pyasn1-modules==0.2.4 # via google-auth
2826
pyasn1==0.4.5 # via pyasn1-modules, rsa
2927
python-json-logger==0.1.9 # via -r requirements.in
3028
pytz==2018.9 # via google-api-core
3129
pyyaml==5.1 # via google-python-cloud-debugger
32-
requests==2.21.0 # via google-api-core, google-cloud-profiler
30+
requests==2.24.0 # via -r requirements.in, google-api-core
3331
rsa==4.0 # via google-auth
34-
six==1.12.0 # via google-api-core, google-api-python-client, google-auth, google-python-cloud-debugger, grpcio, protobuf
32+
six==1.12.0 # via google-api-core, google-api-python-client, google-auth, google-auth-httplib2, google-python-cloud-debugger, grpcio, protobuf
3533
uritemplate==3.0.0 # via google-api-python-client
3634
urllib3==1.24.2 # via requests

0 commit comments

Comments
 (0)