Skip to content

Commit

Permalink
Move argsList createion into a function
Browse files Browse the repository at this point in the history
Signed-off-by: Nikhil Thomas <[email protected]>
  • Loading branch information
Nikhil Thomas committed Mar 12, 2020
1 parent b48dc9f commit 7088fa4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module github.com/nikhil-thomas/icndb-app-operator

require (
github.com/NYTimes/gziphandler v1.0.1 // indirect
github.com/operator-framework/operator-sdk v0.10.1-0.20190911145116-334c667503d0
github.com/spf13/pflag v1.0.3
google.golang.org/api v0.3.0
Expand Down Expand Up @@ -29,3 +28,5 @@ replace (
)

replace github.com/operator-framework/operator-sdk => github.com/operator-framework/operator-sdk v0.9.0

go 1.13
26 changes: 16 additions & 10 deletions pkg/controller/funapp/funapp_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,17 +198,8 @@ func (r *ReconcileFunApp) deploymentForFunApp(fa *icndbfunv1alpha1.FunApp) *apps
ls := labelsForFunApp(fa.Name)
replicas := fa.Spec.Funpods

names := ""
for _, param := range fa.Spec.Params {
if strings.EqualFold(param.Key, "Name") {
if names != "" {
names += ","
}
names += param.Value

}
}
args := []string{"--names", names}
args := getPeopleNames(fa)

reqLogger.Info("::::::::::::::::", "ards:", args )

Expand Down Expand Up @@ -282,4 +273,19 @@ func getPodNames(pods []corev1.Pod) []string {
podNames = append(podNames, pod.Name)
}
return podNames
}

func getPeopleNames(fa *icndbfunv1alpha1.FunApp) []string {
names := ""
for _, param := range fa.Spec.Params {
if strings.EqualFold(param.Key, "Name") {
if names != "" {
names += ","
}
names += param.Value

}
}
args := []string{"--names", names}
return args
}

0 comments on commit 7088fa4

Please sign in to comment.