external: fqdn should be persisted

1) donot change rgw fqdn to ip if provided,
As now the bucket class supports the
entry of fqdn

2) update crds with new description in EndpointAddress

Signed-off-by: parth-gr <paarora@redhat.com>
(cherry picked from commit f66de7b9df)
This commit is contained in:
parth-gr authored and Mergify committed 2023-05-31 20:01:30 +00:00
1 parent 1fd283fb8b
commit 3fbcff5127
9 files changed
+12 -35

No files matched your search

@@ -135,6 +135,7 @@ gateway:
port: 80
externalRgwEndpoints:
- ip: 192.168.39.182
# hostname: example.com
```
This will create a service with the endpoint `192.168.39.182` on port `80`, pointing to the Ceph object external gateway.
+2 -2
View File
@@ -4850,7 +4850,7 @@ string
</td>
<td>
<em>(Optional)</em>
<p>The IP of this endpoint.</p>
<p>The IP of this endpoint. As a legacy behavior, this supports being given a DNS-adressable hostname as well.</p>
</td>
</tr>
<tr>
@@ -4862,7 +4862,7 @@ string
</td>
<td>
<em>(Optional)</em>
<p>The Hostname of this endpoint</p>
<p>The DNS-addressable Hostname of this endpoint. This field will be preferred over IP if both are given.</p>
</td>
</tr>
</tbody>
@@ -93,6 +93,7 @@ spec:
port: 8080
externalRgwEndpoints:
- ip: 192.168.39.182
# hostname: example.com
```
Use the existing `object-external.yaml` file. Even though multiple endpoints can be specified, it is recommend to use only one endpoint. This endpoint is randomly added to `configmap` of OBC and secret of the `cephobjectstoreuser`. Rook never guarantees the randomly picked endpoint is a working one or not.
@@ -9160,10 +9160,10 @@ spec:
description: EndpointAddress is a tuple that describes a single IP address or host name. This is a subset of Kubernetes's v1.EndpointAddress.
properties:
hostname:
description: The Hostname of this endpoint
description: The DNS-addressable Hostname of this endpoint. This field will be preferred over IP if both are given.
type: string
ip:
description: The IP of this endpoint.
description: The IP of this endpoint. As a legacy behavior, this supports being given a DNS-adressable hostname as well.
type: string
type: object
x-kubernetes-map-type: atomic
+2 -2
View File
@@ -9152,10 +9152,10 @@ spec:
description: EndpointAddress is a tuple that describes a single IP address or host name. This is a subset of Kubernetes's v1.EndpointAddress.
properties:
hostname:
description: The Hostname of this endpoint
description: The DNS-addressable Hostname of this endpoint. This field will be preferred over IP if both are given.
type: string
ip:
description: The IP of this endpoint.
description: The IP of this endpoint. As a legacy behavior, this supports being given a DNS-adressable hostname as well.
type: string
type: object
x-kubernetes-map-type: atomic
@@ -187,15 +187,6 @@ class TestRadosJSON(unittest.TestCase):
except ext.ExecutionFailureException as err:
print(f"Successfully thrown error: {err}")
def test_convert_fqdn_rgw_endpoint_to_ip(self):
try:
rgw_endpoint_ip = self.rjObj.convert_fqdn_rgw_endpoint_to_ip(
"www.redhat.com:80"
)
print(f"Successfully Converted www.redhat.com to it's IP {rgw_endpoint_ip}")
except ext.ExecutionFailureException as err:
print(f"Successfully thrown error: {err}")
def test_upgrade_user_permissions(self):
self.rjObj = ext.RadosJSON(
[
@@ -1229,19 +1229,6 @@ class RadosJSON:
"",
)
def convert_fqdn_rgw_endpoint_to_ip(self, fqdn_rgw_endpoint):
try:
fqdn, port = fqdn_rgw_endpoint.split(":")
except ValueError:
raise ExecutionFailureException(
f"Not a proper endpoint: {fqdn_rgw_endpoint}, "
"<FQDN>:<PORT>, format is expected"
)
rgw_endpoint_ip = self._convert_hostname_to_ip(fqdn)
rgw_endpoint_port = port
rgw_endpoint = self._join_host_port(rgw_endpoint_ip, rgw_endpoint_port)
return rgw_endpoint
def validate_rbd_pool(self):
if not self.cluster.pool_exists(self._arg_parser.rbd_data_pool_name):
raise ExecutionFailureException(
@@ -1325,7 +1312,6 @@ class RadosJSON:
# check if the rgw endpoint is reachable
rgw_endpoint = self._arg_parser.rgw_endpoint
self._invalid_endpoint(rgw_endpoint)
cert = None
if not self._arg_parser.rgw_skip_tls and self.validate_rgw_endpoint_tls_cert():
cert = self._arg_parser.rgw_tls_cert_path
@@ -1390,10 +1376,6 @@ class RadosJSON:
self._arg_parser.cluster_name = (
self._arg_parser.cluster_name.lower()
) # always convert cluster name to lowercase characters
if self._arg_parser.rgw_endpoint:
self._arg_parser.rgw_endpoint = self.convert_fqdn_rgw_endpoint_to_ip(
self._arg_parser.rgw_endpoint
)
self.validate_rbd_pool()
self.validate_rados_namespace()
self.validate_subvolume_group()
+1
View File
@@ -16,3 +16,4 @@ spec:
port: 80
externalRgwEndpoints:
- ip: 192.168.39.182
# hostname: example.com
+3 -2
View File
@@ -1484,10 +1484,11 @@ type GatewaySpec struct {
// Kubernetes's v1.EndpointAddress.
// +structType=atomic
type EndpointAddress struct {
// The IP of this endpoint.
// The IP of this endpoint. As a legacy behavior, this supports being given a DNS-adressable hostname as well.
// +optional
IP string `json:"ip" protobuf:"bytes,1,opt,name=ip"`
// The Hostname of this endpoint
// The DNS-addressable Hostname of this endpoint. This field will be preferred over IP if both are given.
// +optional
Hostname string `json:"hostname,omitempty" protobuf:"bytes,3,opt,name=hostname"`
}