Since Pacific, we can deploy multiple object gateway using the same
keying and they will appear in the service map separetly. So from now on
and on upgrades to Pacific Rook will remove all extra deployments to
only keep 1. In this single deployment the number of replica will be set
the desired `instances` count from the CRD spec.
You will now see gateways like this on Pacific:
```
rgw: 3 daemons active (1 hosts, 1 zones)
```
See an upgrade operator logs from Octopus to Pacific:
```
2021-04-14 10:05:16.883145 I | ceph-object-controller: setting multisite settings for object store "my-store"
2021-04-14 10:05:17.006492 I | ceph-object-controller: Multisite for object-store: realm=my-store, zonegroup=my-store, zone=my-store
2021-04-14 10:05:17.006516 I | ceph-object-controller: multisite configuration for object-store my-store is complete
2021-04-14 10:05:17.006523 I | ceph-object-controller: creating object store "my-store" in namespace "rook-ceph"
2021-04-14 10:05:17.006533 I | cephclient: getting or creating ceph auth key "client.rgw.my.store.a"
2021-04-14 10:05:17.298176 I | ceph-object-controller: object store "my-store" deployment "rook-ceph-rgw-my-store-a" started
2021-04-14 10:05:17.307913 I | ceph-object-controller: object store "my-store" deployment "rook-ceph-rgw-my-store-a" already exists. updating if needed
2021-04-14 10:05:17.317441 I | op-k8sutil: updating deployment "rook-ceph-rgw-my-store-a" after verifying it is safe to stop
2021-04-14 10:05:17.317463 I | op-mon: checking if we can stop the deployment rook-ceph-rgw-my-store-a
2021-04-14 10:05:25.552648 I | op-k8sutil: finished waiting for updated deployment "rook-ceph-mgr-a"
2021-04-14 10:05:25.552662 I | op-mon: checking if we can continue the deployment rook-ceph-mgr-a
2021-04-14 10:05:25.555077 I | op-mgr: setting services to point to mgr "a"
2021-04-14 10:05:25.608535 I | op-osd: start running osds in namespace "rook-ceph"
2021-04-14 10:05:25.608587 I | op-osd: wait timeout for healthy OSDs during upgrade or restart is "10m0s"
2021-04-14 10:05:25.618392 I | op-osd: start provisioning the OSDs on PVCs, if needed
2021-04-14 10:05:25.620512 I | op-osd: no storageClassDeviceSets or volumeSources are defined to configure OSDs on PVCs
2021-04-14 10:05:25.620542 I | op-osd: start provisioning the OSDs on nodes, if needed
2021-04-14 10:05:25.628416 I | op-osd: 1 of the 1 storage nodes are valid
2021-04-14 10:05:25.760702 I | op-k8sutil: Removing previous job rook-ceph-osd-prepare-minikube to start a new one
2021-04-14 10:05:25.773213 I | op-k8sutil: batch job rook-ceph-osd-prepare-minikube still exists
2021-04-14 10:05:26.595673 I | op-mgr: successful modules: prometheus
2021-04-14 10:05:27.129569 I | op-mgr: successful modules: mgr module(s) from the spec
2021-04-14 10:05:27.776720 I | op-k8sutil: batch job rook-ceph-osd-prepare-minikube deleted
2021-04-14 10:05:27.781881 I | op-osd: started OSD provisioning job for node "minikube"
2021-04-14 10:05:27.786693 I | op-osd: OSD orchestration status for node minikube is "starting"
2021-04-14 10:05:28.617937 I | op-mgr: successful modules: balancer
2021-04-14 10:05:28.706307 W | cephclient: all OSDs are running on the same host. not performing upgrade check. running in best-effort
2021-04-14 10:05:28.710245 I | op-osd: updating OSD 0 on node "minikube"
2021-04-14 10:05:31.596511 I | op-mgr: the dashboard secret was already generated
2021-04-14 10:05:31.926125 I | op-mgr: setting ceph dashboard "admin" login creds
2021-04-14 10:05:32.190343 E | op-mgr: failed modules: "dashboard". failed to initialize dashboard: failed to set login credentials for the ceph dashboard: failed to set login creds on mgr: failed to complete command for set dashboard creds: Invalid command: unused arguments: ["P.c(b6V$0pfK#)'70c5z"]
dashboard set-login-credentials <username> : Set the login credentials. Password read from -i <file>
Traceback (most recent call last):
File "/usr/bin/ceph", line 1310, in <module>
retval = main()
File "/usr/bin/ceph", line 1256, in main
outf.write(outbuf)
TypeError: a bytes-like object is required, not 'str'
.
2021-04-14 10:05:35.665419 I | op-k8sutil: finished waiting for updated deployment "rook-ceph-rgw-my-store-a"
2021-04-14 10:05:35.665553 I | op-mon: checking if we can continue the deployment rook-ceph-rgw-my-store-a
2021-04-14 10:05:35.675293 I | ceph-object-controller: config map "rook-ceph-rgw-my-store-mime-types" for object store "my-store" already exists, not overwriting
2021-04-14 10:05:35.691549 I | ceph-object-controller: found more rgw deployments 3 than desired 3 in object store "my-store", scaling down
2021-04-14 10:05:35.691580 I | op-k8sutil: removing deployment rook-ceph-rgw-my-store-c if it exists
2021-04-14 10:05:35.698382 I | op-k8sutil: Removed deployment rook-ceph-rgw-my-store-c
2021-04-14 10:05:35.704568 I | op-k8sutil: "rook-ceph-rgw-my-store-c" still found. waiting...
2021-04-14 10:05:44.881129 I | op-osd: OSD orchestration status for node minikube is "orchestrating"
2021-04-14 10:05:44.882149 I | op-osd: OSD orchestration status for node minikube is "completed"
2021-04-14 10:05:45.756762 I | op-k8sutil: "rook-ceph-rgw-my-store-c" still found. waiting...
2021-04-14 10:05:45.782039 W | cephclient: all OSDs are running on the same host. not performing upgrade check. running in best-effort
2021-04-14 10:05:45.785188 I | op-osd: updating OSD 1 on node "minikube"
2021-04-14 10:05:54.768851 W | cephclient: all OSDs are running on the same host. not performing upgrade check. running in best-effort
2021-04-14 10:05:54.773191 I | op-osd: updating OSD 2 on node "minikube"
2021-04-14 10:05:55.843879 I | op-k8sutil: "rook-ceph-rgw-my-store-c" still found. waiting...
2021-04-14 10:06:05.255136 I | op-osd: finished running OSDs in namespace "rook-ceph"
2021-04-14 10:06:05.255155 I | ceph-cluster-controller: done reconciling ceph cluster in namespace "rook-ceph"
2021-04-14 10:06:05.560201 W | ceph-cluster-controller: upgrade orchestration completed but somehow we still have more than one Ceph version running. map[ceph version 15.2.9 (357616cbf726abb779ca75a551e8d02568e15b17) octopus (stable):3 ceph version 16.2.0 (0c2054e95bcd9b30fdd908a79ac1d8bbc3394442) pacific (stable):6]:
2021-04-14 10:06:05.885001 I | op-k8sutil: "rook-ceph-rgw-my-store-c" still found. waiting...
2021-04-14 10:06:08.321209 I | exec: timeout waiting for process radosgw-admin to return. Sending interrupt signal to the process
2021-04-14 10:06:10.645672 I | ceph-spec: object "rook-ceph-rgw-my-store-c" matched on delete, reconciling
2021-04-14 10:06:11.940994 I | op-k8sutil: confirmed rook-ceph-rgw-my-store-c does not exist
2021-04-14 10:06:11.972935 I | ceph-spec: object "rook-ceph-rgw-my-store-c-keyring" matched on delete, reconciling
2021-04-14 10:06:11.974394 I | ceph-object-controller: deleting rgw CephX key and configuration in centralized mon database for "rook-ceph-rgw-my-store-c"
2021-04-14 10:06:13.721964 I | ceph-object-controller: successfully deleted rgw config for "client.rgw.my.store.c" in mon configuration database
2021-04-14 10:06:13.721989 I | cephclient: deleting ceph auth "client.rgw.my.store.c"
2021-04-14 10:06:14.073700 I | ceph-object-controller: completed deleting rgw CephX key and configuration in centralized mon database for "rook-ceph-rgw-my-store-c"
2021-04-14 10:06:14.073724 I | op-k8sutil: removing deployment rook-ceph-rgw-my-store-b if it exists
2021-04-14 10:06:14.083950 I | op-k8sutil: Removed deployment rook-ceph-rgw-my-store-b
2021-04-14 10:06:14.090226 I | op-k8sutil: "rook-ceph-rgw-my-store-b" still found. waiting...
2021-04-14 10:06:24.174846 I | op-k8sutil: "rook-ceph-rgw-my-store-b" still found. waiting...
2021-04-14 10:06:30.505574 I | ceph-spec: object "rook-ceph-rgw-my-store-b" matched on delete, reconciling
2021-04-14 10:06:32.201263 I | op-k8sutil: confirmed rook-ceph-rgw-my-store-b does not exist
2021-04-14 10:06:32.219559 I | ceph-object-controller: deleting rgw CephX key and configuration in centralized mon database for "rook-ceph-rgw-my-store-b"
2021-04-14 10:06:32.220219 I | ceph-spec: object "rook-ceph-rgw-my-store-b-keyring" matched on delete, reconciling
2021-04-14 10:06:33.821969 I | ceph-object-controller: successfully deleted rgw config for "client.rgw.my.store.b" in mon configuration database
2021-04-14 10:06:33.821992 I | cephclient: deleting ceph auth "client.rgw.my.store.b"
2021-04-14 10:06:34.182091 I | ceph-object-controller: completed deleting rgw CephX key and configuration in centralized mon database for "rook-ceph-rgw-my-store-b"
2021-04-14 10:06:34.188659 I | ceph-object-controller: successfully scaled down rgw deployments to 1 in object store "my-store"
2021-04-14 10:06:34.188676 I | ceph-object-controller: enabling rgw dashboard
2021-04-14 10:06:49.487902 I | exec: timeout waiting for process radosgw-admin to return. Sending interrupt signal to the process
2021-04-14 10:06:49.494605 W | ceph-object-controller: failed to enable dashboard for rgw. failed to create user "dashboard-admin": failed to create s3 user: signal: interrupt
2021-04-14 10:06:49.494676 I | ceph-object-controller: created object store "my-store" in namespace "rook-ceph"
```
Running pods:
```
...
...
rook-ceph-rgw-my-store-a-6756bdbbd4-7265v 1/1 Running 1 41m
rook-ceph-rgw-my-store-a-6756bdbbd4-l5ccr 1/1 Running 1 41m
rook-ceph-rgw-my-store-a-6756bdbbd4-m679c 1/1 Running 1 41m
...
...
```
Signed-off-by: Sébastien Han <seb@redhat.com>
316 lines
11 KiB
Go
316 lines
11 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 object for the Ceph object store.
|
|
package object
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"reflect"
|
|
|
|
"github.com/banzaicloud/k8s-objectmatcher/patch"
|
|
"github.com/pkg/errors"
|
|
cephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1"
|
|
"github.com/rook/rook/pkg/clusterd"
|
|
cephclient "github.com/rook/rook/pkg/daemon/ceph/client"
|
|
"github.com/rook/rook/pkg/operator/ceph/cluster/mon"
|
|
"github.com/rook/rook/pkg/operator/ceph/config"
|
|
"github.com/rook/rook/pkg/operator/ceph/pool"
|
|
"github.com/rook/rook/pkg/operator/k8sutil"
|
|
kerrors "k8s.io/apimachinery/pkg/api/errors"
|
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
"sigs.k8s.io/controller-runtime/pkg/client"
|
|
)
|
|
|
|
type clusterConfig struct {
|
|
context *clusterd.Context
|
|
clusterInfo *cephclient.ClusterInfo
|
|
store *cephv1.CephObjectStore
|
|
rookVersion string
|
|
clusterSpec *cephv1.ClusterSpec
|
|
ownerInfo *k8sutil.OwnerInfo
|
|
DataPathMap *config.DataPathMap
|
|
client client.Client
|
|
}
|
|
|
|
type rgwConfig struct {
|
|
ResourceName string
|
|
DaemonID string
|
|
Realm string
|
|
ZoneGroup string
|
|
Zone string
|
|
}
|
|
|
|
var updateDeploymentAndWait = mon.UpdateCephDeploymentAndWait
|
|
|
|
func (c *clusterConfig) createOrUpdateStore(realmName, zoneGroupName, zoneName string) error {
|
|
logger.Infof("creating object store %q in namespace %q", c.store.Name, c.store.Namespace)
|
|
|
|
if err := c.startRGWPods(realmName, zoneGroupName, zoneName); err != nil {
|
|
return errors.Wrap(err, "failed to start rgw pods")
|
|
}
|
|
|
|
objContext := NewContext(c.context, c.clusterInfo, c.store.Namespace)
|
|
err := enableRGWDashboard(objContext)
|
|
if err != nil {
|
|
logger.Warningf("failed to enable dashboard for rgw. %v", err)
|
|
}
|
|
|
|
logger.Infof("created object store %q in namespace %q", c.store.Name, c.store.Namespace)
|
|
return nil
|
|
}
|
|
|
|
func (c *clusterConfig) startRGWPods(realmName, zoneGroupName, zoneName string) error {
|
|
ctx := context.TODO()
|
|
// backward compatibility, triggered during updates
|
|
if c.store.Spec.Gateway.Instances < 1 {
|
|
// Set the minimum of at least one instance
|
|
logger.Warning("spec.gateway.instances must be set to at least 1")
|
|
c.store.Spec.Gateway.Instances = 1
|
|
}
|
|
|
|
// start a new deployment and scale up
|
|
desiredRgwInstances := int(c.store.Spec.Gateway.Instances)
|
|
// If running on Pacific we force a single deployment and later set the deployment replica to the "instances" value
|
|
if c.clusterInfo.CephVersion.IsAtLeastPacific() {
|
|
desiredRgwInstances = 1
|
|
}
|
|
for i := 0; i < desiredRgwInstances; i++ {
|
|
var err error
|
|
|
|
daemonLetterID := k8sutil.IndexToName(i)
|
|
// Each rgw is id'ed by <store_name>-<letterID>
|
|
daemonName := fmt.Sprintf("%s-%s", c.store.Name, daemonLetterID)
|
|
// resource name is rook-ceph-rgw-<store_name>-<daemon_name>
|
|
resourceName := fmt.Sprintf("%s-%s-%s", AppName, c.store.Name, daemonLetterID)
|
|
|
|
rgwConfig := &rgwConfig{
|
|
ResourceName: resourceName,
|
|
DaemonID: daemonName,
|
|
Realm: realmName,
|
|
ZoneGroup: zoneGroupName,
|
|
Zone: zoneName,
|
|
}
|
|
|
|
// We set the owner reference of the Secret to the Object controller instead of the replicaset
|
|
// because we watch for that resource and reconcile if anything happens to it
|
|
_, err = c.generateKeyring(rgwConfig)
|
|
if err != nil {
|
|
return errors.Wrap(err, "failed to create rgw keyring")
|
|
}
|
|
|
|
// Check for existing deployment and set the daemon config flags
|
|
_, err = c.context.Clientset.AppsV1().Deployments(c.store.Namespace).Get(ctx, rgwConfig.ResourceName, metav1.GetOptions{})
|
|
// We don't need to handle any error here
|
|
if err != nil {
|
|
// Apply the flag only when the deployment is not found
|
|
if kerrors.IsNotFound(err) {
|
|
logger.Info("setting rgw config flags")
|
|
err = c.setDefaultFlagsMonConfigStore(rgwConfig.ResourceName)
|
|
if err != nil {
|
|
return errors.Wrap(err, "failed to set default rgw config options")
|
|
}
|
|
}
|
|
}
|
|
|
|
// Create deployment
|
|
deployment, err := c.createDeployment(rgwConfig)
|
|
if err != nil {
|
|
return nil
|
|
}
|
|
logger.Infof("object store %q deployment %q started", c.store.Name, deployment.Name)
|
|
|
|
// Set owner ref to cephObjectStore object
|
|
err = c.ownerInfo.SetControllerReference(deployment)
|
|
if err != nil {
|
|
return errors.Wrapf(err, "failed to set owner reference for rgw deployment %q", deployment.Name)
|
|
}
|
|
|
|
// Set the deployment hash as an annotation
|
|
err = patch.DefaultAnnotator.SetLastAppliedAnnotation(deployment)
|
|
if err != nil {
|
|
return errors.Wrapf(err, "failed to set annotation for deployment %q", deployment.Name)
|
|
}
|
|
|
|
_, createErr := c.context.Clientset.AppsV1().Deployments(c.store.Namespace).Create(ctx, deployment, metav1.CreateOptions{})
|
|
if createErr != nil {
|
|
if !kerrors.IsAlreadyExists(createErr) {
|
|
return errors.Wrap(createErr, "failed to create rgw deployment")
|
|
}
|
|
logger.Infof("object store %q deployment %q already exists. updating if needed", c.store.Name, deployment.Name)
|
|
if err := updateDeploymentAndWait(c.context, c.clusterInfo, deployment, config.RgwType, daemonLetterID, c.clusterSpec.SkipUpgradeChecks, c.clusterSpec.ContinueUpgradeAfterChecksEvenIfNotHealthy); err != nil {
|
|
return errors.Wrapf(err, "failed to update object store %q deployment %q", c.store.Name, deployment.Name)
|
|
}
|
|
}
|
|
|
|
// Generate the mime.types file after the rep. controller as well for the same reason as keyring
|
|
if err := c.generateMimeTypes(); err != nil {
|
|
return errors.Wrap(err, "failed to generate the rgw mime.types config")
|
|
}
|
|
}
|
|
|
|
// scale down scenario
|
|
deps, err := k8sutil.GetDeployments(c.context.Clientset, c.store.Namespace, c.storeLabelSelector())
|
|
if err != nil {
|
|
logger.Warningf("could not get deployments for object store %q (matching label selector %q). %v", c.store.Name, c.storeLabelSelector(), err)
|
|
}
|
|
|
|
currentRgwInstances := int(len(deps.Items))
|
|
if currentRgwInstances > desiredRgwInstances {
|
|
logger.Infof("found more rgw deployments %d than desired %d in object store %q, scaling down", currentRgwInstances, c.store.Spec.Gateway.Instances, c.store.Name)
|
|
diffCount := currentRgwInstances - desiredRgwInstances
|
|
for i := 0; i < diffCount; {
|
|
depIDToRemove := currentRgwInstances - 1
|
|
depNameToRemove := fmt.Sprintf("%s-%s-%s", AppName, c.store.Name, k8sutil.IndexToName(depIDToRemove))
|
|
if err := k8sutil.DeleteDeployment(c.context.Clientset, c.store.Namespace, depNameToRemove); err != nil {
|
|
logger.Warningf("error during deletion of deployment %q resource. %v", depNameToRemove, err)
|
|
}
|
|
currentRgwInstances = currentRgwInstances - 1
|
|
i++
|
|
|
|
// Delete the Secret key
|
|
secretToRemove := c.generateSecretName(k8sutil.IndexToName(depIDToRemove))
|
|
err = c.context.Clientset.CoreV1().Secrets(c.store.Namespace).Delete(ctx, secretToRemove, metav1.DeleteOptions{})
|
|
if err != nil && !kerrors.IsNotFound(err) {
|
|
logger.Warningf("failed to delete rgw secret %q. %v", secretToRemove, err)
|
|
}
|
|
|
|
err := c.deleteRgwCephObjects(depNameToRemove)
|
|
if err != nil {
|
|
logger.Warningf("%v", err)
|
|
}
|
|
}
|
|
// verify scale down was successful
|
|
deps, err = k8sutil.GetDeployments(c.context.Clientset, c.store.Namespace, c.storeLabelSelector())
|
|
if err != nil {
|
|
logger.Warningf("could not get deployments for object store %q (matching label selector %q). %v", c.store.Name, c.storeLabelSelector(), err)
|
|
}
|
|
currentRgwInstances = len(deps.Items)
|
|
if currentRgwInstances == desiredRgwInstances {
|
|
logger.Infof("successfully scaled down rgw deployments to %d in object store %q", desiredRgwInstances, c.store.Name)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// Delete the object store.
|
|
// WARNING: This is a very destructive action that deletes all metadata and data pools.
|
|
func (c *clusterConfig) deleteStore() {
|
|
logger.Infof("deleting object store %q from namespace %q", c.store.Name, c.store.Namespace)
|
|
|
|
if !c.clusterSpec.External.Enable {
|
|
// Delete rgw CephX keys and configuration in centralized mon database
|
|
for i := 0; i < int(c.store.Spec.Gateway.Instances); i++ {
|
|
daemonLetterID := k8sutil.IndexToName(i)
|
|
depNameToRemove := fmt.Sprintf("%s-%s-%s", AppName, c.store.Name, daemonLetterID)
|
|
|
|
err := c.deleteRgwCephObjects(depNameToRemove)
|
|
if err != nil {
|
|
logger.Errorf("failed to delete rgw CephX keys and configuration. Error: %v", err)
|
|
}
|
|
}
|
|
|
|
// Delete the realm and pools
|
|
objContext, err := NewMultisiteContext(c.context, c.clusterInfo, c.store)
|
|
if err != nil {
|
|
logger.Errorf("failed to set multisite on object store %q. Error: %v", c.store.Name, err)
|
|
}
|
|
|
|
objContext.Endpoint = c.store.Status.Info["endpoint"]
|
|
|
|
go disableRGWDashboard(objContext)
|
|
|
|
err = deleteRealmAndPools(objContext, c.store.Spec)
|
|
if err != nil {
|
|
logger.Errorf("failed to delete the realm and pools. Error: %v", err)
|
|
}
|
|
}
|
|
|
|
logger.Infof("done deleting object store %q from namespace %q", c.store.Name, c.store.Namespace)
|
|
}
|
|
|
|
func (c *clusterConfig) deleteRgwCephObjects(depNameToRemove string) error {
|
|
logger.Infof("deleting rgw CephX key and configuration in centralized mon database for %q", depNameToRemove)
|
|
|
|
// Delete configuration in centralized mon database
|
|
err := c.deleteFlagsMonConfigStore(depNameToRemove)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = cephclient.AuthDelete(c.context, c.clusterInfo, generateCephXUser(depNameToRemove))
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
logger.Infof("completed deleting rgw CephX key and configuration in centralized mon database for %q", depNameToRemove)
|
|
return nil
|
|
}
|
|
|
|
func instanceName(name string) string {
|
|
return fmt.Sprintf("%s-%s", AppName, name)
|
|
}
|
|
|
|
func (c *clusterConfig) storeLabelSelector() string {
|
|
return fmt.Sprintf("rook_object_store=%s", c.store.Name)
|
|
}
|
|
|
|
// Validate the object store arguments
|
|
func (r *ReconcileCephObjectStore) validateStore(s *cephv1.CephObjectStore) error {
|
|
if err := cephv1.ValidateObjectSpec(s); err != nil {
|
|
return err
|
|
}
|
|
|
|
// Validate the pool settings, but allow for empty pools specs in case they have already been created
|
|
// such as by the ceph mgr
|
|
if !emptyPool(s.Spec.MetadataPool) {
|
|
if err := pool.ValidatePoolSpec(r.context, r.clusterInfo, r.clusterSpec, &s.Spec.MetadataPool); err != nil {
|
|
return errors.Wrap(err, "invalid metadata pool spec")
|
|
}
|
|
}
|
|
if !emptyPool(s.Spec.DataPool) {
|
|
if err := pool.ValidatePoolSpec(r.context, r.clusterInfo, r.clusterSpec, &s.Spec.DataPool); err != nil {
|
|
return errors.Wrap(err, "invalid data pool spec")
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (c *clusterConfig) generateSecretName(id string) string {
|
|
return fmt.Sprintf("%s-%s-%s-keyring", AppName, c.store.Name, id)
|
|
}
|
|
|
|
func emptyPool(pool cephv1.PoolSpec) bool {
|
|
return reflect.DeepEqual(pool, cephv1.PoolSpec{})
|
|
}
|
|
|
|
// BuildDomainName build the dns name to reach out the service endpoint
|
|
func BuildDomainName(name, namespace string) string {
|
|
return fmt.Sprintf("%s-%s.%s.%s", AppName, name, namespace, svcDNSSuffix)
|
|
}
|
|
|
|
// buildDNSEndpoint build the dns name to reach out the service endpoint
|
|
func buildDNSEndpoint(domainName string, port int32, secure bool) string {
|
|
httpPrefix := "http"
|
|
if secure {
|
|
httpPrefix = "https"
|
|
}
|
|
return fmt.Sprintf("%s://%s:%d", httpPrefix, domainName, port)
|
|
}
|