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

feat: add managed model registry prometheus config handling logic, fixes RHOAIENG-4273 #1150

Merged
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
2 changes: 2 additions & 0 deletions components/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ func (c *Component) UpdatePrometheusConfig(_ client.Client, enable bool, compone
KueueARules string `yaml:"kueue-alerting.rules"`
TrainingOperatorRRules string `yaml:"trainingoperator-recording.rules"`
TrainingOperatorARules string `yaml:"trainingoperator-alerting.rules"`
ModelRegistryRRules string `yaml:"model-registry-operator-recording.rules"`
ModelRegistryARules string `yaml:"model-registry-operator-alerting.rules"`
} `yaml:"data"`
}
var configMap ConfigMap
Expand Down
20 changes: 20 additions & 0 deletions components/modelregistry/modelregistry.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ func (m *ModelRegistry) ReconcileComponent(ctx context.Context, cli client.Clien
"IMAGES_REST_SERVICE": "RELATED_IMAGE_ODH_MODEL_REGISTRY_IMAGE",
}
enabled := m.GetManagementState() == operatorv1.Managed
monitoringEnabled := dscispec.Monitoring.ManagementState == operatorv1.Managed

if enabled {
if m.DevFlags != nil {
Expand Down Expand Up @@ -102,5 +103,24 @@ func (m *ModelRegistry) ReconcileComponent(ctx context.Context, cli client.Clien
}
l.Info("apply extra manifests done")

// CloudService Monitoring handling
if platform == cluster.ManagedRhods {
if enabled {
if err := cluster.WaitForDeploymentAvailable(ctx, cli, ComponentName, dscispec.ApplicationsNamespace, 10, 1); err != nil {
return fmt.Errorf("deployment for %s is not ready to server: %w", ComponentName, err)
}
l.Info("deployment is done, updating monitoring rules")
}
if err := m.UpdatePrometheusConfig(cli, enabled && monitoringEnabled, ComponentName); err != nil {
return err
}
if err := deploy.DeployManifestsFromPath(ctx, cli, owner,
filepath.Join(deploy.DefaultManifestPath, "monitoring", "prometheus", "apps"),
dscispec.Monitoring.Namespace,
"prometheus", true); err != nil {
return err
}
l.Info("updating SRE monitoring done")
}
return nil
}
Loading