Skip to content
This repository was archived by the owner on Mar 16, 2024. It is now read-only.

Commit c8c3796

Browse files
committed
Add VolmueSize to Defaults section of AppInstanceStatus
Signed-off-by: tylerslaton <mtslaton1@gmail.com>
1 parent d95381a commit c8c3796

File tree

22 files changed

+58
-7
lines changed

22 files changed

+58
-7
lines changed

pkg/apis/internal.acorn.io/v1/appinstance.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"strings"
77

88
corev1 "k8s.io/api/core/v1"
9+
"k8s.io/apimachinery/pkg/api/resource"
910
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1011
)
1112

@@ -222,9 +223,10 @@ type AppStatusStaged struct {
222223
}
223224

224225
type Defaults struct {
225-
Volumes map[string]VolumeDefault `json:"volumes,omitempty"`
226-
Memory map[string]*int64 `json:"memory,omitempty"`
227-
Region string `json:"region,omitempty"`
226+
VolumeSize *resource.Quantity `json:"volumeSize,omitempty"`
227+
Volumes map[string]VolumeDefault `json:"volumes,omitempty"`
228+
Memory map[string]*int64 `json:"memory,omitempty"`
229+
Region string `json:"region,omitempty"`
228230
}
229231

230232
type VolumeDefault struct {

pkg/apis/internal.acorn.io/v1/zz_generated.deepcopy.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/controller/defaults/defaults.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package defaults
33
import (
44
"github.com/acorn-io/baaah/pkg/router"
55
internalv1 "github.com/acorn-io/runtime/pkg/apis/internal.acorn.io/v1"
6-
v1 "github.com/acorn-io/runtime/pkg/apis/internal.acorn.io/v1"
76
"github.com/acorn-io/runtime/pkg/condition"
87
"github.com/acorn-io/runtime/pkg/config"
98
)
@@ -16,8 +15,8 @@ import (
1615
// calculating the defaults only when the generation changes, we can ensure that
1716
// updated defaults are only applied when an AppInstance is updated directly.
1817
func Calculate(req router.Request, resp router.Response) (err error) {
19-
appInstance := req.Object.(*v1.AppInstance)
20-
status := condition.Setter(appInstance, resp, v1.AppInstanceConditionDefaults)
18+
appInstance := req.Object.(*internalv1.AppInstance)
19+
status := condition.Setter(appInstance, resp, internalv1.AppInstanceConditionDefaults)
2120

2221
defer func() {
2322
if err == nil {
@@ -57,5 +56,9 @@ func calculate(req router.Request, appInstance *internalv1.AppInstance) error {
5756
return err
5857
}
5958

59+
if err = addDefaultVolumeSize(req.Ctx, req.Client, appInstance); err != nil {
60+
return err
61+
}
62+
6063
return nil
6164
}

pkg/controller/defaults/testdata/memory/all-set-overwrite/expected.golden

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ status:
5050
left: 0
5151
oneimage: 0
5252
region: local
53+
volumeSize: 10G
5354
namespace: app-created-namespace
5455
observedGeneration: 1
5556
staged:

pkg/controller/defaults/testdata/memory/all-set/expected.golden

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ status:
4949
left: 0
5050
oneimage: 0
5151
region: local
52+
volumeSize: 10G
5253
namespace: app-created-namespace
5354
observedGeneration: 1
5455
staged:

pkg/controller/defaults/testdata/memory/container/expected.golden

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ status:
4949
left: 0
5050
oneimage: 0
5151
region: local
52+
volumeSize: 10G
5253
namespace: app-created-namespace
5354
observedGeneration: 1
5455
staged:

pkg/controller/defaults/testdata/memory/job/expected.golden

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ status:
4949
left: 0
5050
oneimage: 0
5151
region: local
52+
volumeSize: 10G
5253
namespace: app-created-namespace
5354
observedGeneration: 1
5455
staged:

pkg/controller/defaults/testdata/memory/overwrite-acornfile-memory/expected.golden

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ status:
5050
left: 0
5151
oneimage: 0
5252
region: local
53+
volumeSize: 10G
5354
namespace: app-created-namespace
5455
observedGeneration: 1
5556
staged:

pkg/controller/defaults/testdata/memory/sidecar/expected.golden

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ status:
4949
left: 0
5050
oneimage: 0
5151
region: local
52+
volumeSize: 10G
5253
namespace: app-created-namespace
5354
observedGeneration: 1
5455
staged:

pkg/controller/defaults/testdata/memory/two-containers/expected.golden

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ status:
5151
oneimage: 0
5252
twoimage: 0
5353
region: local
54+
volumeSize: 10G
5455
namespace: app-created-namespace
5556
observedGeneration: 1
5657
staged:

0 commit comments

Comments
 (0)