Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hub metrics collector feature #1316

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,21 @@ func (r *PlacementRuleReconciler) Reconcile(ctx context.Context, req ctrl.Reques
return ctrl.Result{}, nil
}

//Check for MulticlusterGlobalHub CRD
mcghCrdExists := r.CRDMap[config.MCGHCrdName]
//if Multicluster Global hub exists we block metrics-collector creation in spokes
if mcghCrdExists {
mco.Spec.ObservabilityAddonSpec.EnableMetrics = false
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@coleenquadros when MCGH CRD is detected, we don't want to standup hub Observability stack either (including Thanos). Not just spokes. We should do this check in https://github.com/stolostron/multicluster-observability-operator/blob/main/operators/multiclusterobservability/controllers/multiclusterobservability/multiclusterobservability_controller.go and bail out if detected.

if !deleteAll && !mco.Spec.ObservabilityAddonSpec.EnableMetrics {
reqLogger.Info("EnableMetrics is set to false. Delete Observability addons")
deleteAll = true
}

// check if the MCH CRD exists
mchCrdExists := r.CRDMap[config.MCHCrdName]
// requeue after 10 seconds if the mch crd exists and image image manifests map is empty
// requeue after 10 seconds if the mch crd exists and image manifests map is empty
if mchCrdExists && len(config.GetImageManifests()) == 0 {
// if the mch CR is not ready, then requeue the request after 10s
return ctrl.Result{RequeueAfter: 10 * time.Second}, nil
Expand Down
7 changes: 7 additions & 0 deletions operators/multiclusterobservability/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,17 @@ func main() {
os.Exit(1)
}

mcghCrdExists, err := operatorsutil.CheckCRDExist(crdClient, config.MCGHCrdName)
if err != nil {
setupLog.Error(err, "")
os.Exit(1)
}

crdMaps := map[string]bool{
config.MCHCrdName: mchCrdExists,
config.StorageVersionMigrationCrdName: svmCrdExists,
config.IngressControllerCRD: ingressCtlCrdExists,
config.MCGHCrdName: mcghCrdExists,
}

if err = (&mcoctrl.MultiClusterObservabilityReconciler{
Expand Down
1 change: 1 addition & 0 deletions operators/multiclusterobservability/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@
IngressControllerCRD = "ingresscontrollers.operator.openshift.io"
MCHCrdName = "multiclusterhubs.operator.open-cluster-management.io"
MCOCrdName = "multiclusterobservabilities.observability.open-cluster-management.io"
MCGHCrdName = "multiclusterglobalhubs.operator.open-cluster-management.io"
StorageVersionMigrationCrdName = "storageversionmigrations.migration.k8s.io"
)

Expand Down Expand Up @@ -632,7 +633,7 @@

// GetClusterID is used to get the cluster uid.
func GetClusterID(ocpClient ocpClientSet.Interface) (string, error) {
clusterVersion, err := ocpClient.ConfigV1().ClusterVersions().Get(context.TODO(), "version", v1.GetOptions{})

Check failure on line 636 in operators/multiclusterobservability/pkg/config/config.go

View workflow job for this annotation

GitHub Actions / Formatters + Linters (Static Analysis) for Go

ocpClient.ConfigV1().ClusterVersions undefined (type "github.com/openshift/client-go/config/clientset/versioned/typed/config/v1".ConfigV1Interface has no field or method ClusterVersions)
if err != nil {
log.Error(err, "Failed to get clusterVersion")
return "", err
Expand Down
Loading