Skip to content

Commit

Permalink
Align resources naming convention
Browse files Browse the repository at this point in the history
  • Loading branch information
grzpiotrowski committed Nov 20, 2023
1 parent a0a88c2 commit 9b0edd8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
22 changes: 11 additions & 11 deletions controllers/limitador_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ var _ = Describe("Limitador controller", func() {
context.TODO(),
types.NamespacedName{
Namespace: LimitadorNamespace,
Name: limitadorObj.Name,
Name: limitador.DeploymentName(limitadorObj),
},
&createdLimitadorDeployment)

Expand Down Expand Up @@ -353,7 +353,7 @@ var _ = Describe("Limitador controller", func() {
context.TODO(),
types.NamespacedName{
Namespace: LimitadorNamespace,
Name: limitadorObj.Name,
Name: limitador.DeploymentName(limitadorObj),
},
&updatedLimitadorDeployment)

Expand Down Expand Up @@ -396,7 +396,7 @@ var _ = Describe("Limitador controller", func() {
context.TODO(),
types.NamespacedName{
Namespace: LimitadorNamespace,
Name: limitadorObj.Name,
Name: limitador.DeploymentName(limitadorObj),
},
&updatedLimitadorDeployment)

Expand Down Expand Up @@ -544,7 +544,7 @@ var _ = Describe("Limitador controller", func() {
context.TODO(),
types.NamespacedName{
Namespace: LimitadorNamespace,
Name: limitadorObj.Name,
Name: limitador.DeploymentName(limitadorObj),
},
&createdLimitadorDeployment)

Expand Down Expand Up @@ -609,7 +609,7 @@ var _ = Describe("Limitador controller", func() {
context.TODO(),
types.NamespacedName{
Namespace: LimitadorNamespace,
Name: limitadorObj.Name,
Name: limitador.DeploymentName(limitadorObj),
},
&updatedLimitadorDeployment)

Expand Down Expand Up @@ -672,7 +672,7 @@ var _ = Describe("Limitador controller", func() {
context.TODO(),
types.NamespacedName{
Namespace: LimitadorNamespace,
Name: limitadorObj.Name,
Name: limitador.DeploymentName(limitadorObj),
},
&updatedLimitadorDeployment)

Expand Down Expand Up @@ -711,7 +711,7 @@ var _ = Describe("Limitador controller", func() {
context.TODO(),
types.NamespacedName{
Namespace: LimitadorNamespace,
Name: limitadorObj.Name,
Name: limitador.DeploymentName(limitadorObj),
},
&deploymentObj)

Expand All @@ -730,7 +730,7 @@ var _ = Describe("Limitador controller", func() {
context.TODO(),
types.NamespacedName{
Namespace: LimitadorNamespace,
Name: limitadorObj.Name,
Name: limitador.DeploymentName(limitadorObj),
},
&updateDeploymentObj)

Expand Down Expand Up @@ -825,7 +825,7 @@ var _ = Describe("Limitador controller", func() {
context.TODO(),
types.NamespacedName{
Namespace: LimitadorNamespace,
Name: limitadorObj.Name,
Name: limitador.DeploymentName(limitadorObj),
},
&deploymentObj)

Expand Down Expand Up @@ -908,7 +908,7 @@ var _ = Describe("Limitador controller", func() {
context.TODO(),
types.NamespacedName{
Namespace: LimitadorNamespace,
Name: limitadorObj.Name,
Name: limitador.DeploymentName(limitadorObj),
},
&deploymentObj)

Expand Down Expand Up @@ -955,7 +955,7 @@ var _ = Describe("Limitador controller", func() {
context.TODO(),
types.NamespacedName{
Namespace: LimitadorNamespace,
Name: limitadorObj.Name,
Name: limitador.DeploymentName(limitadorObj),
},
&deploymentObj)

Expand Down
8 changes: 6 additions & 2 deletions pkg/limitador/k8s_objects.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func Deployment(limitador *limitadorv1alpha1.Limitador, deploymentOptions Deploy
APIVersion: "apps/v1",
},
ObjectMeta: metav1.ObjectMeta{
Name: limitador.ObjectMeta.Name, // TODO: revisit later. For now assume same.
Name: DeploymentName(limitador),
Namespace: limitador.ObjectMeta.Namespace, // TODO: revisit later. For now assume same.
Labels: Labels(limitador),
},
Expand Down Expand Up @@ -164,7 +164,7 @@ func LimitsConfigMap(limitadorObj *limitadorv1alpha1.Limitador) (*v1.ConfigMap,
}

func LimitsConfigMapName(limitadorObj *limitadorv1alpha1.Limitador) string {
return fmt.Sprintf("limits-config-%s", limitadorObj.Name)
return fmt.Sprintf("limitador-limits-config-%s", limitadorObj.Name)
}

func ServiceName(limitadorObj *limitadorv1alpha1.Limitador) string {
Expand All @@ -175,6 +175,10 @@ func PVCName(limitadorObj *limitadorv1alpha1.Limitador) string {
return fmt.Sprintf("limitador-%s", limitadorObj.Name)
}

func DeploymentName(limitadorObj *limitadorv1alpha1.Limitador) string {
return fmt.Sprintf("limitador-%s", limitadorObj.Name)
}

func PodDisruptionBudget(limitadorObj *limitadorv1alpha1.Limitador) *policyv1.PodDisruptionBudget {
return &policyv1.PodDisruptionBudget{
ObjectMeta: metav1.ObjectMeta{
Expand Down

0 comments on commit 9b0edd8

Please sign in to comment.