diff --git a/ceph-rgw/Chart.yaml b/ceph-rgw/Chart.yaml index b4dbaea4d..07650c198 100644 --- a/ceph-rgw/Chart.yaml +++ b/ceph-rgw/Chart.yaml @@ -15,6 +15,6 @@ apiVersion: v1 appVersion: v1.0.0 description: OpenStack-Helm Ceph RadosGW name: ceph-rgw -version: 0.1.7 +version: 0.1.8 home: https://github.com/ceph/ceph ... diff --git a/ceph-rgw/templates/bin/_create-rgw-placement-targets.sh.tpl b/ceph-rgw/templates/bin/_create-rgw-placement-targets.sh.tpl index 7f3b6d78d..50d5ff4f3 100644 --- a/ceph-rgw/templates/bin/_create-rgw-placement-targets.sh.tpl +++ b/ceph-rgw/templates/bin/_create-rgw-placement-targets.sh.tpl @@ -23,6 +23,11 @@ function create_rgw_placement_target () { --placement-id "$2" } +function delete_rgw_placement_target () { + echo "Deleting rgw placement target $1" + radosgw-admin zonegroup placement rm $1 +} + function add_rgw_zone_placement () { echo "Adding rgw zone placement for placement target $2 data pool $3" radosgw-admin zone placement add \ @@ -33,6 +38,11 @@ function add_rgw_zone_placement () { --data-extra-pool "$5" } +function rm_rgw_zone_placement () { + echo "Removing rgw zone placement for placement target $1" + radosgw-admin zone placement rm $1 +} + {{- range $i, $placement_target := .Values.conf.rgw_placement_targets }} RGW_PLACEMENT_TARGET={{ $placement_target.name | quote }} RGW_PLACEMENT_TARGET_DATA_POOL={{ $placement_target.data_pool | quote }} @@ -40,9 +50,15 @@ RGW_PLACEMENT_TARGET_INDEX_POOL={{ $placement_target.index_pool | default "defau RGW_PLACEMENT_TARGET_DATA_EXTRA_POOL={{ $placement_target.data_extra_pool | default "default.rgw.buckets.non-ec" | quote }} RGW_ZONEGROUP={{ $placement_target.zonegroup | default "default" | quote }} RGW_ZONE={{ $placement_target.zone | default "default" | quote }} +RGW_DELETE_PLACEMENT_TARGET={{ $placement_target.delete | default "false" | quote }} RGW_PLACEMENT_TARGET_EXISTS=$(radosgw-admin zonegroup placement get --placement-id "$RGW_PLACEMENT_TARGET" 2>/dev/null || true) if [[ -z "$RGW_PLACEMENT_TARGET_EXISTS" ]]; then create_rgw_placement_target "$RGW_ZONEGROUP" "$RGW_PLACEMENT_TARGET" add_rgw_zone_placement "$RGW_ZONE" "$RGW_PLACEMENT_TARGET" "$RGW_PLACEMENT_TARGET_DATA_POOL" "$RGW_PLACEMENT_TARGET_INDEX_POOL" "$RGW_PLACEMENT_TARGET_DATA_EXTRA_POOL" fi +if [[ -n "$RGW_PLACEMENT_TARGET_EXISTS" ]] && + [[ "true" == "$RGW_DELETE_PLACEMENT_TARGET" ]]; then + rm_rgw_zone_placement "$RGW_PLACEMENT_TARGET" + delete_rgw_placement_target "$RGW_PLACEMENT_TARGET" +fi {{- end }} diff --git a/ceph-rgw/values.yaml b/ceph-rgw/values.yaml index 8f9d17f83..ae825a079 100644 --- a/ceph-rgw/values.yaml +++ b/ceph-rgw/values.yaml @@ -405,6 +405,10 @@ conf: rgw_placement_targets: - name: default-placement data_pool: default.rgw.buckets.data + # Set 'delete' to true to delete an existing placement target. A + # non-existent placement target will be created and deleted in a single + # step. + # delete: true rgw: config: # NOTE (portdirect): See http://tracker.ceph.com/issues/21226 diff --git a/releasenotes/notes/ceph-rgw.yaml b/releasenotes/notes/ceph-rgw.yaml index 9e4bac319..32fcfaff6 100644 --- a/releasenotes/notes/ceph-rgw.yaml +++ b/releasenotes/notes/ceph-rgw.yaml @@ -8,4 +8,5 @@ ceph-rgw: - 0.1.5 Add tls support - 0.1.6 Update tls override options - 0.1.7 Use ca cert for helm tests + - 0.1.8 Add placement target delete support to RGW ...