Skip to content

Commit

Permalink
ceph: update endpoint with IP for external RGW server
Browse files Browse the repository at this point in the history
For external RGW server use the IP mentioned in Gateway for admin Ops
operattions.

Fixes: #8916
Signed-off-by: Jiffin Tony Thottan <thottanjiffin@gmail.com>
  • Loading branch information
thotz committed Oct 20, 2021
1 parent d7213c0 commit cb3dd8b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
9 changes: 8 additions & 1 deletion pkg/operator/ceph/object/admin.go
Expand Up @@ -141,7 +141,14 @@ func UpdateEndpoint(objContext *Context, spec *cephv1.ObjectStoreSpec) error {
if err != nil {
return errors.Wrapf(err, "failed to get port for object store %q", nsName)
}
objContext.Endpoint = BuildDNSEndpoint(BuildDomainName(objContext.Name, objContext.clusterInfo.Namespace), port, spec.IsTLSEnabled())

var domainName string
if spec.IsExternal() {
domainName = spec.Gateway.ExternalRgwEndpoints[0].IP
} else {
domainName = BuildDomainName(objContext.Name, objContext.clusterInfo.Namespace)
}
objContext.Endpoint = BuildDNSEndpoint(domainName, port, spec.IsTLSEnabled())

return nil
}
Expand Down
8 changes: 7 additions & 1 deletion pkg/operator/ceph/object/bucket/provisioner.go
Expand Up @@ -646,9 +646,15 @@ func (p *Provisioner) setAdminOpsAPIClient() error {
if err != nil {
return errors.Wrap(err, "failed to retrieve rgw admin ops user")
}
var domainName string
if cephObjectStore.Spec.IsExternal() {
domainName = cephObjectStore.Spec.Gateway.ExternalRgwEndpoints[0].IP
} else {
domainName = cephObject.BuildDomainName(p.objectContext.Name, cephObjectStore.Namespace)
}

// Build endpoint
s3endpoint := cephObject.BuildDNSEndpoint(cephObject.BuildDomainName(p.objectContext.Name, cephObjectStore.Namespace), p.storePort, cephObjectStore.Spec.IsTLSEnabled())
s3endpoint := cephObject.BuildDNSEndpoint(domainName, p.storePort, cephObjectStore.Spec.IsTLSEnabled())

// If DEBUG level is set we will mutate the HTTP client for printing request and response
if logger.LevelAt(capnslog.DEBUG) {
Expand Down

0 comments on commit cb3dd8b

Please sign in to comment.