Files
my-rook-config/tests/framework/installer/installer.go
T
ee8bcad49d rgw: add support for keystone auth + swift/s3
For the specification see:
<https://github.com/rook/rook/blob/master/design/ceph/object/swift-and-keystone-integration.md>

* extend the API object specs for swift and keystone integration

* adapt rgw to the new go-ceph version

  - The parameter lists of the API call have changes, as parameters
    ignored by the RGW Admin Ops API are no longer serialized, therefore
    the mock has to be adapted.

  - There is now validation for the user keys that are passed to the
    User get API, therefore things failed when we had empty keys in our
    User proxy object.

* expand the reconcile loop for the swift and keystone integration

* fix minor mistakes in design document

* add env var to pass extra args to minikube

  Minikube decides CPU cores and memory automatically based on the
  available resources on the machine which may be insufficient to
  run rook. This commit adds an environment variable to add arbitrary
  arguments to the minikube command, so both can be specified if
  desired.

* integration tests for swift and keystone

  The new integration of swift or s3 and keystone support by rook
  does not have any integration tests yet.

  This commit introduces integration tests for swift and keystone. The
  tests are done against a minimal keystone setup (keystone container
  image from Yaook-project (https://yaook.cloud), sqlite as database
  backend, cert-manager and trust-manager for test certificate setup).

  To prevent hardcoded credentials, passwords are generated
  by the tests. The integration tests use the openstack client
  (keystone- and swift-functionality) (https://docs.openstack.org/
  python-openstackclient/ latest/). This was a concious design decision
  to use client tooling as close as possible to the end user instead of
  using other go-libraries (such as gophercloud).

* add documentation on swift and keystone

  Currently there is no documentation on the use of Swift to access
  an object store as well as the use of OpenStack keystone for
  authentication.

  This commit adds documentation on the use of Swift and OpenStack
  keystone, as well as CRD-related documentation and an example setup.

* add integration tests for S3 via keystone

  This commit introduces integration tests for s3 and keystone. The
  tests are run against the same minimal keystone setup that the tests
  for swift and keystone use.

  The integration tests use the aws s3 client to use client tooling as
  close as possible to the end user instead of using other go-libraries.

Co-authored-by: Jan Klippel <jan.klippel@uhurutec.com>
Co-authored-by: Silvio Ankermann <silvio.ankermann@cloudandheat.com>
Signed-off-by: Sebastian Riese <sebastian.riese@cloudandheat.com>
Signed-off-by: Jan Klippel <jan.klippel@uhurutec.com>
Signed-off-by: Silvio Ankermann <silvio.ankermann@cloudandheat.com>
2024-08-08 14:26:21 +02:00

77 lines
2.2 KiB
Go

/*
Copyright 2016 The Rook Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package installer
import (
"fmt"
"strings"
"testing"
"text/template"
"github.com/coreos/pkg/capnslog"
"github.com/rook/rook/tests/framework/utils"
"github.com/stretchr/testify/assert"
"k8s.io/apimachinery/pkg/api/errors"
)
const (
// LocalBuildTag tag for the latest manifests
LocalBuildTag = "local-build"
// test suite names
CassandraTestSuite = "cassandra"
CephTestSuite = "ceph"
NFSTestSuite = "nfs"
)
var (
logger = capnslog.NewPackageLogger("github.com/rook/rook", "installer")
createArgs = []string{"create", "-f"}
createFromStdinArgs = append(createArgs, "-")
deleteArgs = []string{"delete", "-f"}
deleteFromStdinArgs = append(deleteArgs, "-")
)
func SystemNamespace(namespace string) string {
if utils.IsPlatformOpenShift() {
logger.Infof("For openshift execution used system namespace: %s", namespace)
return namespace
}
return fmt.Sprintf("%s-system", namespace)
}
func checkError(t *testing.T, err error, message string) {
// During cleanup the resource might not be found because the test might have failed before the test was done and never created the resource
if err == nil || errors.IsNotFound(err) {
return
}
assert.NoError(t, err, "%s. %+v", message, err)
}
func renderTemplate(templateSource string, data any) string {
templateInstance, err := template.New("template").Parse(templateSource)
if err != nil {
panic(fmt.Errorf("syntax error in template: %s", err))
}
var builder strings.Builder
err = templateInstance.Execute(&builder, data)
if err != nil {
panic(fmt.Errorf("error while rendering the template: %s", err))
}
return builder.String()
}