Skip to content

Commit

Permalink
Rename parseLabels to buildLabels
Browse files Browse the repository at this point in the history
**What**
- rename parseLabels to buildLables to make the name more semantic

Signed-off-by: Lucas Roesler <[email protected]>
  • Loading branch information
LucasRoesler committed Oct 7, 2018
1 parent 8d22ce8 commit 3413f25
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion handlers/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func makeDeploymentSpec(request requests.CreateFunctionRequest, existingSecrets
}

initialReplicas := getMinReplicaCount(request.Labels)
labels := parseLabels(request.Service, request.Labels)
labels := buildLabels(request.Service, request.Labels)
nodeSelector := createSelector(request.Constraints)
resources, resourceErr := createResources(request)

Expand Down
4 changes: 2 additions & 2 deletions handlers/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ const (
FunctionVersionUID = "com.openfaas.uid"
)

// parseLabels will copy the user request labels and ensure that any required internal labels
// buildLabels will copy the user request labels and ensure that any required internal labels
// are set appropriately.
func parseLabels(functionName string, requestLables *map[string]string) map[string]string {
func buildLabels(functionName string, requestLables *map[string]string) map[string]string {
labels := map[string]string{}
if requestLables != nil {
for k, v := range *requestLables {
Expand Down
2 changes: 1 addition & 1 deletion handlers/lables_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func Test_parseLabels(t *testing.T) {

for _, s := range scenarios {
t.Run(s.name, func(t *testing.T) {
output := parseLabels(s.functionName, s.labels)
output := buildLabels(s.functionName, s.labels)
if output == nil {
t.Errorf("parseLabels should not return nil map")
}
Expand Down
2 changes: 1 addition & 1 deletion handlers/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func updateDeploymentSpec(

deployment.Spec.Template.Spec.NodeSelector = createSelector(request.Constraints)

labels := parseLabels(request.Service, request.Labels)
labels := buildLabels(request.Service, request.Labels)
labels["uid"] = fmt.Sprintf("%d", time.Now().Nanosecond())

deployment.Labels = labels
Expand Down

0 comments on commit 3413f25

Please sign in to comment.