Skip to content

Commit fc03473

Browse files
Use instance.Name in creating resources
Resources created by the placement-operator are named based on the name of the PlacementAPI CR
1 parent 28b90a5 commit fc03473

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

pkg/placement/dbsync.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func DbSyncJob(
4646

4747
job := &batchv1.Job{
4848
ObjectMeta: metav1.ObjectMeta{
49-
Name: ServiceName + "-db-sync",
49+
Name: instance.Name + "-db-sync",
5050
Namespace: instance.Namespace,
5151
Labels: labels,
5252
},
@@ -60,7 +60,7 @@ func DbSyncJob(
6060
ServiceAccountName: instance.RbacResourceName(),
6161
Containers: []corev1.Container{
6262
{
63-
Name: ServiceName + "-db-sync",
63+
Name: instance.Name + "-db-sync",
6464
Command: []string{
6565
"/bin/bash",
6666
},

pkg/placement/deployment.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func Deployment(
8282

8383
deployment := &appsv1.Deployment{
8484
ObjectMeta: metav1.ObjectMeta{
85-
Name: ServiceName,
85+
Name: instance.Name,
8686
Namespace: instance.Namespace,
8787
},
8888
Spec: appsv1.DeploymentSpec{
@@ -99,7 +99,7 @@ func Deployment(
9999
ServiceAccountName: instance.RbacResourceName(),
100100
Containers: []corev1.Container{
101101
{
102-
Name: ServiceName + "-log",
102+
Name: instance.Name + "-log",
103103
Command: []string{
104104
"/usr/bin/dumb-init",
105105
},
@@ -122,7 +122,7 @@ func Deployment(
122122
LivenessProbe: livenessProbe,
123123
},
124124
{
125-
Name: ServiceName + "-api",
125+
Name: instance.Name + "-api",
126126
Command: []string{
127127
"/bin/bash",
128128
},

tests/functional/base_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ func CreateNames(placementAPIName types.NamespacedName) Names {
5454
// but based on the name of the PlacementAPI CR
5555
DBSyncJobName: types.NamespacedName{
5656
Namespace: placementAPIName.Namespace,
57-
Name: "placement-db-sync"},
57+
Name: placementAPIName.Name + "-db-sync"},
5858
MariaDBDatabaseName: placementAPIName,
5959
// FIXME(gibi): the deployment name should not be hardcoded
6060
// but based on the name of the PlacementAPI CR
6161
DeploymentName: types.NamespacedName{
6262
Namespace: placementAPIName.Namespace,
63-
Name: "placement"},
63+
Name: placementAPIName.Name},
6464
PublicServiceName: types.NamespacedName{
6565
Namespace: placementAPIName.Namespace,
6666
Name: "placement-public"},

0 commit comments

Comments
 (0)