Skip to content

Commit 21ddbb1

Browse files
pradithyaPradithya Aria
andauthored
Remove decryption when retrieving secret from MLP (#338)
* Update mlp client * Remove decryption when retrieving secret from MLP * Fix lint * Fix mlp path * Update default mlp url in documentation and local dev setup --------- Co-authored-by: Pradithya Aria <[email protected]>
1 parent 295bff9 commit 21ddbb1

File tree

16 files changed

+104
-113
lines changed

16 files changed

+104
-113
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ ClusterConfig:
230230
TuringEncryptionKey: password
231231
MLPConfig:
232232
MerlinURL: http://localhost:8082/v1
233-
MLPURL: http://localhost:8081/v1
233+
MLPURL: http://localhost:8081
234234
MLPEncryptionKey: password
235235
TuringUIConfig:
236236
ServingDirectory: ../ui/build
@@ -337,7 +337,7 @@ Then, update the config file `.env.development.local` as shown below.
337337
```
338338
REACT_APP_HOMEPAGE=/turing
339339
REACT_APP_TURING_API=http://localhost:8080/v1
340-
REACT_APP_MLP_API=http://localhost:8081/v1
340+
REACT_APP_MLP_API=http://localhost:8081
341341
REACT_APP_MERLIN_API=http://localhost:8082/v1
342342
REACT_APP_OAUTH_CLIENT_ID=xxxxxxx.apps.googleusercontent.com
343343
REACT_APP_DEFAULT_DOCKER_REGISTRY=docker.io

api/.env.development

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ VAULT_ADDRESS=http://vault.example.com:8200/
2727
VAULT_TOKEN=
2828

2929
MERLIN_URL=http://mlp.example.com/api/merlin/v1
30-
MLP_URL=http://mlp.example.com/api/v1
30+
MLP_URL=http://mlp.example.com/api
3131
MLP_ENCRYPTION_KEY=
3232

3333
TURING_ENCRYPTION_KEY=test_encryption_key

api/config-dev.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ ClusterConfig:
8888
TuringEncryptionKey: password
8989
MLPConfig:
9090
MerlinURL: http://localhost:8082/v1
91-
MLPURL: http://localhost:8081/v1
91+
MLPURL: http://localhost:8081
9292
MLPEncryptionKey: password
9393
TuringUIConfig:
9494
ServingDirectory: ../ui/build

api/e2e/test/router_e2e_test.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ var _ = DeployedRouterContext("testdata/create_router_nop_logger_proprietary_exp
6565
WithJSON(json.RawMessage(`[{"client": {"id": 4}}, {"client": {"id": 7}}]`)).
6666
Expect().Status(http.StatusOK).
6767
JSON().Array().
68-
Equal(JSONPayload("testdata/responses/router_proprietary_exp_batch_predict.json"))
68+
IsEqual(JSONPayload("testdata/responses/router_proprietary_exp_batch_predict.json"))
6969
})
7070
})
7171
})
@@ -116,13 +116,13 @@ var _ = DeployedRouterContext("testdata/create_router_nop_logger_proprietary_exp
116116
}, defaultDeploymentIntervals...).Should(Succeed())
117117

118118
version.
119-
ValueEqual("status", api.Status.Failed).
120-
ValueEqual("error", "Requested CPU is more than max permissible")
119+
HasValue("status", api.Status.Failed).
120+
HasValue("error", "Requested CPU is more than max permissible")
121121
})
122122

123123
It("keeps previously deployed version active", func() {
124124
router = api.GetRouter(apiE, routerCtx.ProjectID, routerCtx.ID)
125-
router.Path("$.config.version").Equal(1)
125+
router.Path("$.config.version").IsEqual(1)
126126
})
127127
})
128128
})
@@ -197,8 +197,8 @@ var _ = DeployedRouterContext("testdata/create_router_nop_logger_proprietary_exp
197197
}, defaultDeploymentIntervals...).Should(Succeed())
198198

199199
version.
200-
ValueEqual("status", api.Status.Failed).
201-
ValueEqual("error", "Requested CPU is more than max permissible")
200+
HasValue("status", api.Status.Failed).
201+
HasValue("error", "Requested CPU is more than max permissible")
202202
})
203203

204204
It("keeps previous valid version as router's current version", func() {
@@ -244,8 +244,8 @@ var _ = DeployedRouterContext("testdata/create_router_nop_logger_proprietary_exp
244244
}, defaultDeploymentIntervals...).Should(Succeed())
245245

246246
router.
247-
ValueEqual("status", api.Status.Deployed).
248-
Path("$.config.version").Equal(1)
247+
HasValue("status", api.Status.Deployed).
248+
Path("$.config.version").IsEqual(1)
249249
})
250250
})
251251
})
@@ -276,7 +276,7 @@ var _ = DeployedRouterContext("testdata/create_router_nop_logger_proprietary_exp
276276
}, defaultDeploymentIntervals...).Should(Succeed())
277277

278278
version.
279-
ValueEqual("status", api.Status.Deployed).
279+
HasValue("status", api.Status.Deployed).
280280
NotContainsKey("error")
281281
})
282282

@@ -290,8 +290,8 @@ var _ = DeployedRouterContext("testdata/create_router_nop_logger_proprietary_exp
290290

291291
It("updates router's configuration to the new version", func() {
292292
api.GetRouter(apiE, routerCtx.ProjectID, routerCtx.ID).
293-
ValueEqual("status", api.Status.Deployed).
294-
Path("$.config.version").Equal(3)
293+
HasValue("status", api.Status.Deployed).
294+
Path("$.config.version").IsEqual(3)
295295
})
296296
})
297297

@@ -320,7 +320,7 @@ var _ = DeployedRouterContext("testdata/create_router_nop_logger_proprietary_exp
320320
WithPath("routerId", routerCtx.ID).
321321
Expect().Status(http.StatusBadRequest).
322322
JSON().
323-
Equal(json.RawMessage(`{
323+
IsEqual(json.RawMessage(`{
324324
"description": "invalid delete request",
325325
"error": "router is currently deployed. Undeploy it first."
326326
}`))
@@ -366,7 +366,7 @@ var _ = DeployedRouterContext("testdata/create_router_nop_logger_proprietary_exp
366366
WithPath("routerId", routerCtx.ID).
367367
Expect().Status(http.StatusNotFound).
368368
JSON().
369-
Equal(json.RawMessage(`{
369+
IsEqual(json.RawMessage(`{
370370
"description": "router not found",
371371
"error": "record not found"
372372
}`))

api/e2e/test/router_test.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ var _ = DeployedRouterContext("testdata/create_router_std_ensembler_proprietary_
3737
WithJSON(json.RawMessage(`{"client": {"id": 4}}`)).
3838
Expect().
3939
Status(http.StatusOK).
40-
JSON().Equal(json.RawMessage(`{"version": "control"}`))
40+
JSON().IsEqual(json.RawMessage(`{"version": "control"}`))
4141
})
4242
})
4343

@@ -48,7 +48,7 @@ var _ = DeployedRouterContext("testdata/create_router_std_ensembler_proprietary_
4848
WithJSON(json.RawMessage(`{"client": {"id": 7}}`)).
4949
Expect().
5050
Status(http.StatusOK).
51-
JSON().Equal(json.RawMessage(`{"version": "treatment-a"}`))
51+
JSON().IsEqual(json.RawMessage(`{"version": "treatment-a"}`))
5252
})
5353
})
5454
})
@@ -70,7 +70,8 @@ var _ = DeployedRouterContext("testdata/create_router_with_traffic_rules.json.tm
7070
When("request satisfies the first traffic rule", func() {
7171
It("responds with responses from `treatment-a` route", func() {
7272
want = httpexpect.
73-
NewValue(GinkgoT(), JSONPayload("testdata/responses/traffic_rules/traffic-rule-1.json")).
73+
NewValue(GinkgoT(),
74+
JSONPayload("testdata/responses/traffic_rules/traffic-rule-1.json")).
7475
Object()
7576

7677
got = config.NewHTTPExpect(GinkgoT(), routerCtx.Endpoint).
@@ -87,7 +88,8 @@ var _ = DeployedRouterContext("testdata/create_router_with_traffic_rules.json.tm
8788
When("request satisfies the second traffic rule", func() {
8889
It("responds with responses from `treatment-b` route", func() {
8990
want = httpexpect.
90-
NewValue(GinkgoT(), JSONPayload("testdata/responses/traffic_rules/traffic-rule-2.json")).
91+
NewValue(GinkgoT(),
92+
JSONPayload("testdata/responses/traffic_rules/traffic-rule-2.json")).
9193
Object()
9294

9395
got = config.NewHTTPExpect(GinkgoT(), routerCtx.Endpoint).

api/e2e/test/routers_suite_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ func DeployedRouterContext(payloadTpl string, protocol routerConfig.Protocol, ar
181181
}, defaultDeploymentIntervals...).Should(Succeed())
182182

183183
router.
184-
ValueEqual("status", "deployed").
185-
Value("config").Object().ValueEqual("version", 1)
184+
HasValue("status", "deployed").
185+
Value("config").Object().HasValue("version", 1)
186186

187187
endpoint, err := url.Parse(router.Value("endpoint").String().Raw())
188188
Expect(err).ShouldNot(HaveOccurred())
@@ -292,12 +292,12 @@ func AssertResponsePayload(want, got *httpexpect.Object) {
292292

293293
if len(resp.Response.RouteResponses) > 0 {
294294
got.
295-
ValueEqual("request", want.Value("request").Raw()).
295+
HasValue("request", want.Value("request").Raw()).
296296
Value("response").Object().
297-
ValueEqual("experiment", want.Path("$.response.experiment").Raw()).
297+
HasValue("experiment", want.Path("$.response.experiment").Raw()).
298298
Value("route_responses").Array().
299299
ContainsOnly(want.Path("$.response.route_responses").Array().Raw()...)
300300
} else {
301-
got.Equal(want.Raw())
301+
got.IsEqual(want.Raw())
302302
}
303303
}

api/go.mod

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ require (
88
github.com/GoogleCloudPlatform/spark-on-k8s-operator v0.0.0-20220214044918-55732a6a392c
99
github.com/antihax/optional v1.0.0
1010
github.com/caraml-dev/merlin v0.0.0
11-
github.com/caraml-dev/mlp v1.7.7-0.20230428104022-779530aec912
11+
github.com/caraml-dev/mlp v1.7.7-0.20230519042541-3415407aa27b
1212
github.com/caraml-dev/turing/engines/experiment v0.0.0
1313
github.com/caraml-dev/turing/engines/router v0.0.0
1414
github.com/caraml-dev/universal-prediction-interface v0.3.4
15-
github.com/gavv/httpexpect/v2 v2.3.1
15+
github.com/gavv/httpexpect/v2 v2.15.0
1616
github.com/getkin/kin-openapi v0.76.0
1717
github.com/ghodss/yaml v1.0.0
1818
github.com/go-playground/validator/v10 v10.11.1
@@ -60,7 +60,7 @@ require (
6060
cloud.google.com/go/compute/metadata v0.2.3 // indirect
6161
github.com/HdrHistogram/hdrhistogram-go v1.1.2 // indirect
6262
github.com/ajg/form v1.5.1 // indirect
63-
github.com/andybalholm/brotli v1.0.3 // indirect
63+
github.com/andybalholm/brotli v1.0.4 // indirect
6464
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a // indirect
6565
github.com/beorn7/perks v1.0.1 // indirect
6666
github.com/buger/jsonparser v1.1.1 // indirect
@@ -94,10 +94,11 @@ require (
9494
github.com/go-playground/universal-translator v0.18.0 // indirect
9595
github.com/go-playground/validator v9.31.0+incompatible // indirect
9696
github.com/go-stack/stack v1.8.0 // indirect
97+
github.com/gobwas/glob v0.2.3 // indirect
9798
github.com/gogo/protobuf v1.3.2 // indirect
9899
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
99100
github.com/golang/protobuf v1.5.2 // indirect
100-
github.com/google/go-querystring v1.0.0 // indirect
101+
github.com/google/go-querystring v1.1.0 // indirect
101102
github.com/google/gofuzz v1.2.0 // indirect
102103
github.com/google/uuid v1.3.0 // indirect
103104
github.com/googleapis/enterprise-certificate-proxy v0.2.1 // indirect
@@ -114,7 +115,7 @@ require (
114115
github.com/hashicorp/hcl v1.0.0 // indirect
115116
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect
116117
github.com/imdario/mergo v0.3.13 // indirect
117-
github.com/imkira/go-interpol v1.0.0 // indirect
118+
github.com/imkira/go-interpol v1.1.0 // indirect
118119
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
119120
github.com/jackc/pgconn v1.13.0 // indirect
120121
github.com/jackc/pgio v1.0.0 // indirect
@@ -133,11 +134,12 @@ require (
133134
github.com/lib/pq v1.10.3 // indirect
134135
github.com/magiconair/properties v1.8.5 // indirect
135136
github.com/mailru/easyjson v0.7.7 // indirect
136-
github.com/mattn/go-colorable v0.1.11 // indirect
137-
github.com/mattn/go-isatty v0.0.14 // indirect
137+
github.com/mattn/go-colorable v0.1.13 // indirect
138+
github.com/mattn/go-isatty v0.0.17 // indirect
138139
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
139140
github.com/mitchellh/go-homedir v1.1.0 // indirect
140141
github.com/mitchellh/go-testing-interface v1.0.0 // indirect
142+
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
141143
github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect
142144
github.com/mitchellh/reflectwalk v1.0.2 // indirect
143145
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
@@ -154,6 +156,7 @@ require (
154156
github.com/prometheus/client_model v0.2.0 // indirect
155157
github.com/prometheus/common v0.32.1 // indirect
156158
github.com/prometheus/procfs v0.7.3 // indirect
159+
github.com/sanity-io/litter v1.5.5 // indirect
157160
github.com/sergi/go-diff v1.1.0 // indirect
158161
github.com/sirupsen/logrus v1.9.0 // indirect
159162
github.com/spf13/afero v1.9.2 // indirect
@@ -166,8 +169,8 @@ require (
166169
github.com/uber/jaeger-client-go v2.25.0+incompatible // indirect
167170
github.com/uber/jaeger-lib v2.4.0+incompatible // indirect
168171
github.com/valyala/bytebufferpool v1.0.0 // indirect
169-
github.com/valyala/fasthttp v1.30.0 // indirect
170-
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
172+
github.com/valyala/fasthttp v1.34.0 // indirect
173+
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
171174
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
172175
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
173176
github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0 // indirect
@@ -197,7 +200,7 @@ require (
197200
k8s.io/kube-openapi v0.0.0-20211109043538-20434351676c // indirect
198201
k8s.io/utils v0.0.0-20221107191617-1a15be271d1d // indirect
199202
knative.dev/networking v0.0.0-20211101215640-8c71a2708e7d // indirect
200-
moul.io/http2curl v1.0.1-0.20190925090545-5cd742060b0e // indirect
203+
moul.io/http2curl/v2 v2.3.0 // indirect
201204
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
202205
)
203206

0 commit comments

Comments
 (0)