Skip to content

Commit

Permalink
external: fqdn should be persisted
Browse files Browse the repository at this point in the history
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 f66de7b)
Signed-off-by: parth-gr <paarora@redhat.com>
  • Loading branch information
parth-gr committed Aug 7, 2023
1 parent b57f0c7 commit 9cf4f44
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 33 deletions.
1 change: 1 addition & 0 deletions Documentation/CRDs/Object-Storage/ceph-object-store-crd.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions deploy/charts/rook-ceph/templates/resources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions deploy/examples/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 0 additions & 9 deletions deploy/examples/create-external-cluster-resources-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
[
Expand Down
18 changes: 0 additions & 18 deletions deploy/examples/create-external-cluster-resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}, "
"<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(
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions deploy/examples/object-external.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ spec:
port: 80
externalRgwEndpoints:
- ip: 192.168.39.182
# hostname: example.com
5 changes: 3 additions & 2 deletions pkg/apis/ceph.rook.io/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
Expand Down

0 comments on commit 9cf4f44

Please sign in to comment.