Skip to content

Commit 99ce437

Browse files
Changed CLI and endpoint interfaces.
Signed-off-by: Utkarsh Bhatt <utkarsh.bhatt@canonical.com>
1 parent e10b393 commit 99ce437

File tree

17 files changed

+410
-382
lines changed

17 files changed

+410
-382
lines changed

.github/workflows/candidate-upgrade.yml

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

.github/workflows/q2q-candidate-upgrade.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ jobs:
2525
run: ~/actionutils.sh free_runner_disk
2626

2727
- name: Install dependencies
28-
run: ~/actionutils.sh setup_lxd
28+
run: |
29+
# boto3 for appS3 test script.
30+
sudo python -m pip install --upgrade pip
31+
sudo pip install boto3
32+
~/actionutils.sh setup_lxd
2933
3034
- name: Create containers with loopback devices
3135
run: ~/actionutils.sh create_containers
@@ -50,7 +54,7 @@ jobs:
5054
run: ~/actionutils.sh headexec enable_rgw
5155

5256
- name: Exercise RGW
53-
run: ~/actionutils.sh headexec testrgw
57+
run: ~/actionutils.sh headexec testrgw_old
5458

5559
- name: Upgrade to candidate
5660
run: ~/actionutils.sh refresh_snap quincy/candidate
@@ -59,4 +63,4 @@ jobs:
5963
run: ~/actionutils.sh headexec wait_for_osds 3
6064

6165
- name: Exercise RGW again
62-
run: ~/actionutils.sh headexec testrgw
66+
run: ~/actionutils.sh testrgw_on_lxd node-wrk0

.github/workflows/q2r-candidate-upgrade.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ jobs:
2525
run: ~/actionutils.sh free_runner_disk
2626

2727
- name: Install dependencies
28-
run: ~/actionutils.sh setup_lxd
28+
run: |
29+
# boto3 for appS3 test script.
30+
sudo python -m pip install --upgrade pip
31+
sudo pip install boto3
32+
~/actionutils.sh setup_lxd
2933
3034
- name: Create containers with loopback devices
3135
run: ~/actionutils.sh create_containers
@@ -50,7 +54,7 @@ jobs:
5054
run: ~/actionutils.sh headexec enable_rgw
5155

5256
- name: Exercise RGW
53-
run: ~/actionutils.sh headexec testrgw
57+
run: ~/actionutils.sh headexec testrgw_old
5458

5559
- name: Upgrade to candidate
5660
run: ~/actionutils.sh refresh_snap reef/candidate
@@ -59,4 +63,4 @@ jobs:
5963
run: ~/actionutils.sh headexec wait_for_osds 3
6064

6165
- name: Exercise RGW again
62-
run: ~/actionutils.sh headexec testrgw
66+
run: ~/actionutils.sh testrgw_on_lxd node-wrk0

.github/workflows/tests.yml

Lines changed: 47 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,27 @@ jobs:
3939
path: "*.snap"
4040
retention-days: 5
4141

42+
lint-check:
43+
name: Build microceph snap
44+
runs-on: ubuntu-22.04
45+
env:
46+
SNAPCRAFT_BUILD_ENVIRONMENT: "lxd"
47+
steps:
48+
- name: Checkout code
49+
uses: actions/checkout@v3
50+
with:
51+
fetch-depth: 0
52+
53+
- name: Install dependencies
54+
run: |
55+
# Python script dependencies
56+
sudo python -m pip install --upgrade pip
57+
sudo pip install flake8 pep8-naming
58+
59+
- name: Lint check help scripts.
60+
run: |
61+
flake8 ./scripts/ --count --show-source --statistics
62+
4263
unit-tests:
4364
name: Run Unit tests
4465
runs-on: ubuntu-22.04
@@ -85,11 +106,7 @@ jobs:
85106
run: |
86107
# Python script dependencies
87108
sudo python -m pip install --upgrade pip
88-
sudo pip install flake8 pep8-naming boto3
89-
90-
- name: Lint check
91-
run: |
92-
flake8 . --count --show-source --statistics
109+
sudo pip install boto3
93110
94111
- name: Install and setup
95112
run: |
@@ -219,7 +236,11 @@ jobs:
219236
run: ~/actionutils.sh free_runner_disk
220237

221238
- name: Install dependencies
222-
run: ~/actionutils.sh setup_lxd
239+
run: |
240+
# Python script dependencies
241+
sudo python -m pip install --upgrade pip
242+
sudo pip install boto3
243+
~/actionutils.sh setup_lxd
223244
224245
- name: Create containers with loopback devices
225246
run: ~/actionutils.sh create_containers
@@ -314,6 +335,12 @@ jobs:
314335
- name: Copy utils
315336
run: cp tests/scripts/actionutils.sh $HOME
316337

338+
- name: Install dependencies
339+
run: |
340+
# Python script dependencies
341+
sudo python -m pip install --upgrade pip
342+
sudo pip install boto3
343+
317344
- name: Clear FORWARD firewall rules
318345
run: ~/actionutils.sh cleaript
319346

@@ -370,7 +397,11 @@ jobs:
370397
run: ~/actionutils.sh free_runner_disk
371398

372399
- name: Install dependencies
373-
run: ~/actionutils.sh setup_lxd
400+
run: |
401+
# Python script dependencies
402+
sudo python -m pip install --upgrade pip
403+
sudo pip install boto3
404+
~/actionutils.sh setup_lxd
374405
375406
- name: Create containers with loopback devices
376407
run: ~/actionutils.sh create_containers
@@ -394,15 +425,20 @@ jobs:
394425
- name: Enable RGW
395426
run: ~/actionutils.sh headexec enable_rgw
396427

397-
- name: Exercise RGW
398-
run: ~/actionutils.sh headexec testrgw
428+
- name: Exercise RGW before upgrade
429+
run: ~/actionutils.sh headexec testrgw_old
399430

400431
- name: Install local build
401432
run: ~/actionutils.sh install_multinode
402433

403434
- name: Wait until 3 OSDs are up
404435
run: ~/actionutils.sh headexec wait_for_osds 3
405436

437+
- name: Install boto3 on head node.
438+
run: |
439+
~/actionutils.sh headexec install_boto3
440+
406441
- name: Exercise RGW again
407-
run: ~/actionutils.sh headexec testrgw
408-
442+
run: |
443+
~/actionutils.sh testrgw_on_lxd node-wrk0
444+

docs/.custom_wordlist.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ Pre
4747
mds
4848
mon
4949
rgw
50+
radosgw
5051
rbd
5152
RBD
5253
MgrReports
@@ -59,3 +60,4 @@ qemu
5960
writethrough
6061
writeback
6162
IOPS
63+
json

docs/how-to/s3-user.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Use S3 user management on MicroCeph
2-
===================================
1+
Manage S3 users on MicroCeph
2+
=============================
33

44
MicroCeph provides an easy to use interface for creating, viewing and deleting s3 users for interfacing with the RGW endpoint.
55
This enables smooth and easy access to Object Storage.

microceph/api/client.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package api
2+
3+
import "github.com/canonical/microcluster/rest"
4+
5+
// Top level client API
6+
var clientCmd = rest.Endpoint{
7+
Path: "client",
8+
}

microceph/api/client_configs.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ import (
1818
"github.com/canonical/microcluster/state"
1919
)
2020

21-
// Top level client API
22-
var clientCmd = rest.Endpoint{
23-
Path: "client",
24-
}
25-
2621
// client configs API
2722
var clientConfigsCmd = rest.Endpoint{
2823
Path: "client/configs",
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ import (
1212
)
1313

1414
// /1.0/resources endpoint.
15-
var s3Cmd = rest.Endpoint{
16-
Path: "services/rgw/user",
17-
Get: rest.EndpointAction{Handler: cmdS3Get, ProxyTarget: true},
18-
Put: rest.EndpointAction{Handler: cmdS3Put, ProxyTarget: true},
19-
Delete: rest.EndpointAction{Handler: cmdS3Delete, ProxyTarget: true},
15+
var clientS3Cmd = rest.Endpoint{
16+
Path: "client/s3",
17+
Get: rest.EndpointAction{Handler: cmdClientS3Get, ProxyTarget: true},
18+
Put: rest.EndpointAction{Handler: cmdClientS3Put, ProxyTarget: true},
19+
Delete: rest.EndpointAction{Handler: cmdClientS3Delete, ProxyTarget: true},
2020
}
2121

22-
func cmdS3Get(s *state.State, r *http.Request) response.Response {
22+
func cmdClientS3Get(s *state.State, r *http.Request) response.Response {
2323
var err error
2424
var req types.S3User
2525

@@ -44,7 +44,7 @@ func cmdS3Get(s *state.State, r *http.Request) response.Response {
4444
}
4545
}
4646

47-
func cmdS3Put(s *state.State, r *http.Request) response.Response {
47+
func cmdClientS3Put(s *state.State, r *http.Request) response.Response {
4848
var err error
4949
var req types.S3User
5050

@@ -61,7 +61,7 @@ func cmdS3Put(s *state.State, r *http.Request) response.Response {
6161
return response.SyncResponse(true, output)
6262
}
6363

64-
func cmdS3Delete(s *state.State, r *http.Request) response.Response {
64+
func cmdClientS3Delete(s *state.State, r *http.Request) response.Response {
6565
var err error
6666
var req types.S3User
6767

microceph/api/endpoints.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ var Endpoints = []rest.Endpoint{
2020
clientCmd,
2121
clientConfigsCmd,
2222
clientConfigsKeyCmd,
23-
s3Cmd,
23+
clientS3Cmd,
2424
}

0 commit comments

Comments
 (0)