core: remove unnecessary secret validation
We don't need to validate the name of Ceph-CSI secret, simply because
the names can be different. The default example have default names but
since the secret can be created by the administrator we should not
assume anything. This check will fail if the secret names are different
for whatever reason. This is especially true for external mode. In
converged mode Rook creates the secrets on its own if needed to ease the
integration with the default StorageClass examples.
Signed-off-by: Sébastien Han <seb@redhat.com>
(cherry picked from commit 0143a8f8ee)
This commit is contained in:
1 parent
793f999887
commit
6722d697f8
1 file changed
-39
@@ -32,7 +32,6 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
"github.com/rook/rook/pkg/clusterd"
|
||||
cephclient "github.com/rook/rook/pkg/daemon/ceph/client"
|
||||
"github.com/rook/rook/pkg/operator/ceph/csi"
|
||||
"github.com/rook/rook/pkg/operator/k8sutil"
|
||||
"github.com/rook/rook/pkg/util/exec"
|
||||
"github.com/rook/rook/pkg/util/sys"
|
||||
@@ -162,47 +161,9 @@ func CreateOrLoadClusterInfo(clusterdContext *clusterd.Context, context context.
|
||||
clusterInfo.CephCred.Secret = string(secret.Data["userKey"])
|
||||
}
|
||||
|
||||
if err := ValidateCephCSIConnectionSecrets(clusterdContext, namespace); err != nil {
|
||||
return nil, maxMonID, monMapping, err
|
||||
}
|
||||
|
||||
return clusterInfo, maxMonID, monMapping, nil
|
||||
}
|
||||
|
||||
// ValidateCephCSIConnectionSecrets returns the secret value of the client health checker key
|
||||
func ValidateCephCSIConnectionSecrets(clusterdContext *clusterd.Context, namespace string) error {
|
||||
ctx := context.TODO()
|
||||
_, err := clusterdContext.Clientset.CoreV1().Secrets(namespace).Get(ctx, csi.CsiRBDNodeSecret, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
if !kerrors.IsNotFound(err) {
|
||||
return errors.Wrapf(err, "failed to get %q secret", csi.CsiRBDNodeSecret)
|
||||
}
|
||||
}
|
||||
|
||||
_, err = clusterdContext.Clientset.CoreV1().Secrets(namespace).Get(ctx, csi.CsiRBDProvisionerSecret, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
if !kerrors.IsNotFound(err) {
|
||||
return errors.Wrapf(err, "failed to get %q secret", csi.CsiRBDProvisionerSecret)
|
||||
}
|
||||
}
|
||||
|
||||
_, err = clusterdContext.Clientset.CoreV1().Secrets(namespace).Get(ctx, csi.CsiCephFSNodeSecret, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
if !kerrors.IsNotFound(err) {
|
||||
return errors.Wrapf(err, "failed to get %q secret", csi.CsiCephFSNodeSecret)
|
||||
}
|
||||
}
|
||||
|
||||
_, err = clusterdContext.Clientset.CoreV1().Secrets(namespace).Get(ctx, csi.CsiCephFSProvisionerSecret, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
if !kerrors.IsNotFound(err) {
|
||||
return errors.Wrapf(err, "failed to get %q secret", csi.CsiCephFSProvisionerSecret)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// WriteConnectionConfig save monitor connection config to disk
|
||||
func WriteConnectionConfig(context *clusterd.Context, clusterInfo *cephclient.ClusterInfo) error {
|
||||
// write the latest config to the config dir
|
||||
|
||||
Reference in new issue
Block a user