diff --git a/api/cluster/controller.go b/api/cluster/controller.go index b54a68eea..7a838e520 100644 --- a/api/cluster/controller.go +++ b/api/cluster/controller.go @@ -252,7 +252,7 @@ func (c *controller) Deploy(ctx context.Context, modelService *models.Service) ( if c.deploymentConfig.PodDisruptionBudget.Enabled { // Create / update pdb - pdbs := createPodDisruptionBudgets(modelService, c.deploymentConfig.PodDisruptionBudget) + pdbs := generatePDBSpecs(modelService, c.deploymentConfig.PodDisruptionBudget) if err := c.deployPodDisruptionBudgets(ctx, pdbs); err != nil { log.Errorf("unable to create pdb: %v", err) return nil, errors.Wrapf(err, fmt.Sprintf("%v", ErrUnableToCreatePDB)) @@ -321,7 +321,7 @@ func (c *controller) Delete(ctx context.Context, modelService *models.Service) ( } if c.deploymentConfig.PodDisruptionBudget.Enabled { - pdbs := createPodDisruptionBudgets(modelService, c.deploymentConfig.PodDisruptionBudget) + pdbs := generatePDBSpecs(modelService, c.deploymentConfig.PodDisruptionBudget) if err := c.deletePodDisruptionBudgets(ctx, pdbs); err != nil { log.Errorf("unable to delete pdb %v", err) return nil, ErrUnableToDeletePDB diff --git a/api/cluster/pdb.go b/api/cluster/pdb.go index f26db3dfc..ac595b996 100644 --- a/api/cluster/pdb.go +++ b/api/cluster/pdb.go @@ -73,7 +73,7 @@ func (cfg PodDisruptionBudget) BuildPDBSpec() (*policyv1.PodDisruptionBudget, er return pdb, nil } -func createPodDisruptionBudgets(modelService *models.Service, pdbConfig config.PodDisruptionBudgetConfig) []*PodDisruptionBudget { +func generatePDBSpecs(modelService *models.Service, pdbConfig config.PodDisruptionBudgetConfig) []*PodDisruptionBudget { pdbs := []*PodDisruptionBudget{} // Only create PDB if: ceil(minReplica * minAvailablePercent) < minReplica diff --git a/api/cluster/pdb_test.go b/api/cluster/pdb_test.go index fcad91652..668433425 100644 --- a/api/cluster/pdb_test.go +++ b/api/cluster/pdb_test.go @@ -124,7 +124,7 @@ func TestPodDisruptionBudget_BuildPDBSpec(t *testing.T) { } } -func TestCreatePodDisruptionBudgets(t *testing.T) { +func Test_generatePDBSpecs(t *testing.T) { err := models.InitKubernetesLabeller("gojek.com/", "dev") assert.Nil(t, err) @@ -343,7 +343,7 @@ func TestCreatePodDisruptionBudgets(t *testing.T) { for name, tt := range tests { t.Run(name, func(t *testing.T) { - pdbs := createPodDisruptionBudgets(tt.modelService, tt.pdbConfig) + pdbs := generatePDBSpecs(tt.modelService, tt.pdbConfig) assert.Equal(t, tt.expected, pdbs) }) }