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

fix(RHOAIENG-20116): Use correct ConfigMap for orchestrator image config #420

Merged
merged 1 commit into from
Feb 18, 2025
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
6 changes: 3 additions & 3 deletions controllers/gorch/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ func (r *GuardrailsOrchestratorReconciler) getImageFromConfigMap(ctx context.Con
err := r.Get(ctx, types.NamespacedName{Name: configMapName, Namespace: namespace}, configMap)
if err != nil {
if errors.IsNotFound(err) {
return "", nil
return "", fmt.Errorf("could not find configmap %s on namespace %s", configMapName, namespace)
}
return "", fmt.Errorf("error reading configmap %s", configMapName)
return "", fmt.Errorf("error reading configmap %s on namespace %s", configMapName, namespace)
}

containerImage, ok := configMap.Data[configMapKey]

if !ok {
return "", fmt.Errorf("configmap %s does not contain necessary keys", configMapName)
return "", fmt.Errorf("configmap %s on namespace %s does not contain necessary keys", configMapName, namespace)
}
return containerImage, nil
}
9 changes: 6 additions & 3 deletions controllers/gorch/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,26 @@ type DeploymentConfig struct {
func (r *GuardrailsOrchestratorReconciler) createDeployment(ctx context.Context, orchestrator *gorchv1alpha1.GuardrailsOrchestrator) *appsv1.Deployment {
var containerImages ContainerImages
// Get orchestrator image
orchestratorConfigMapName := orchestrator.Name + "-config"
orchestratorImage, err := r.getImageFromConfigMap(ctx, orchestratorImageKey, constants.ConfigMap, r.Namespace)
if orchestratorImage == "" || err != nil {
log.FromContext(ctx).Error(err, "Error getting container image from ConfigMap.")
}
containerImages.OrchestratorImage = orchestratorImage

log.FromContext(ctx).Info("using orchestratorImage " + orchestratorImage + "from config map " + r.Namespace + ":" + constants.ConfigMap)
// Check if the vLLM gateway is enabled
if orchestrator.Spec.VLLMGatewayConfig != nil {
// Get the gateway and regex detector container images
vllmGatewayImage, err := r.getImageFromConfigMap(ctx, vllmGatewayImageKey, orchestratorName+"-config", orchestrator.Namespace)
vllmGatewayImage, err := r.getImageFromConfigMap(ctx, vllmGatewayImageKey, orchestratorConfigMapName, orchestrator.Namespace)
if vllmGatewayImage == "" || err != nil {
log.FromContext(ctx).Error(err, "Error getting vLLM gateway image from ConfigMap.")
}
regexDetectorImage, err := r.getImageFromConfigMap(ctx, regexDetectorImageKey, orchestratorName+"-config", orchestrator.Namespace)
log.FromContext(ctx).Info("using vLLM gateway image " + vllmGatewayImage + "from config map " + orchestrator.Namespace + ":" + orchestratorConfigMapName)
regexDetectorImage, err := r.getImageFromConfigMap(ctx, regexDetectorImageKey, orchestratorConfigMapName, orchestrator.Namespace)
if regexDetectorImage == "" || err != nil {
log.FromContext(ctx).Error(err, "Error getting regex detectors image from ConfigMap.")
}
log.FromContext(ctx).Info("using regex detectors image " + regexDetectorImage + "from config map " + orchestrator.Namespace + ":" + orchestratorConfigMapName)
containerImages.GatewayImage = vllmGatewayImage
containerImages.RegexDetectorImage = regexDetectorImage
}
Expand Down
Loading