Skip to content

Commit 822bad0

Browse files
committed
Ignore casing on sandbox sizes
1 parent 47c2a73 commit 822bad0

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ One `RoleBinding` per name in the `owners` field. Bindings are added and removed
169169

170170
### ResourceQuota (sandbox-foo-resourcequota)
171171

172-
The `ResourceQuota` that is applied to the `Namespace` depends on the `size` of the `Sandbox` that was created.
172+
The `ResourceQuota` that is applied to the `Namespace` depends on the `size` of the `Sandbox` that was created. Defaults to `small` if no size is given.
173173

174174
#### Small
175175

@@ -193,10 +193,6 @@ The `ResourceQuota` that is applied to the `Namespace` depends on the `size` of
193193
|ResourceRequestsStorage|40Gi|
194194
|ResourcePersistentVolumeClaims|8|
195195

196-
```text
197-
NOTE: If no size is given, small is the default.
198-
```
199-
200196
## Managing Owners of a Sandbox
201197

202198
After the Sandbox has been created, you can add or remove owners that are associated to it.

controller/sandbox.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"fmt"
77
"log"
88
"os"
9+
"strings"
910

1011
operatorsv1alpha1 "github.com/plexsystems/sandbox-operator/apis/operators/v1alpha1"
1112

@@ -250,7 +251,7 @@ func getRole(sandbox operatorsv1alpha1.Sandbox) rbacv1.Role {
250251
Labels: getCommonLabels(),
251252
},
252253
Rules: []rbacv1.PolicyRule{
253-
rbacv1.PolicyRule{
254+
{
254255
Verbs: []string{"*"},
255256
APIGroups: []string{""},
256257
Resources: []string{
@@ -266,7 +267,7 @@ func getRole(sandbox operatorsv1alpha1.Sandbox) rbacv1.Role {
266267
"replicationcontrollers",
267268
},
268269
},
269-
rbacv1.PolicyRule{
270+
{
270271
Verbs: []string{"*"},
271272
APIGroups: []string{
272273
"apps",
@@ -279,20 +280,20 @@ func getRole(sandbox operatorsv1alpha1.Sandbox) rbacv1.Role {
279280
"statefulsets",
280281
},
281282
},
282-
rbacv1.PolicyRule{
283+
{
283284
Verbs: []string{"*"},
284285
APIGroups: []string{"autoscaling"},
285286
Resources: []string{"horizontalpodautoscalers"},
286287
},
287-
rbacv1.PolicyRule{
288+
{
288289
Verbs: []string{"*"},
289290
APIGroups: []string{"batch"},
290291
Resources: []string{
291292
"jobs",
292293
"cronjobs",
293294
},
294295
},
295-
rbacv1.PolicyRule{
296+
{
296297
Verbs: []string{
297298
"create",
298299
"list",
@@ -304,7 +305,7 @@ func getRole(sandbox operatorsv1alpha1.Sandbox) rbacv1.Role {
304305
"rolebindings",
305306
},
306307
},
307-
rbacv1.PolicyRule{
308+
{
308309
Verbs: []string{
309310
"create",
310311
"delete",
@@ -344,7 +345,7 @@ func getClusterRole(sandbox operatorsv1alpha1.Sandbox) rbacv1.ClusterRole {
344345
Labels: getCommonLabels(),
345346
},
346347
Rules: []rbacv1.PolicyRule{
347-
rbacv1.PolicyRule{
348+
{
348349
Verbs: []string{"*"},
349350
APIGroups: []string{"operators.plex.dev"},
350351
Resources: []string{"sandboxes"},
@@ -374,7 +375,7 @@ func getClusterRoleBinding(sandbox operatorsv1alpha1.Sandbox) rbacv1.ClusterRole
374375

375376
func getResourceQuota(sandbox operatorsv1alpha1.Sandbox) corev1.ResourceQuota {
376377
var resourceQuotaSpec corev1.ResourceQuotaSpec
377-
if sandbox.Spec.Size == "large" {
378+
if strings.EqualFold(sandbox.Spec.Size, "large") {
378379
resourceQuotaSpec = getLargeResourceQuotaSpec()
379380
} else {
380381
resourceQuotaSpec = getSmallResourceQuotaSpec()

0 commit comments

Comments
 (0)