Skip to content

Commit b0244db

Browse files
committed
Restructure k8s yaml files in service mode
1 parent 46674cb commit b0244db

File tree

19 files changed

+398
-392
lines changed

19 files changed

+398
-392
lines changed

kubernetes/base/resources/grafana-alloy/deployment.yaml renamed to kubernetes/base/alloy/alloy.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
---
2+
apiVersion: v1
3+
kind: ServiceAccount
4+
metadata:
5+
name: grafana-alloy
6+
---
7+
apiVersion: rbac.authorization.k8s.io/v1
8+
kind: RoleBinding
9+
metadata:
10+
name: grafana-alloy
11+
roleRef:
12+
apiGroup: rbac.authorization.k8s.io
13+
kind: ClusterRole
14+
name: view
15+
subjects:
16+
- kind: ServiceAccount
17+
name: grafana-alloy
18+
---
119
apiVersion: apps/v1
220
kind: Deployment
321
metadata:
@@ -43,3 +61,20 @@ spec:
4361
- name: alloy-config
4462
configMap:
4563
name: alloy-config
64+
---
65+
apiVersion: v1
66+
kind: Service
67+
metadata:
68+
name: grafana-alloy
69+
labels:
70+
app.k8s.io/name: grafana-alloy
71+
spec:
72+
selector:
73+
app.k8s.io/name: grafana-alloy
74+
ports:
75+
- port: 4317
76+
name: grpc
77+
targetPort: grpc
78+
- port: 4318
79+
name: http
80+
targetPort: http

kubernetes/base/resources/grafana-alloy/kustomization.yaml renamed to kubernetes/base/alloy/kustomization.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,4 @@ apiVersion: kustomize.config.k8s.io/v1beta1
22
kind: Kustomization
33

44
resources:
5-
- deployment.yaml
6-
- service.yaml
7-
- rbac.yaml
5+
- alloy.yaml
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: quickpizza-catalog
6+
labels: &catalogLabels
7+
app.k8s.io/name: quickpizza
8+
app.kubernetes.io/component: service
9+
app.kubernetes.io/instance: catalog
10+
spec:
11+
replicas: 1
12+
selector:
13+
matchLabels: *catalogLabels
14+
template:
15+
metadata:
16+
labels: *catalogLabels
17+
spec:
18+
restartPolicy: Always
19+
containers:
20+
- name: quickpizza
21+
image: ghcr.io/grafana/quickpizza-local:latest
22+
imagePullPolicy: IfNotPresent
23+
ports:
24+
- name: http
25+
containerPort: 3333
26+
envFrom:
27+
- configMapRef:
28+
name: quickpizza-env-common
29+
- configMapRef:
30+
name: quickpizza-env
31+
optional: true
32+
env:
33+
- name: QUICKPIZZA_CATALOG
34+
value: "1"
35+
- name: QUICKPIZZA_OTEL_SERVICE_INSTANCE_ID
36+
valueFrom:
37+
fieldRef:
38+
fieldPath: metadata.name
39+
- name: QUICKPIZZA_OTEL_SERVICE_NAME
40+
valueFrom:
41+
fieldRef:
42+
fieldPath: metadata.labels['app.kubernetes.io/instance']
43+
---
44+
apiVersion: v1
45+
kind: Service
46+
metadata:
47+
name: quickpizza-catalog
48+
spec:
49+
type: ClusterIP
50+
selector:
51+
app.k8s.io/name: quickpizza
52+
app.kubernetes.io/instance: catalog
53+
ports:
54+
- protocol: TCP
55+
port: 3333
56+
targetPort: 3333
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: quickpizza-config
6+
labels: &configLabels
7+
app.k8s.io/name: quickpizza
8+
app.kubernetes.io/component: service
9+
app.kubernetes.io/instance: config
10+
spec:
11+
replicas: 1
12+
selector:
13+
matchLabels: *configLabels
14+
template:
15+
metadata:
16+
labels: *configLabels
17+
spec:
18+
restartPolicy: Always
19+
containers:
20+
- name: quickpizza
21+
image: ghcr.io/grafana/quickpizza-local:latest
22+
imagePullPolicy: IfNotPresent
23+
ports:
24+
- name: http
25+
containerPort: 3333
26+
envFrom:
27+
- configMapRef:
28+
name: quickpizza-env-common
29+
- configMapRef:
30+
name: quickpizza-env
31+
optional: true
32+
env:
33+
- name: QUICKPIZZA_CONFIG
34+
value: "1"
35+
- name: QUICKPIZZA_OTEL_SERVICE_INSTANCE_ID
36+
valueFrom:
37+
fieldRef:
38+
fieldPath: metadata.name
39+
- name: QUICKPIZZA_OTEL_SERVICE_NAME
40+
valueFrom:
41+
fieldRef:
42+
fieldPath: metadata.labels['app.kubernetes.io/instance']
43+
---
44+
apiVersion: v1
45+
kind: Service
46+
metadata:
47+
name: quickpizza-config
48+
spec:
49+
type: ClusterIP
50+
selector:
51+
app.k8s.io/name: quickpizza
52+
app.kubernetes.io/instance: config
53+
ports:
54+
- protocol: TCP
55+
port: 3333
56+
targetPort: 3333
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: quickpizza-copy
6+
labels: &copyLabels
7+
app.k8s.io/name: quickpizza
8+
app.kubernetes.io/component: service
9+
app.kubernetes.io/instance: copy
10+
spec:
11+
replicas: 1
12+
selector:
13+
matchLabels: *copyLabels
14+
template:
15+
metadata:
16+
labels: *copyLabels
17+
spec:
18+
restartPolicy: Always
19+
containers:
20+
- name: quickpizza
21+
image: ghcr.io/grafana/quickpizza-local:latest
22+
imagePullPolicy: IfNotPresent
23+
ports:
24+
- name: http
25+
containerPort: 3333
26+
envFrom:
27+
- configMapRef:
28+
name: quickpizza-env-common
29+
- configMapRef:
30+
name: quickpizza-env
31+
optional: true
32+
env:
33+
- name: QUICKPIZZA_COPY
34+
value: "1"
35+
- name: QUICKPIZZA_OTEL_SERVICE_INSTANCE_ID
36+
valueFrom:
37+
fieldRef:
38+
fieldPath: metadata.name
39+
- name: QUICKPIZZA_OTEL_SERVICE_NAME
40+
valueFrom:
41+
fieldRef:
42+
fieldPath: metadata.labels['app.kubernetes.io/instance']
43+
---
44+
apiVersion: v1
45+
kind: Service
46+
metadata:
47+
name: quickpizza-copy
48+
spec:
49+
type: ClusterIP
50+
selector:
51+
app.k8s.io/name: quickpizza
52+
app.kubernetes.io/instance: copy
53+
ports:
54+
- protocol: TCP
55+
port: 3333
56+
targetPort: 3333
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
# unique name for this deployment resource
6+
name: quickpizza-frontend
7+
labels: &frontendLabels
8+
# application name: groups all related resources
9+
app.k8s.io/name: quickpizza
10+
# component type: defines the role of this deployment
11+
app.kubernetes.io/component: service
12+
# instance id: used for service discovery and telemetry (service.name/service_name attrs)
13+
app.kubernetes.io/instance: frontend-gateway
14+
spec:
15+
replicas: 1
16+
selector:
17+
matchLabels: *frontendLabels
18+
template:
19+
metadata:
20+
labels: *frontendLabels
21+
spec:
22+
restartPolicy: Always
23+
containers:
24+
- name: quickpizza
25+
image: ghcr.io/grafana/quickpizza-local:latest
26+
imagePullPolicy: IfNotPresent
27+
ports:
28+
- name: http
29+
containerPort: 3333
30+
envFrom:
31+
- configMapRef:
32+
name: quickpizza-env-common
33+
- configMapRef:
34+
name: quickpizza-env
35+
optional: true
36+
env:
37+
- name: QUICKPIZZA_FRONTEND
38+
value: "1"
39+
- name: QUICKPIZZA_OTEL_SERVICE_INSTANCE_ID
40+
valueFrom:
41+
fieldRef:
42+
fieldPath: metadata.name
43+
- name: QUICKPIZZA_OTEL_SERVICE_NAME
44+
valueFrom:
45+
fieldRef:
46+
fieldPath: metadata.labels['app.kubernetes.io/instance']
47+
---
48+
apiVersion: v1
49+
kind: Service
50+
metadata:
51+
name: quickpizza-frontend
52+
spec:
53+
type: LoadBalancer
54+
selector:
55+
app.k8s.io/name: quickpizza
56+
app.kubernetes.io/instance: frontend-gateway
57+
ports:
58+
- protocol: TCP
59+
port: 3333
60+
targetPort: 3333
61+
nodePort: 30333

kubernetes/base/kustomization.yaml renamed to kubernetes/base/quickpizza/kustomization.yaml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22
# namespace: quickpizza
33

44
resources:
5-
- ./resources/deployments.yaml
6-
- ./resources/services.yaml
5+
- catalog.yaml
6+
- config.yaml
7+
- copy.yaml
8+
- frontend-gateway.yaml
9+
- recommendations.yaml
10+
- ws.yaml
711

812
# To use a custom image (e.g., locally built), uncomment `newName` and `newTag` below.
913
# Example: docker build -t local-quickpizza:latest . && minikube image load local-quickpizza:latest
@@ -20,10 +24,8 @@ configMapGenerator:
2024
literals:
2125
# Trust all incoming TraceIDs for demo purposes
2226
- QUICKPIZZA_TRUST_CLIENT_TRACEID=true
23-
# Disable to run microservice mode
27+
# Microservice mode: Set to 0 to run services in separate pods
2428
- QUICKPIZZA_ALL_SERVICES=0
25-
# Set service.name: frontend, config, gateway, catalog, users, admin, copy, recommendations
26-
- QUICKPIZZA_OTEL_SERVICE_NAME_LEGACY=1
2729
- QUICKPIZZA_CATALOG_ENDPOINT=http://quickpizza-catalog:3333
2830
- QUICKPIZZA_COPY_ENDPOINT=http://quickpizza-copy:3333
2931
- QUICKPIZZA_WS_ENDPOINT=http://quickpizza-ws:3333
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: quickpizza-recommendations
6+
labels: &recommendationsLabels
7+
app.k8s.io/name: quickpizza
8+
app.kubernetes.io/component: service
9+
app.kubernetes.io/instance: recommendations
10+
spec:
11+
replicas: 1
12+
selector:
13+
matchLabels: *recommendationsLabels
14+
template:
15+
metadata:
16+
labels: *recommendationsLabels
17+
spec:
18+
restartPolicy: Always
19+
containers:
20+
- name: quickpizza
21+
image: ghcr.io/grafana/quickpizza-local:latest
22+
imagePullPolicy: IfNotPresent
23+
ports:
24+
- name: http
25+
containerPort: 3333
26+
envFrom:
27+
- configMapRef:
28+
name: quickpizza-env-common
29+
- configMapRef:
30+
name: quickpizza-env
31+
optional: true
32+
env:
33+
- name: QUICKPIZZA_RECOMMENDATIONS
34+
value: "1"
35+
- name: QUICKPIZZA_OTEL_SERVICE_INSTANCE_ID
36+
valueFrom:
37+
fieldRef:
38+
fieldPath: metadata.name
39+
- name: QUICKPIZZA_OTEL_SERVICE_NAME
40+
valueFrom:
41+
fieldRef:
42+
fieldPath: metadata.labels['app.kubernetes.io/instance']
43+
---
44+
apiVersion: v1
45+
kind: Service
46+
metadata:
47+
name: quickpizza-recommendations
48+
spec:
49+
type: ClusterIP
50+
selector:
51+
app.k8s.io/name: quickpizza
52+
app.kubernetes.io/instance: recommendations
53+
ports:
54+
- protocol: TCP
55+
port: 3333
56+
targetPort: 3333

0 commit comments

Comments
 (0)