Merge pull request #10279 from BlaineEXE/rename-telemetry-rook-version

operator: rename telemetry rook-version to rook/version
This commit is contained in:
Blaine Gardner authored and GitHub committed 2022-05-18 18:10:26 -06:00
commit 1cdcb37461
2 files changed
+46 -13

No files matched your search

+2 -13
View File
@@ -34,12 +34,12 @@ import (
"github.com/rook/rook/pkg/operator/ceph/cluster/mgr"
"github.com/rook/rook/pkg/operator/ceph/cluster/mon"
"github.com/rook/rook/pkg/operator/ceph/cluster/osd"
"github.com/rook/rook/pkg/operator/ceph/cluster/telemetry"
"github.com/rook/rook/pkg/operator/ceph/config"
"github.com/rook/rook/pkg/operator/ceph/controller"
"github.com/rook/rook/pkg/operator/ceph/csi"
cephver "github.com/rook/rook/pkg/operator/ceph/version"
"github.com/rook/rook/pkg/operator/k8sutil"
rookversion "github.com/rook/rook/pkg/version"
v1 "k8s.io/api/core/v1"
kerrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -487,7 +487,7 @@ func (c *cluster) skipMDSSanityChecks(skip bool) error {
// Basically, it is executed between the monitors and the manager sequence
func (c *cluster) postMonStartupActions() error {
// Identify this as a rook cluster for Ceph telemetry by setting the Rook version.
c.setRookVersionInCephKVStore()
telemetry.SetRookVersion(c.context, c.ClusterInfo)
// Create CSI Kubernetes Secrets
err := csi.CreateCSISecrets(c.context, c.ClusterInfo)
@@ -575,14 +575,3 @@ func (c *cluster) configureMsgr2() error {
}
return nil
}
// set the Rook version in Ceph's k/v store to allow Rook clusters that enable Ceph telemetry to be
// identified easily as Rook clusters while additionally providing potentially useful information
// about the version of Rook that is managing the cluster.
// e.g., rook-version=v1.8.7
func (c *cluster) setRookVersionInCephKVStore() {
ms := config.GetMonStore(c.context, c.ClusterInfo)
if err := ms.SetKeyValue(k8sutil.RookVersionLabelKey, rookversion.Version); err != nil {
logger.Warningf("failed to set telemetry key; this cluster may not be identifiable by ceph telemetry as a Rook cluster. %v", err)
}
}
@@ -0,0 +1,44 @@
/*
Copyright 2022 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 telemetry codifes the Rook telemetry spec used to record Rook information for Ceph
// telemetry. See: https://docs.ceph.com/en/latest/mgr/telemetry/
package telemetry
import (
"github.com/coreos/pkg/capnslog"
"github.com/rook/rook/pkg/clusterd"
"github.com/rook/rook/pkg/daemon/ceph/client"
"github.com/rook/rook/pkg/operator/ceph/config"
rookversion "github.com/rook/rook/pkg/version"
)
var logger = capnslog.NewPackageLogger("github.com/rook/rook", "telemetry")
const (
RookVersionKey = `rook/version`
)
// SetRookVersion sets the Rook version in Ceph's config-key store to allow Rook clusters that
// enable Ceph telemetry to be identified easily as Rook clusters while additionally providing
// useful information about the version of Rook that is managing the cluster.
// e.g., rook/version=v1.8.7
func SetRookVersion(context *clusterd.Context, clusterInfo *client.ClusterInfo) {
ms := config.GetMonStore(context, clusterInfo)
if err := ms.SetKeyValue(RookVersionKey, rookversion.Version); err != nil {
logger.Warningf("failed to set telemetry key; this cluster may not be identifiable by ceph telemetry as a Rook cluster. %v", err)
}
}