Skip to content

Commit

Permalink
feat: add managed model registry prometheus config handling logic, pa…
Browse files Browse the repository at this point in the history
…rt of RHOAIENG-4273 (#1150)
  • Loading branch information
dhirajsb authored Aug 2, 2024
1 parent 31185c3 commit 72fc80f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
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
}

0 comments on commit 72fc80f

Please sign in to comment.