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

Commit 8f11301

Browse files
Merge pull request #1223 from ibuildthecloud/aml-move-out
Move all cue logic to github.com/acorn-io/aml
2 parents f95cfc9 + bb693d5 commit 8f11301

File tree

24 files changed

+99
-1237
lines changed

24 files changed

+99
-1237
lines changed

go.mod

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ replace (
1616
require (
1717
cuelang.org/go v0.4.3
1818
github.com/AlecAivazis/survey/v2 v2.3.6
19-
github.com/acorn-io/aml v0.0.0-20220717003025-bc8cb1214693
19+
github.com/acorn-io/aml v0.0.0-20230213221153-200432c87a1c
2020
github.com/acorn-io/baaah v0.0.0-20230210045136-282f5388cca5
2121
github.com/acorn-io/mink v0.0.0-20230206230657-e1bd552f1bd4
2222
github.com/acorn-io/namegenerator v0.0.0-20220915160418-9e3d5a0ffe78
@@ -86,7 +86,7 @@ require (
8686
github.com/bmatcuk/doublestar v1.1.1 // indirect
8787
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
8888
github.com/cespare/xxhash/v2 v2.1.2 // indirect
89-
github.com/cockroachdb/apd/v2 v2.0.1 // indirect
89+
github.com/cockroachdb/apd/v2 v2.0.2 // indirect
9090
github.com/containerd/continuity v0.3.0 // indirect
9191
github.com/containerd/stargz-snapshotter/estargz v0.12.1 // indirect
9292
github.com/containerd/typeurl v1.0.2 // indirect
@@ -97,7 +97,7 @@ require (
9797
github.com/docker/distribution v2.8.1+incompatible // indirect
9898
github.com/docker/docker v20.10.21+incompatible // indirect
9999
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
100-
github.com/emicklei/proto v1.6.15 // indirect
100+
github.com/emicklei/proto v1.10.0 // indirect
101101
github.com/emirpasic/gods v1.12.0 // indirect
102102
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
103103
github.com/felixge/httpsnoop v1.0.2 // indirect
@@ -132,7 +132,6 @@ require (
132132
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
133133
github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd // indirect
134134
github.com/klauspost/compress v1.15.11 // indirect
135-
github.com/lib/pq v1.10.2 // indirect
136135
github.com/lithammer/fuzzysearch v1.1.5 // indirect
137136
github.com/loft-sh/loft-util v0.0.9-alpha // indirect
138137
github.com/loft-sh/notify v0.0.0-20210827094439-0720dcc7feee // indirect
@@ -144,7 +143,7 @@ require (
144143
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
145144
github.com/miekg/dns v1.1.50 // indirect
146145
github.com/mitchellh/go-homedir v1.1.0 // indirect
147-
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
146+
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
148147
github.com/moby/locker v1.0.1 // indirect
149148
github.com/moby/spdystream v0.2.0 // indirect
150149
github.com/moby/sys/signal v0.6.0 // indirect
@@ -162,7 +161,7 @@ require (
162161
github.com/prometheus/client_model v0.2.0 // indirect
163162
github.com/prometheus/common v0.32.1 // indirect
164163
github.com/prometheus/procfs v0.7.3 // indirect
165-
github.com/protocolbuffers/txtpbfmt v0.0.0-20201118171849-f6a6b3f636fc // indirect
164+
github.com/protocolbuffers/txtpbfmt v0.0.0-20220428173112-74888fd59c2b // indirect
166165
github.com/rancher/lasso/controller-runtime v0.0.0-20220412224715-5f3517291ad4 // indirect
167166
github.com/rivo/uniseg v0.2.0 // indirect
168167
github.com/russross/blackfriday/v2 v2.1.0 // indirect

go.sum

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2/go.mod h1:HBCaDe
8181
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
8282
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d h1:licZJFw2RwpHMqeKTCYkitsPqHNxTmd4SNR5r94FGM8=
8383
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d/go.mod h1:asat636LX7Bqt5lYEZ27JNDcqxfjdBQuJ/MM4CN/Lzo=
84-
github.com/acorn-io/aml v0.0.0-20220717003025-bc8cb1214693 h1:5uxUFWpREhhKllLkanTqBitmh3VPwyBB35507oAU70w=
85-
github.com/acorn-io/aml v0.0.0-20220717003025-bc8cb1214693/go.mod h1:uiNpPSAYWhEBfbGWKpN185+EP+hZr2M/U8Ckr/Jo3Kk=
84+
github.com/acorn-io/aml v0.0.0-20230213221153-200432c87a1c h1:fo+pWyQQB+xAWNnx2VWiyf+XKzFGboWz0wGe46RNb2o=
85+
github.com/acorn-io/aml v0.0.0-20230213221153-200432c87a1c/go.mod h1:UEx5RRLFjryCEHN2pM59+d8A0mPJ3VAxggJOTzPymwg=
8686
github.com/acorn-io/apiserver v0.25.2-ot-1 h1:91Q7+Jd9BeYZhzt0C+38w2sMn8aHFOxfTdlE6MCH9UI=
8787
github.com/acorn-io/apiserver v0.25.2-ot-1/go.mod h1:8cynBL5SR6CIKypk9nWtZXHzEiJhLVQxeMVZ5CGzkFo=
8888
github.com/acorn-io/baaah v0.0.0-20230210045136-282f5388cca5 h1:nK0zoe9Ce0xSTHkfk6KpRHUpf7SzZ8yHG8suqTxSvbY=
@@ -147,9 +147,8 @@ github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWH
147147
github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
148148
github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
149149
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
150-
github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I=
151-
github.com/cockroachdb/apd/v2 v2.0.1 h1:y1Rh3tEU89D+7Tgbw+lp52T6p/GJLpDmNvr10UWqLTE=
152-
github.com/cockroachdb/apd/v2 v2.0.1/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw=
150+
github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b8034E=
151+
github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw=
153152
github.com/containerd/cgroups v1.0.3 h1:ADZftAkglvCiD44c77s5YmMqaP2pzVCFZvBmAlBdAP4=
154153
github.com/containerd/console v1.0.3 h1:lIr7SlA5PxZyMV30bDW0MGbiOPXwc63yRuCP0ARubLw=
155154
github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U=
@@ -205,8 +204,8 @@ github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25Kn
205204
github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153 h1:yUdfgN0XgIJw7foRItutHYUIhlcKzcSf5vDpdhQAKTc=
206205
github.com/emicklei/go-restful/v3 v3.9.0 h1:XwGDlfxEnQZzuopoqxwSEllNcCOM9DhhFyhFIIGKwxE=
207206
github.com/emicklei/go-restful/v3 v3.9.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
208-
github.com/emicklei/proto v1.6.15 h1:XbpwxmuOPrdES97FrSfpyy67SSCV/wBIKXqgJzh6hNw=
209-
github.com/emicklei/proto v1.6.15/go.mod h1:rn1FgRS/FANiZdD2djyH7TMA9jdRDcYQ9IEN9yvjX0A=
207+
github.com/emicklei/proto v1.10.0 h1:pDGyFRVV5RvV+nkBK9iy3q67FBy9Xa7vwrOTE+g5aGw=
208+
github.com/emicklei/proto v1.10.0/go.mod h1:rn1FgRS/FANiZdD2djyH7TMA9jdRDcYQ9IEN9yvjX0A=
210209
github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg=
211210
github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o=
212211
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
@@ -429,7 +428,6 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
429428
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
430429
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
431430
github.com/lib/pq v1.10.2 h1:AqzbZs4ZoCBp+GtejcpCpcxM3zlSMx29dXbUSeVtJb8=
432-
github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
433431
github.com/lithammer/fuzzysearch v1.1.5 h1:Ag7aKU08wp0R9QCfF4GoGST9HbmAIeLP7xwMrOBEp1c=
434432
github.com/lithammer/fuzzysearch v1.1.5/go.mod h1:1R1LRNk7yKid1BaQkmuLQaHruxcC4HmAH30Dh61Ih1Q=
435433
github.com/loft-sh/devspace v1.1.1-0.20221217093921-7604c5857f98 h1:EdaHnOWn24TBX08Yuhjr2p2bqS4R0K0TiljMYMJFgac=
@@ -462,8 +460,8 @@ github.com/miekg/dns v1.1.50 h1:DQUfb9uc6smULcREF09Uc+/Gd46YWqJd5DbpPE9xkcA=
462460
github.com/miekg/dns v1.1.50/go.mod h1:e3IlAVfNqAllflbibAZEWOXOQ+Ynzk/dDozDxY7XnME=
463461
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
464462
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
465-
github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4=
466-
github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
463+
github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0=
464+
github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0=
467465
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
468466
github.com/moby/buildkit v0.10.6 h1:DJlEuLIgnu34HQKF4n9Eg6q2YqQVC0eOpMb4p2eRS2w=
469467
github.com/moby/buildkit v0.10.6/go.mod h1:tQuuyTWtOb9D+RE425cwOCUkX0/oZ+5iBZ+uWpWQ9bU=
@@ -551,8 +549,8 @@ github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1
551549
github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU=
552550
github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
553551
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
554-
github.com/protocolbuffers/txtpbfmt v0.0.0-20201118171849-f6a6b3f636fc h1:gSVONBi2HWMFXCa9jFdYvYk7IwW/mTLxWOF7rXS4LO0=
555-
github.com/protocolbuffers/txtpbfmt v0.0.0-20201118171849-f6a6b3f636fc/go.mod h1:KbKfKPy2I6ecOIGA9apfheFv14+P3RSmmQvshofQyMY=
552+
github.com/protocolbuffers/txtpbfmt v0.0.0-20220428173112-74888fd59c2b h1:zd/2RNzIRkoGGMjE+YIsZ85CnDIz672JK2F3Zl4vux4=
553+
github.com/protocolbuffers/txtpbfmt v0.0.0-20220428173112-74888fd59c2b/go.mod h1:KjY0wibdYKc4DYkerHSbguaf3JeIPGhNJBp2BNiFH78=
556554
github.com/pterm/pterm v0.12.27/go.mod h1:PhQ89w4i95rhgE+xedAoqous6K9X+r6aSOI2eFF7DZI=
557555
github.com/pterm/pterm v0.12.29/go.mod h1:WI3qxgvoQFFGKGjGnJR849gU0TsEOvKn5Q8LlY1U7lg=
558556
github.com/pterm/pterm v0.12.30/go.mod h1:MOqLIyMOgmTDz9yorcYbcw+HsgoZo3BQfg2wtl3HEFE=

integration/helper/controller.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
apiv1 "github.com/acorn-io/acorn/pkg/apis/api.acorn.io/v1"
1313
v1 "github.com/acorn-io/acorn/pkg/apis/internal.acorn.io/v1"
1414
"github.com/acorn-io/acorn/pkg/client"
15+
"github.com/acorn-io/acorn/pkg/config"
1516
"github.com/acorn-io/acorn/pkg/controller"
1617
"github.com/acorn-io/acorn/pkg/crds"
1718
hclient "github.com/acorn-io/acorn/pkg/k8sclient"
@@ -84,6 +85,7 @@ func BuilderClient(t *testing.T, namespace string) client.Client {
8485
if err != nil {
8586
t.Fatal(err)
8687
}
88+
8789
return c
8890
}
8991

@@ -215,6 +217,20 @@ func StartController(t *testing.T) {
215217
t.Fatal(err)
216218
}
217219

220+
cfg, err := config.Get(ctx, c.Router.Backend())
221+
if err != nil {
222+
t.Fatal(err)
223+
}
224+
225+
if *cfg.BuilderPerProject {
226+
err = config.Set(ctx, c.Router.Backend(), &apiv1.Config{
227+
BuilderPerProject: new(bool),
228+
})
229+
if err != nil {
230+
t.Fatal(err)
231+
}
232+
}
233+
218234
if err := c.Start(context.Background()); err != nil {
219235
t.Fatal(err)
220236
}

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

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ package v1
33
import (
44
"errors"
55
"fmt"
6-
"strconv"
76
"strings"
87

9-
"cuelang.org/go/cue/literal"
8+
"github.com/acorn-io/aml"
109
"k8s.io/apimachinery/pkg/api/resource"
1110

1211
corev1 "k8s.io/api/core/v1"
@@ -23,7 +22,7 @@ func ParseMemory(s []string) (Memory, error) {
2322
workload = ""
2423
}
2524

26-
quantity, err := ParseQuantityString(memBytes)
25+
quantity, err := aml.ParseInt(memBytes)
2726
if err != nil {
2827
return Memory{}, err
2928
}
@@ -33,21 +32,6 @@ func ParseMemory(s []string) (Memory, error) {
3332
return result, nil
3433
}
3534

36-
func ParseQuantityString(memory string) (int64, error) {
37-
numInfo := literal.NumInfo{}
38-
err := literal.ParseNum(memory, &numInfo)
39-
if err != nil {
40-
return -1, err
41-
}
42-
43-
quantity, err := strconv.ParseInt(numInfo.String(), 10, 64)
44-
if err != nil {
45-
return -1, err
46-
}
47-
48-
return quantity, nil
49-
}
50-
5135
var (
5236
ErrInvalidAcornMemory = errors.New("invalid memory from Acornfile")
5337
ErrInvalidSetMemory = errors.New("invalid memory set by user")

pkg/appdefinition/aml.go

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)