Skip to content

Commit 79b307f

Browse files
Merge pull request #184 from anveshmuppeda/feature/microservicesdemo
Feature/microservicesdemo | MicroServices Demo | AdService - Docker Build
2 parents 770a4a6 + 013e20c commit 79b307f

File tree

204 files changed

+41191
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

204 files changed

+41191
-1
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# .github/workflows/docker-build-push.yaml
2+
name: MicroServices Demo | AdService - Docker Build
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
version:
8+
description: 'Version to use for the Docker image'
9+
required: true
10+
default: 'v1.0.0'
11+
type: choice
12+
options:
13+
- v1.0.0
14+
- v1.0.1
15+
- v1.0.2
16+
push:
17+
branches:
18+
- main
19+
- feature/docs_update
20+
- feature/microservicesdemo
21+
paths:
22+
- 'projects/microservices-demo/src/adservice/Dockerfile'
23+
24+
jobs:
25+
build-push-update:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout code (with all branches)
29+
uses: actions/checkout@v3
30+
with:
31+
fetch-depth: 0
32+
ref: feature/microservicesdemo
33+
34+
- name: Prepare version
35+
id: prep
36+
run: |
37+
if [[ ${{ github.event_name }} == 'workflow_dispatch' ]]; then
38+
VERSION=${{ github.event.inputs.version }}
39+
else
40+
VERSION=${GITHUB_SHA::8}
41+
fi
42+
BUILD_IMAGE=true
43+
echo "VERSION=$VERSION" >> $GITHUB_ENV
44+
echo "IMAGE=anvesh35/microservices-demo-adservice:$VERSION" >> $GITHUB_ENV
45+
echo "LATESTIMAGE=anvesh35/microservices-demo-adservice:latest" >> $GITHUB_ENV
46+
echo "BUILD_IMAGE=$BUILD_IMAGE" >> $GITHUB_ENV
47+
48+
- name: Set up Docker Buildx
49+
if: env.BUILD_IMAGE == 'true'
50+
uses: docker/setup-buildx-action@v2
51+
52+
- name: Login to Docker Hub
53+
if: env.BUILD_IMAGE == 'true'
54+
uses: docker/login-action@v2
55+
with:
56+
username: ${{ secrets.DOCKERHUB_USERNAME }}
57+
password: ${{ secrets.DOCKERHUB_TOKEN }}
58+
59+
- name: Build and push k8s-tools Docker image
60+
if: env.BUILD_IMAGE == 'true'
61+
uses: docker/build-push-action@v4
62+
with:
63+
context: projects/microservices-project/src/adservice/
64+
file: projects/microservices-project/src/adservice/Dockerfile
65+
push: true
66+
tags: ${{ env.IMAGE }}
67+
platforms: linux/amd64,linux/arm64
68+
build-args: |
69+
VERSION=${{ env.VERSION }}
70+

docs/014-storage/001-csi-ephemeral-storage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ kubectl label node ip-10-0-236-77.ec2.internal csidriver-
246246

247247
The CSI HostPath driver is a fantastic educational tool. By using it, we've demystified the entire lifecycle of Kubernetes storage—from installing a driver and provisioning ephemeral volumes to understanding bind mounts and managing persistent claims. While you'd never use it for your critical applications, the knowledge you gain from it is invaluable for mastering storage in any Kubernetes environment.
248248

249-
## references
249+
## References
250250
1. [CSI HostPath Driver](https://github.com/kubernetes-csi/csi-driver-host-path/tree/master)
251251
2. [Kubernetes CSI Documentation](https://kubernetes.io/docs/concepts/storage/ephemeral-volumes/#csi-ephemeral-volumes)
252252
3. [Kubernetes CSI Ephemeral Volumes](https://kubernetes-csi.github.io/docs/example.html)

projects/README.MD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# List of Projects
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# ./kubernetes-manifests
2+
3+
:warning: Kubernetes manifests provided in this directory are not directly
4+
deployable to a cluster. They are meant to be used with `skaffold` command to
5+
insert the correct `image:` tags.
6+
7+
Use the manifests in [/release](/release) directory which are configured with
8+
pre-built public images.
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Copyright 2018 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
apiVersion: apps/v1
16+
kind: Deployment
17+
metadata:
18+
name: adservice
19+
labels:
20+
app: adservice
21+
spec:
22+
selector:
23+
matchLabels:
24+
app: adservice
25+
template:
26+
metadata:
27+
labels:
28+
app: adservice
29+
spec:
30+
serviceAccountName: adservice
31+
terminationGracePeriodSeconds: 5
32+
securityContext:
33+
fsGroup: 1000
34+
runAsGroup: 1000
35+
runAsNonRoot: true
36+
runAsUser: 1000
37+
containers:
38+
- name: server
39+
securityContext:
40+
allowPrivilegeEscalation: false
41+
capabilities:
42+
drop:
43+
- ALL
44+
privileged: false
45+
readOnlyRootFilesystem: true
46+
image: adservice
47+
ports:
48+
- containerPort: 9555
49+
env:
50+
- name: PORT
51+
value: "9555"
52+
resources:
53+
requests:
54+
cpu: 200m
55+
memory: 180Mi
56+
limits:
57+
cpu: 300m
58+
memory: 300Mi
59+
readinessProbe:
60+
initialDelaySeconds: 20
61+
periodSeconds: 15
62+
grpc:
63+
port: 9555
64+
livenessProbe:
65+
initialDelaySeconds: 20
66+
periodSeconds: 15
67+
grpc:
68+
port: 9555
69+
---
70+
apiVersion: v1
71+
kind: Service
72+
metadata:
73+
name: adservice
74+
labels:
75+
app: adservice
76+
spec:
77+
type: ClusterIP
78+
selector:
79+
app: adservice
80+
ports:
81+
- name: grpc
82+
port: 9555
83+
targetPort: 9555
84+
---
85+
apiVersion: v1
86+
kind: ServiceAccount
87+
metadata:
88+
name: adservice
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
# Copyright 2018 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
apiVersion: apps/v1
16+
kind: Deployment
17+
metadata:
18+
name: cartservice
19+
labels:
20+
app: cartservice
21+
spec:
22+
selector:
23+
matchLabels:
24+
app: cartservice
25+
template:
26+
metadata:
27+
labels:
28+
app: cartservice
29+
spec:
30+
serviceAccountName: cartservice
31+
terminationGracePeriodSeconds: 5
32+
securityContext:
33+
fsGroup: 1000
34+
runAsGroup: 1000
35+
runAsNonRoot: true
36+
runAsUser: 1000
37+
containers:
38+
- name: server
39+
securityContext:
40+
allowPrivilegeEscalation: false
41+
capabilities:
42+
drop:
43+
- ALL
44+
privileged: false
45+
readOnlyRootFilesystem: true
46+
image: cartservice
47+
ports:
48+
- containerPort: 7070
49+
env:
50+
- name: REDIS_ADDR
51+
value: "redis-cart:6379"
52+
resources:
53+
requests:
54+
cpu: 200m
55+
memory: 64Mi
56+
limits:
57+
cpu: 300m
58+
memory: 128Mi
59+
readinessProbe:
60+
initialDelaySeconds: 15
61+
grpc:
62+
port: 7070
63+
livenessProbe:
64+
initialDelaySeconds: 15
65+
periodSeconds: 10
66+
grpc:
67+
port: 7070
68+
---
69+
apiVersion: v1
70+
kind: Service
71+
metadata:
72+
name: cartservice
73+
labels:
74+
app: cartservice
75+
spec:
76+
type: ClusterIP
77+
selector:
78+
app: cartservice
79+
ports:
80+
- name: grpc
81+
port: 7070
82+
targetPort: 7070
83+
---
84+
apiVersion: v1
85+
kind: ServiceAccount
86+
metadata:
87+
name: cartservice
88+
---
89+
apiVersion: apps/v1
90+
kind: Deployment
91+
metadata:
92+
name: redis-cart
93+
labels:
94+
app: redis-cart
95+
spec:
96+
selector:
97+
matchLabels:
98+
app: redis-cart
99+
template:
100+
metadata:
101+
labels:
102+
app: redis-cart
103+
spec:
104+
securityContext:
105+
fsGroup: 1000
106+
runAsGroup: 1000
107+
runAsNonRoot: true
108+
runAsUser: 1000
109+
containers:
110+
- name: redis
111+
securityContext:
112+
allowPrivilegeEscalation: false
113+
capabilities:
114+
drop:
115+
- ALL
116+
privileged: false
117+
readOnlyRootFilesystem: true
118+
image: redis:alpine
119+
ports:
120+
- containerPort: 6379
121+
readinessProbe:
122+
periodSeconds: 5
123+
tcpSocket:
124+
port: 6379
125+
livenessProbe:
126+
periodSeconds: 5
127+
tcpSocket:
128+
port: 6379
129+
volumeMounts:
130+
- mountPath: /data
131+
name: redis-data
132+
resources:
133+
limits:
134+
memory: 256Mi
135+
cpu: 125m
136+
requests:
137+
cpu: 70m
138+
memory: 200Mi
139+
volumes:
140+
- name: redis-data
141+
emptyDir: {}
142+
---
143+
apiVersion: v1
144+
kind: Service
145+
metadata:
146+
name: redis-cart
147+
labels:
148+
app: redis-cart
149+
spec:
150+
type: ClusterIP
151+
selector:
152+
app: redis-cart
153+
ports:
154+
- name: tcp-redis
155+
port: 6379
156+
targetPort: 6379

0 commit comments

Comments
 (0)