Skip to content

Commit

Permalink
Merge pull request #24 from moficodes/multizon-deploy
Browse files Browse the repository at this point in the history
multizone support fix tests
  • Loading branch information
moficodes authored Aug 10, 2020
2 parents 6d21f6d + da1f57a commit 1f0b85e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
16 changes: 8 additions & 8 deletions internals/cron/cloudfoundry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ import (
)

func TestGetCommentString(t *testing.T) {
request := ibmcloud.ClusterRequest{
DataCenter: "dal10",
request := ibmcloud.ScheduleRequest{
DataCenters: []string{"dal10"},
MachineType: "4X16",
MasterVersion: "iks16.7",
WorkerNum: 1,
}

createRequest := ibmcloud.CreateClusterRequest{
ClusterRequest: request,
scheduleRequest := ibmcloud.ScheduleClusterRequest{
ScheduleRequest: request,
}

schedule := ibmcloud.Schedule{
Count: "5",
CreateRequest: createRequest,
EventName: "mofisapp",
Password: "ikslab",
Count: "5",
ScheduleRequest: scheduleRequest,
EventName: "mofisapp",
Password: "ikslab",
}

comment, err := getCommentString(schedule, "../../templates/message.gotmpl")
Expand Down
9 changes: 5 additions & 4 deletions internals/cron/cron.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ func checkCloudant() {
// for each cluster loop through and create cluster, ignore error for now.
for i := 1; i <= count; i++ {
datacenters := schedule.ScheduleRequest.ScheduleRequest.DataCenters
vlans, err := session.GetDatacenterVlan()
datacenter := datacenters[i%len(datacenters)]
vlans, err := session.GetDatacenterVlan(datacenter)
if err != nil {
// could not get vlan
// skip the scheduling
Expand Down Expand Up @@ -248,13 +249,13 @@ func checkCloudant() {
schedule.Clusters = append(schedule.Clusters, response.ID)

for _, tag := range tags {
_, err := session.SetClusterTag(tag, response.ID, schedule.CreateRequest.ResourceGroup)
_, err := session.SetClusterTag(tag, response.ID, schedule.ScheduleRequest.ResourceGroup)
if err != nil {
log.Println("error setting tag : investigate ", schedule.CreateRequest.ClusterRequest.Name, err)
log.Println("error setting tag : investigate ", schedule.ScheduleRequest.ScheduleRequest.Name, err)
hasErrors = true
schedError := ScheduleError{
Error: err,
Message: fmt.Sprintf("Error creting tag %s for cluster %s", tag, schedule.CreateRequest.ClusterRequest.Name),
Message: fmt.Sprintf("Error creting tag %s for cluster %s", tag, schedule.ScheduleRequest.ScheduleRequest.Name),
}
emailData.Errors = append(emailData.Errors, schedError)
continue
Expand Down
6 changes: 3 additions & 3 deletions templates/message.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

Key: `{{ .Password }}`

Region: {{ .CreateRequest.ClusterRequest.DataCenter }}
Region: {{ .ScheduleRequest.ScheduleRequest.DataCenters }}
Clusters: {{ .Count }}
Workers: {{ .CreateRequest.ClusterRequest.WorkerNum }} x {{ $.CreateRequest.ClusterRequest.MachineType }}
K8s Version: {{ .CreateRequest.ClusterRequest.MasterVersion }}
Workers: {{ .ScheduleRequest.ScheduleRequest.WorkerNum }} x {{ $.ScheduleRequest.ScheduleRequest.MachineType }}
K8s Version: {{ .ScheduleRequest.ScheduleRequest.MasterVersion }}

## Note
- Please be sure to click: `Prefill Cache` button on the URL before your lab
Expand Down

0 comments on commit 1f0b85e

Please sign in to comment.