Skip to content

Commit

Permalink
Merge pull request #98 from GrahamDumpleton/change-capacity-defaults
Browse files Browse the repository at this point in the history
Set capacity as 0 if not provided and don't cap values.
  • Loading branch information
GrahamDumpleton authored Sep 13, 2023
2 parents 28e0b0e + b28e3c9 commit cb77d13
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions client-programs/pkg/cmd/cluster_workshop_deploy_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,38 +321,6 @@ func deployWorkshopResource(client dynamic.Interface, workshop *unstructured.Uns
})
}

var propertyExists bool

var sessionsMaximum int64 = 1

if trainingPortalExists {
sessionsMaximum, propertyExists, err = unstructured.NestedInt64(trainingPortal.Object, "spec", "portal", "sessions", "maximum")

if err == nil && propertyExists {
if sessionsMaximum >= 0 && uint(sessionsMaximum) < capacity {
capacity = uint(sessionsMaximum)
}
}
} else {
capacity = 1
}

if capacity != 0 {
if reserved > capacity {
reserved = capacity
}
if initial > capacity {
initial = capacity
}
} else if sessionsMaximum != 0 {
if reserved > uint(sessionsMaximum) {
reserved = uint(sessionsMaximum)
}
if initial > uint(sessionsMaximum) {
initial = uint(sessionsMaximum)
}
}

workshops, _, err := unstructured.NestedSlice(trainingPortal.Object, "spec", "workshops")

if err != nil {
Expand Down

0 comments on commit cb77d13

Please sign in to comment.