]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: add multivalue support to rgw_dns_name config option 48554/head
authorGiuseppe Baccini <giuseppe.baccini@suse.com>
Wed, 19 Oct 2022 14:58:05 +0000 (16:58 +0200)
committerGiuseppe Baccini <giuseppe.baccini@suse.com>
Fri, 21 Oct 2022 08:53:42 +0000 (10:53 +0200)
rgw_dns_name configuration option has extended to define multiple
domain values.
This option is now interpreted as a comma separated list of DNS names.

Example:

rgw_dns_name = cname.domain.com,cname2.domain2.com, cname3.domain3.com

Signed-off-by: Giuseppe Baccini <giuseppe.baccini@suse.com>
doc/radosgw/s3/commons.rst
src/common/options/rgw.yaml.in
src/rgw/rgw_rest.cc

index ca848bc277eb14bc7b403c8b15a6b1605f46a802..4b9b4a040abfac6e4d7691b7a77f764dc2b1bea2 100644 (file)
@@ -22,6 +22,8 @@ To configure virtual hosted buckets, you can either set ``rgw_dns_name = cname.d
 
 .. tip:: We prefer the first method, because the second method requires expensive domain certification and DNS wild cards.
 
+.. tip:: You can define multiple hostname directly with the :confval:`rgw_dns_name` parameter.
+
 Common Request Headers
 ----------------------
 
index 33fe0a607948ac2fcd3717c12edf96d74898f692..d705841af9dfd21253ebabbabeaf784d3c4af5c5 100644 (file)
@@ -282,10 +282,11 @@ options:
 - name: rgw_dns_name
   type: str
   level: advanced
-  desc: The host name that RGW uses.
-  long_desc: This is Needed for virtual hosting of buckets to work properly, unless
+  desc: The host names that RGW uses.
+  long_desc: A comma separated list of DNS names.
+    This is Needed for virtual hosting of buckets to work properly, unless
     configured via zonegroup configuration.
-  fmt_desc: The DNS name of the served domain. See also the ``hostnames`` setting within regions.
+  fmt_desc: The DNS names of the served domains. See also the ``hostnames`` setting within zonegroups.
   services:
   - rgw
   with_legacy: true
index 80538467393ed2f1b21183a8c02cd1e4bb086c21..29b28fa60804da952657b443131700c45c4ea502 100644 (file)
@@ -209,10 +209,14 @@ void rgw_rest_init(CephContext *cct, const rgw::sal::ZoneGroup& zone_group)
   for (const struct rgw_http_status_code *h = http_codes; h->code; h++) {
     http_status_names[h->code] = h->name;
   }
-  std::list<std::string> names;
 
+  std::list<std::string> rgw_dns_names;
+  std::string rgw_dns_names_str = cct->_conf->rgw_dns_name;
+  get_str_list(rgw_dns_names_str, ", ", rgw_dns_names);
+  hostnames_set.insert(rgw_dns_names.begin(), rgw_dns_names.end());
+
+  std::list<std::string> names;
   zone_group.get_hostnames(names);
-  hostnames_set.insert(cct->_conf->rgw_dns_name);
   hostnames_set.insert(names.begin(), names.end());
   hostnames_set.erase(""); // filter out empty hostnames
   ldout(cct, 20) << "RGW hostnames: " << hostnames_set << dendl;