From 9cf4f44cc53bc274b02152c87e5aae9979dfc525 Mon Sep 17 00:00:00 2001 From: parth-gr Date: Mon, 22 May 2023 18:23:32 +0530 Subject: [PATCH] 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 (cherry picked from commit f66de7b9df94bdf02b6d38b1a9cb1e4e63fdda81) Signed-off-by: parth-gr --- .../Object-Storage/ceph-object-store-crd.md | 1 + .../Object-Storage-RGW/object-storage.md | 1 + .../charts/rook-ceph/templates/resources.yaml | 4 ++-- deploy/examples/crds.yaml | 4 ++-- .../create-external-cluster-resources-tests.py | 9 --------- .../create-external-cluster-resources.py | 18 ------------------ deploy/examples/object-external.yaml | 1 + pkg/apis/ceph.rook.io/v1/types.go | 5 +++-- 8 files changed, 10 insertions(+), 33 deletions(-) diff --git a/Documentation/CRDs/Object-Storage/ceph-object-store-crd.md b/Documentation/CRDs/Object-Storage/ceph-object-store-crd.md index 989ef96e739f..69c45428b311 100644 --- a/Documentation/CRDs/Object-Storage/ceph-object-store-crd.md +++ b/Documentation/CRDs/Object-Storage/ceph-object-store-crd.md @@ -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. diff --git a/Documentation/Storage-Configuration/Object-Storage-RGW/object-storage.md b/Documentation/Storage-Configuration/Object-Storage-RGW/object-storage.md index 03d31cc61b6f..97f50670fdba 100644 --- a/Documentation/Storage-Configuration/Object-Storage-RGW/object-storage.md +++ b/Documentation/Storage-Configuration/Object-Storage-RGW/object-storage.md @@ -80,6 +80,7 @@ spec: port: 8080 externalRgwEndpoints: - ip: 192.168.39.182 + # hostname: example.com ``` You can use the existing `object-external.yaml` file. diff --git a/deploy/charts/rook-ceph/templates/resources.yaml b/deploy/charts/rook-ceph/templates/resources.yaml index 6202fa3c3294..881b29344170 100644 --- a/deploy/charts/rook-ceph/templates/resources.yaml +++ b/deploy/charts/rook-ceph/templates/resources.yaml @@ -11961,10 +11961,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 diff --git a/deploy/examples/crds.yaml b/deploy/examples/crds.yaml index 4d70b246799a..1ce2ba77ad4e 100644 --- a/deploy/examples/crds.yaml +++ b/deploy/examples/crds.yaml @@ -11953,10 +11953,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 diff --git a/deploy/examples/create-external-cluster-resources-tests.py b/deploy/examples/create-external-cluster-resources-tests.py index aaf01d1c5ddf..ca1f11587956 100644 --- a/deploy/examples/create-external-cluster-resources-tests.py +++ b/deploy/examples/create-external-cluster-resources-tests.py @@ -187,15 +187,6 @@ def test_valid_rgw_endpoint(self): 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( [ diff --git a/deploy/examples/create-external-cluster-resources.py b/deploy/examples/create-external-cluster-resources.py index 1ebc23a43b7f..da323937c557 100644 --- a/deploy/examples/create-external-cluster-resources.py +++ b/deploy/examples/create-external-cluster-resources.py @@ -1225,19 +1225,6 @@ def create_rgw_admin_ops_user(self): "", ) - 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}, " - ":, 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( @@ -1321,7 +1308,6 @@ def validate_rgw_endpoint(self, info_cap_supported): # 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 @@ -1386,10 +1372,6 @@ def _gen_output_map(self): 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() diff --git a/deploy/examples/object-external.yaml b/deploy/examples/object-external.yaml index f7bd5555844a..d42e410aff74 100644 --- a/deploy/examples/object-external.yaml +++ b/deploy/examples/object-external.yaml @@ -16,3 +16,4 @@ spec: port: 80 externalRgwEndpoints: - ip: 192.168.39.182 + # hostname: example.com diff --git a/pkg/apis/ceph.rook.io/v1/types.go b/pkg/apis/ceph.rook.io/v1/types.go index 87f494ea71f1..b3d6d8d32986 100755 --- a/pkg/apis/ceph.rook.io/v1/types.go +++ b/pkg/apis/ceph.rook.io/v1/types.go @@ -1469,10 +1469,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"` }