Skip to content

Commit 2294538

Browse files
authored
Upgrade code and docs for easy start (#130)
* Allow example kv app to accept string as value in PUT method, fix namespace in documentation and allow upgrade example kv app helm deployment through makefile * Improve makefile, fix helm-uninstall-cartridge-app Co-authored-by: andrey.klyuev <andrey.klyuev@vk.team>
1 parent e12e8f6 commit 2294538

File tree

4 files changed

+28
-12
lines changed

4 files changed

+28
-12
lines changed

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ helm-prepare-clear: ## Clear temp files builded using Kustomize.
134134
rm -rf $(CHARTS_DIR)/tarantool-operator/.templates.*/
135135

136136
helm-install-operator: ## Install tarantool-operator with tarantool-operator helm chart.
137-
helm install -n tarantool-operator operator $(CHARTS_DIR)/tarantool-operator \
137+
helm upgrade --install -n tarantool-operator operator $(CHARTS_DIR)/tarantool-operator \
138138
--create-namespace \
139139
--set image.repository=$(REPO) \
140140
--set image.tag=$(VERSION)
@@ -143,12 +143,12 @@ helm-uninstall-operator: ## Uninstall tarantool-operator.
143143
helm uninstall -n tarantool-operator operator
144144

145145
helm-install-cartridge-app: ## Install cartridge-app with tarantool-cartridge helm chart.
146-
helm install -n tarantool-app cartridge-app $(CHARTS_DIR)/tarantool-cartridge \
146+
helm upgrade --install -n tarantool-app cartridge-app $(CHARTS_DIR)/tarantool-cartridge \
147147
--create-namespace \
148148
--set LuaMemoryReserveMB=0 # default reserve too large for local minikube cluster
149149

150150
helm-uninstall-cartridge-app: ## Uninstall cartridge-app.
151-
helm uninstall -n tarantool-operator operator
151+
helm uninstall -n tarantool-app cartridge-app
152152

153153
##@ Deployment
154154

README.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ Tarantool Operator is up and running.
174174
Wait until all the cluster Pods are up (status becomes `Running`):
175175
176176
```shell
177-
$ kubectl -n cartridge-app get pods
177+
$ kubectl -n tarantool-app get pods
178178
---
179179
NAME READY STATUS RESTARTS AGE
180180
routers-0-0 1/1 Running 0 6m12s
@@ -200,7 +200,7 @@ Tarantool Operator is up and running.
200200
3. Access the cluster web UI:
201201
202202
```shell
203-
$ kubectl -n cartridge-app port-forward routers-0-0 8081:8081
203+
$ kubectl -n tarantool-app port-forward routers-0-0 8081:8081
204204
---
205205
Forwarding from 127.0.0.1:8081 -> 8081
206206
Forwarding from [::1]:8081 -> 8081
@@ -217,14 +217,30 @@ Tarantool Operator is up and running.
217217
{"info":"Successfully created"}
218218
```
219219
220-
2. Access stored values:
220+
2. Access stored value:
221221
222222
```shell
223-
$ curl http://localhost:8081/kv_dump
223+
$ curl http://localhost:8081/kv/key_1
224224
---
225-
{"store":[{"key":"key_1","value":"value_1"}]}
225+
"value_1"
226226
```
227227
228+
3. Update stored value:
229+
230+
```shell
231+
$ curl -XPUT http://localhost:8081/kv/key_1 -d '"new_value_1"'
232+
---
233+
["key_1", "new_value_1"]
234+
```
235+
236+
4. Delete stored value:
237+
238+
```shell
239+
$ curl -XDELETE http://localhost:8081/kv/key_1
240+
---
241+
{"info":"Successfully deleted"}
242+
```
243+
228244
### Scaling the application
229245
230246
Increase the number of replica sets in Storages Role:

examples/kv/app/roles/router.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ end
5050

5151
local function handle_update(req)
5252
local key = req:stash('key')
53-
local status, value = pcall(function() return req:json() end)
53+
local _, value = pcall(function() return req:json() end)
5454

55-
if value == nil or type(value) == 'string' then
56-
local resp = req:render{json = { info = msg }}
55+
if value == nil then
56+
local resp = req:render{json = { info = "Value cannot be empty" }}
5757
resp.status = 500
5858
return resp
5959
end

helm-charts/tarantool-cartridge/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ LuaMemoryReserveMB: 2048
88

99
image:
1010
repository: tarantool/tarantool-operator-examples-kv
11-
tag: 0.0.3
11+
tag: 0.0.4
1212
pullPolicy: IfNotPresent
1313

1414
securityContext:

0 commit comments

Comments
 (0)