Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added S3 user management #127

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 0 additions & 62 deletions .github/workflows/candidate-upgrade.yml

This file was deleted.

10 changes: 7 additions & 3 deletions .github/workflows/q2q-candidate-upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ jobs:
run: ~/actionutils.sh free_runner_disk

- name: Install dependencies
run: ~/actionutils.sh setup_lxd
run: |
# boto3 for appS3 test script.
sudo python -m pip install --upgrade pip
sudo pip install boto3
~/actionutils.sh setup_lxd
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see these lines being repeated
Maybe could refactor the actionutils.sh a bit to have a setup_host function instead of setup_lxd that handles all deps


- name: Create containers with loopback devices
run: ~/actionutils.sh create_containers
Expand All @@ -50,7 +54,7 @@ jobs:
run: ~/actionutils.sh headexec enable_rgw

- name: Exercise RGW
run: ~/actionutils.sh headexec testrgw
run: ~/actionutils.sh headexec testrgw_old
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming nit: maybe a more descriptive name instead of testrgw_old


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

- name: Exercise RGW again
run: ~/actionutils.sh headexec testrgw
run: ~/actionutils.sh testrgw_on_headnode
10 changes: 7 additions & 3 deletions .github/workflows/q2r-candidate-upgrade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ jobs:
run: ~/actionutils.sh free_runner_disk

- name: Install dependencies
run: ~/actionutils.sh setup_lxd
run: |
# boto3 for appS3 test script.
sudo python -m pip install --upgrade pip
sudo pip install boto3
~/actionutils.sh setup_lxd

- name: Create containers with loopback devices
run: ~/actionutils.sh create_containers
Expand All @@ -50,7 +54,7 @@ jobs:
run: ~/actionutils.sh headexec enable_rgw

- name: Exercise RGW
run: ~/actionutils.sh headexec testrgw
run: ~/actionutils.sh headexec testrgw_old

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

- name: Exercise RGW again
run: ~/actionutils.sh headexec testrgw
run: ~/actionutils.sh testrgw_on_headnode
61 changes: 55 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,27 @@ jobs:
path: "*.snap"
retention-days: 5

lint-check:
name: Build microceph snap
runs-on: ubuntu-22.04
env:
SNAPCRAFT_BUILD_ENVIRONMENT: "lxd"
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install dependencies
run: |
# Python script dependencies
sudo python -m pip install --upgrade pip
sudo pip install flake8 pep8-naming

- name: Lint check help scripts.
run: |
flake8 ./scripts/ --count --show-source --statistics

unit-tests:
name: Run Unit tests
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -81,6 +102,12 @@ jobs:
- name: Free disk
run: ~/actionutils.sh free_runner_disk

- name: Install dependencies
run: |
# Python script dependencies
sudo python -m pip install --upgrade pip
sudo pip install boto3

- name: Install and setup
run: |
~/actionutils.sh install_microceph
Expand Down Expand Up @@ -209,7 +236,11 @@ jobs:
run: ~/actionutils.sh free_runner_disk

- name: Install dependencies
run: ~/actionutils.sh setup_lxd
run: |
# Python script dependencies
sudo python -m pip install --upgrade pip
sudo pip install boto3
~/actionutils.sh setup_lxd

- name: Create containers with loopback devices
run: ~/actionutils.sh create_containers
Expand Down Expand Up @@ -272,6 +303,13 @@ jobs:
- name: Enable services on wrk1
run: ~/actionutils.sh headexec enable_services node-wrk1

- name: Enable RGW
run: ~/actionutils.sh headexec enable_rgw

- name: Exercise RGW again
run: |
~/actionutils.sh testrgw_on_headnode

- name: Test remove node wrk3
run: |
set -uex
Expand Down Expand Up @@ -304,6 +342,12 @@ jobs:
- name: Copy utils
run: cp tests/scripts/actionutils.sh $HOME

- name: Install dependencies
run: |
# Python script dependencies
sudo python -m pip install --upgrade pip
sudo pip install boto3

- name: Clear FORWARD firewall rules
run: ~/actionutils.sh cleaript

Expand Down Expand Up @@ -360,7 +404,11 @@ jobs:
run: ~/actionutils.sh free_runner_disk

- name: Install dependencies
run: ~/actionutils.sh setup_lxd
run: |
# Python script dependencies
sudo python -m pip install --upgrade pip
sudo pip install boto3
~/actionutils.sh setup_lxd

- name: Create containers with loopback devices
run: ~/actionutils.sh create_containers
Expand All @@ -384,8 +432,8 @@ jobs:
- name: Enable RGW
run: ~/actionutils.sh headexec enable_rgw

- name: Exercise RGW
run: ~/actionutils.sh headexec testrgw
- name: Exercise RGW before upgrade
run: ~/actionutils.sh headexec testrgw_old

- name: Install local build
run: ~/actionutils.sh install_multinode
Expand All @@ -394,5 +442,6 @@ jobs:
run: ~/actionutils.sh headexec wait_for_osds 3

- name: Exercise RGW again
run: ~/actionutils.sh headexec testrgw

run: |
~/actionutils.sh testrgw_on_headnode

2 changes: 2 additions & 0 deletions docs/.custom_wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Pre
mds
mon
rgw
radosgw
rbd
RBD
MgrReports
Expand All @@ -64,3 +65,4 @@ Noout
Unsetting
cephfs
filesystems
json
106 changes: 106 additions & 0 deletions docs/how-to/s3-user.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
Manage S3 users on MicroCeph
=============================

MicroCeph provides an easy to use interface for creating, viewing and deleting s3 users for interfacing with the RGW endpoint.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest: capitalize S3 here and below (proper noun)

This enables smooth and easy access to Object Storage.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest: s/Object Storage/object storage/


.. list-table:: Supported s3-user operations
:widths: 30 70
:header-rows: 1

* - Operation
- Description
* - create
- Create provided s3 (radosgw) user with optionally provided access-key and secret
* - delete
- Delete provided s3 (radosgw) user
* - get
- Fetch key information of the provided s3 (radosgw) user
* - list
- List all s3 (radosgw) users
.. note:: Users can additionally provide --json flag to create and get commands to dump a much detailed

1. Create an S3 user (optionally provide --access-key --secret and --json)

.. code-block:: shell

$ sudo microceph s3-user create newTestUser --access-key=ThisIsAccessKey --secret=ThisIsSecret --json
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think the cmdline here doesn't match up with the implementation?

{
"user_id": "newTestUser",
"display_name": "newTestUser",
"email": "",
"suspended": 0,
"max_buckets": 1000,
"subusers": [],
"keys": [
{
"user": "newTestUser",
"access_key": "ThisIsAccessKey",
"secret_key": "ThisIsSecret"
}
],
"swift_keys": [],
"caps": [],
"op_mask": "read, write, delete",
"default_placement": "",
"default_storage_class": "",
"placement_tags": [],
"bucket_quota": {
"enabled": false,
"check_on_raw": false,
"max_size": -1,
"max_size_kb": 0,
"max_objects": -1
},
"user_quota": {
"enabled": false,
"check_on_raw": false,
"max_size": -1,
"max_size_kb": 0,
"max_objects": -1
},
"temp_url_keys": [],
"type": "rgw",
"mfa_ids": []
}

2. List all s3 users :

.. code-block:: shell

$ sudo microceph s3-user list
+---+-------------+
| # | NAME |
+---+-------------+
| 1 | newTestUser |
+---+-------------+
| 2 | testUser |
+---+-------------+

3. Get details of a an s3 user (optionally use --json flag to get complete details):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo, s/a an/an/


.. code-block:: shell

$ sudo microceph s3-user get testUser
+----------+----------------------+---------+
| NAME | ACCESS KEY | SECRET |
+----------+----------------------+---------+
| testUser | ThisIsAccessKey | ThisIsSecret |
+----------+----------------------+---------+

4. Delete an s3 user:

.. code-block:: shell

$ sudo microceph s3-user delete newTestUser
$ sudo microceph s3-user list
+---+----------+
| # | NAME |
+---+----------+
| 1 | testUser |
+---+----------+

.. warning:: All the related buckets+objects should be deleted before deletion of the user.

For more fine-tuned user management use `radosgw-admin CLI <https://docs.ceph.com/en/latest/man/8/radosgw-admin/>`_

8 changes: 8 additions & 0 deletions microceph/api/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package api

import "github.com/canonical/microcluster/rest"

// Top level client API
var clientCmd = rest.Endpoint{
Path: "client",
}
5 changes: 0 additions & 5 deletions microceph/api/client_configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ import (
"github.com/canonical/microcluster/state"
)

// Top level client API
var clientCmd = rest.Endpoint{
Path: "client",
}

// client configs API
var clientConfigsCmd = rest.Endpoint{
Path: "client/configs",
Expand Down
Loading
Loading