Skip to content

Commit

Permalink
rgw: use insecure TLS for bucket health check
Browse files Browse the repository at this point in the history
We have seen cases where the signed certificate used for the RGW does not
contain the internal DNS endpoint, resulting in the health check to fail
since the certificate is not valid for this domain.
People consuming the gateways by external clients and for specific
domains do not necessarily have the internal DNS configured in the
certificate.
So let's be a bit more flexible and simply ensure a connectivity check
and bypass the certificate validation.

Closes: #8663
Signed-off-by: Sébastien Han <seb@redhat.com>
  • Loading branch information
leseb committed Sep 27, 2021
1 parent 76b2ebb commit 36e9b43
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
3 changes: 1 addition & 2 deletions pkg/operator/ceph/object/health.go
Expand Up @@ -159,14 +159,13 @@ func (c *bucketChecker) checkObjectStoreHealth() error {
}

// Set access and secret key
tlsCert := c.objContext.TlsCert
s3endpoint := c.objContext.Endpoint
s3AccessKey := user.Keys[0].AccessKey
s3SecretKey := user.Keys[0].SecretKey

// Initiate s3 agent
logger.Debugf("initializing s3 connection for object store %q", c.namespacedName.Name)
s3client, err := NewS3Agent(s3AccessKey, s3SecretKey, s3endpoint, "", false, tlsCert)
s3client, err := NewInsecureS3Agent(s3AccessKey, s3SecretKey, s3endpoint, "", false)
if err != nil {
return errors.Wrap(err, "failed to initialize s3 connection")
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/operator/ceph/object/s3-handlers.go
Expand Up @@ -40,7 +40,7 @@ func NewS3Agent(accessKey, secretKey, endpoint, region string, debug bool, tlsCe
return newS3Agent(accessKey, secretKey, endpoint, region, debug, tlsCert, false)
}

func NewTestOnlyS3Agent(accessKey, secretKey, endpoint, region string, debug bool) (*S3Agent, error) {
func NewInsecureS3Agent(accessKey, secretKey, endpoint, region string, debug bool) (*S3Agent, error) {
return newS3Agent(accessKey, secretKey, endpoint, region, debug, nil, true)
}

Expand Down
18 changes: 16 additions & 2 deletions tests/integration/ceph_object_test.go
Expand Up @@ -41,6 +41,10 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

var (
objectStoreServicePrefix = "rook-ceph-rgw-"
)

func TestCephObjectSuite(t *testing.T) {
if installer.SkipTestSuite(installer.CephTestSuite) {
t.Skip()
Expand Down Expand Up @@ -102,6 +106,16 @@ func (s *ObjectSuite) TestWithTLS() {
runObjectE2ETest(s.helper, s.k8sh, s.Suite, s.settings.Namespace, tls)
}

func (s *ObjectSuite) TestWithBrokenTLS() {
if utils.IsPlatformOpenShift() {
s.T().Skip("object store tests skipped on openshift")
}

tls := true
objectStoreServicePrefix = "broken"
runObjectE2ETest(s.helper, s.k8sh, s.Suite, s.settings.Namespace, tls)
}

func (s *ObjectSuite) TestWithoutTLS() {
if utils.IsPlatformOpenShift() {
s.T().Skip("object store tests skipped on openshift")
Expand Down Expand Up @@ -195,7 +209,7 @@ func checkCephObjectUser(
// create a CephObjectStore and wait for it to report ready status
func createCephObjectStore(t *testing.T, helper *clients.TestClient, k8sh *utils.K8sHelper, namespace, storeName string, replicaSize int, tlsEnable bool) {
logger.Infof("Create Object Store %q with replica count %d", storeName, replicaSize)
rgwServiceName := "rook-ceph-rgw-" + storeName
rgwServiceName := objectStoreServicePrefix + storeName
if tlsEnable {
t.Run("generate TLS certs", func(t *testing.T) {
generateRgwTlsCertSecret(t, helper, k8sh, namespace, storeName, rgwServiceName)
Expand Down Expand Up @@ -320,7 +334,7 @@ func testObjectStoreOperations(s suite.Suite, helper *clients.TestClient, k8sh *
s3AccessKey, _ := helper.BucketClient.GetAccessKey(obcName)
s3SecretKey, _ := helper.BucketClient.GetSecretKey(obcName)
if objectStore.Spec.IsTLSEnabled() {
s3client, err = rgw.NewTestOnlyS3Agent(s3AccessKey, s3SecretKey, s3endpoint, region, true)
s3client, err = rgw.NewInsecureS3Agent(s3AccessKey, s3SecretKey, s3endpoint, region, true)
} else {
s3client, err = rgw.NewS3Agent(s3AccessKey, s3SecretKey, s3endpoint, region, true, nil)
}
Expand Down

0 comments on commit 36e9b43

Please sign in to comment.