Skip to content

Commit bf49204

Browse files
Consistent labeling for resources managed by the Application controller
1 parent c4d2909 commit bf49204

File tree

8 files changed

+30
-4
lines changed

8 files changed

+30
-4
lines changed

kubernetes/manifests/application-controller/deployment.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ spec:
1717
serviceAccountName: application-controller
1818
containers:
1919
- name: application-controller
20-
image: ghcr.io/archisman-mridha/instagram-clone-application-controller:2420c7e7f17085462ddce5bfe7eeb37f1b308c4a
20+
image: ghcr.io/archisman-mridha/instagram-clone-application-controller:0e132f1998e5208cc9c71ab60d2e70cc7d2940d3
2121
resources:
2222
requests:
2323
memory: 128Mi

kubernetes/manifests/microservices/feeds/application.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ kind: Application
33
metadata:
44
name: feeds-microservice
55
namespace: microservices
6+
labels:
7+
app: feeds-microservice
8+
app.kubernetes.io/instance: feeds-microservice
69

710
spec:
811
image: ghcr.io/archisman-mridha/instagram-clone-feeds-microservice:07db74b3dd4888026a2e852c6fca860157aa910a

kubernetes/manifests/microservices/followships/application.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ kind: Application
33
metadata:
44
name: followships-microservice
55
namespace: microservices
6+
labels:
7+
app: followships-microservice
8+
app.kubernetes.io/instance: followships-microservice
69

710
spec:
811
image: ghcr.io/archisman-mridha/instagram-clone-followships-microservice:07db74b3dd4888026a2e852c6fca860157aa910a

kubernetes/manifests/microservices/gateway/application.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ kind: Application
33
metadata:
44
name: gateway-microservice
55
namespace: microservices
6+
labels:
7+
app: gateway-microservice
8+
app.kubernetes.io/instance: gateway-microservice
69

710
spec:
811
image: ghcr.io/archisman-mridha/instagram-clone-gateway:2420c7e7f17085462ddce5bfe7eeb37f1b308c4a

kubernetes/manifests/microservices/posts/application.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ kind: Application
33
metadata:
44
name: posts-microservice
55
namespace: microservices
6+
labels:
7+
app: posts-microservice
8+
app.kubernetes.io/instance: posts-microservice
69

710
spec:
811
image: ghcr.io/archisman-mridha/instagram-clone-posts-microservice:07db74b3dd4888026a2e852c6fca860157aa910a

kubernetes/manifests/microservices/profiles/application.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ kind: Application
33
metadata:
44
name: profiles-microservice
55
namespace: microservices
6+
labels:
7+
app: profiles-microservice
8+
app.kubernetes.io/instance: profiles-microservice
69

710
spec:
811
image: ghcr.io/archisman-mridha/instagram-clone-profiles-microservice:07db74b3dd4888026a2e852c6fca860157aa910a

kubernetes/manifests/microservices/users/application.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ kind: Application
33
metadata:
44
name: users-microservice
55
namespace: microservices
6+
labels:
7+
app: users-microservice
8+
app.kubernetes.io/instance: users-microservice
69

710
spec:
811
image: ghcr.io/archisman-mridha/instagram-clone-users-microservice:07db74b3dd4888026a2e852c6fca860157aa910a

kubernetes/operators/application/pkg/controller/application.go

+11-3
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,10 @@ func (c *Controller) createOrUpdateDeployment(ctx context.Context, application *
325325
podTemplateSpecObject := coreV1.PodTemplateSpec{
326326
ObjectMeta: metav1.ObjectMeta{
327327
Labels: map[string]string{
328-
"microservice": name,
328+
"app": name,
329+
"app.kubernetes.io/instance": name,
330+
"app.kubernetes.io/part-of": name,
331+
"app.kubernetes.io/managed-by": c.name,
329332
},
330333
},
331334

@@ -365,6 +368,7 @@ func (c *Controller) createOrUpdateDeployment(ctx context.Context, application *
365368
Namespace: namespace,
366369
Labels: map[string]string{
367370
"app": name,
371+
"app.kubernetes.io/instance": name,
368372
"app.kubernetes.io/part-of": name,
369373
"app.kubernetes.io/managed-by": c.name,
370374
},
@@ -389,7 +393,7 @@ func (c *Controller) createOrUpdateDeployment(ctx context.Context, application *
389393

390394
Selector: &metav1.LabelSelector{
391395
MatchLabels: map[string]string{
392-
"microservice": name,
396+
"app": name,
393397
},
394398
},
395399

@@ -425,6 +429,8 @@ func (c *Controller) createOrUpdateHpa(ctx context.Context, application *v1alpha
425429
Name: name,
426430
Namespace: namespace,
427431
Labels: map[string]string{
432+
"app": name,
433+
"app.kubernetes.io/instance": name,
428434
"app.kubernetes.io/part-of": name,
429435
"app.kubernetes.io/managed-by": c.name,
430436
},
@@ -498,14 +504,16 @@ func (c *Controller) createOrUpdateService(ctx context.Context, application *v1a
498504
Name: name,
499505
Namespace: namespace,
500506
Labels: map[string]string{
507+
"app": name,
508+
"app.kubernetes.io/instance": name,
501509
"app.kubernetes.io/part-of": name,
502510
"app.kubernetes.io/managed-by": c.name,
503511
},
504512
},
505513

506514
Spec: coreV1.ServiceSpec{
507515
Selector: map[string]string{
508-
"microservice": name,
516+
"app": name,
509517
},
510518

511519
Ports: servicePorts,

0 commit comments

Comments
 (0)