Skip to content

Commit

Permalink
Always set the defaults.VolumeSize if its nil
Browse files Browse the repository at this point in the history
Signed-off-by: tylerslaton <[email protected]>
  • Loading branch information
tylerslaton committed Oct 5, 2023
1 parent 53caa0d commit f5b8da7
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 24 deletions.
10 changes: 6 additions & 4 deletions pkg/controller/defaults/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
internalv1 "github.com/acorn-io/runtime/pkg/apis/internal.acorn.io/v1"
"github.com/acorn-io/runtime/pkg/condition"
"github.com/acorn-io/runtime/pkg/config"
"github.com/acorn-io/z"
)

// Calculate is a handler that sets the defaults for an AppInstance to its status if
Expand All @@ -29,6 +30,11 @@ func Calculate(req router.Request, resp router.Response) (err error) {
err = nil
}
}()

if appInstance.Status.Defaults.VolumeSize == nil {
appInstance.Status.Defaults.VolumeSize = z.Pointer(internalv1.DefaultSize.DeepCopy())
}

if appInstance.Generation != appInstance.Status.ObservedGeneration {
if err = calculate(req, appInstance); err != nil {
return err
Expand Down Expand Up @@ -56,9 +62,5 @@ func calculate(req router.Request, appInstance *internalv1.AppInstance) error {
return err
}

if err = addDefaultVolumeSize(req.Ctx, req.Client, appInstance); err != nil {
return err
}

return nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ status:
"": 0
left: 0
oneimage: 0
volumeSize: 10G
namespace: app-created-namespace
staged:
appImage:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ spec:
status:
defaults:
region: local
volumeSize: 10G
observedGeneration: 1
namespace: app-created-namespace
appImage:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ spec:
status:
defaults:
region: local
volumeSize: 10G
observedGeneration: 1
namespace: app-created-namespace
appImage:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ status:
status: "True"
success: true
type: defaults
defaults: {}
defaults:
volumeSize: 10G
namespace: app-created-namespace
observedGeneration: 1
staged:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ spec:
status:
defaults:
region: local
volumeSize: 10G
observedGeneration: 1
namespace: app-created-namespace
appImage:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ spec:
status:
defaults:
region: local
volumeSize: 10G
observedGeneration: 1
namespace: app-created-namespace
appImage:
Expand Down
19 changes: 0 additions & 19 deletions pkg/controller/defaults/volumesize.go

This file was deleted.

0 comments on commit f5b8da7

Please sign in to comment.