ceph: expose operator ceph base image
We now have a new env variable ROOK_CEPH_BASE_IMAGE_VERSION which contains the ceph version on the operator image. Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
1 parent
d950f4f823
commit
aa8bf4c763
2 files changed
+19
-1
No files matched your search
@@ -17,6 +17,8 @@ limitations under the License.
|
||||
package ceph
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/rook/rook/cmd/rook/rook"
|
||||
"github.com/rook/rook/pkg/clusterd"
|
||||
@@ -31,7 +33,10 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
const containerName = "rook-ceph-operator"
|
||||
const (
|
||||
containerName = "rook-ceph-operator"
|
||||
operatorCephBaseImageVersion = "ROOK_CEPH_BASE_IMAGE_VERSION"
|
||||
)
|
||||
|
||||
var operatorCmd = &cobra.Command{
|
||||
Use: "operator",
|
||||
@@ -79,6 +84,8 @@ func startOperator(cmd *cobra.Command, args []string) error {
|
||||
}
|
||||
|
||||
rookImage := rook.GetOperatorImage(context.Clientset, containerName)
|
||||
rookBaseImageCephVersion := rook.GetOperatorBaseImageCephVersion(context)
|
||||
os.Setenv(operatorCephBaseImageVersion, rookBaseImageCephVersion)
|
||||
serviceAccountName := rook.GetOperatorServiceAccount(context.Clientset)
|
||||
op := operator.New(context, volumeAttachment, rookImage, serviceAccountName)
|
||||
err = op.Run()
|
||||
|
||||
@@ -217,3 +217,14 @@ func TerminateFatal(reason error) {
|
||||
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// GetOperatorBaseImageCephVersion returns the Ceph version of the operator image
|
||||
func GetOperatorBaseImageCephVersion(context *clusterd.Context) string {
|
||||
output, err := context.Executor.ExecuteCommandWithOutput("ceph", "--version")
|
||||
if err != nil {
|
||||
logger.Errorf("failed to discover ceph base image version. %v", err)
|
||||
return ""
|
||||
}
|
||||
|
||||
return output
|
||||
}
|
||||
Reference in new issue
Block a user