Merge pull request #10283 from rook/mergify/bp/release-1.8/pr-10279

operator: rename telemetry rook-version to rook/version (backport #10279)
This commit is contained in:
mergify[bot] authored and GitHub committed 2022-05-19 20:39:11 +00:00
commit db185e3715
2 files changed
+46 -13

No files matched your search

+2 -13
View File
@@ -33,13 +33,13 @@ 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"
opcontroller "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"
@@ -481,7 +481,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)
@@ -527,14 +527,3 @@ func (c *cluster) postMonStartupActions() 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)
}
}