Skip to content

Commit bf9d8fd

Browse files
authored
fix: Use correct ConfigMap for orchestrator image config (trustyai-explainability#420)
1 parent 70cd5c7 commit bf9d8fd

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

controllers/gorch/configmap.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ func (r *GuardrailsOrchestratorReconciler) getImageFromConfigMap(ctx context.Con
1414
err := r.Get(ctx, types.NamespacedName{Name: configMapName, Namespace: namespace}, configMap)
1515
if err != nil {
1616
if errors.IsNotFound(err) {
17-
return "", nil
17+
return "", fmt.Errorf("could not find configmap %s on namespace %s", configMapName, namespace)
1818
}
19-
return "", fmt.Errorf("error reading configmap %s", configMapName)
19+
return "", fmt.Errorf("error reading configmap %s on namespace %s", configMapName, namespace)
2020
}
2121

2222
containerImage, ok := configMap.Data[configMapKey]
2323

2424
if !ok {
25-
return "", fmt.Errorf("configmap %s does not contain necessary keys", configMapName)
25+
return "", fmt.Errorf("configmap %s on namespace %s does not contain necessary keys", configMapName, namespace)
2626
}
2727
return containerImage, nil
2828
}

controllers/gorch/deployment.go

+6-3
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,26 @@ type DeploymentConfig struct {
3737
func (r *GuardrailsOrchestratorReconciler) createDeployment(ctx context.Context, orchestrator *gorchv1alpha1.GuardrailsOrchestrator) *appsv1.Deployment {
3838
var containerImages ContainerImages
3939
// Get orchestrator image
40+
orchestratorConfigMapName := orchestrator.Name + "-config"
4041
orchestratorImage, err := r.getImageFromConfigMap(ctx, orchestratorImageKey, constants.ConfigMap, r.Namespace)
4142
if orchestratorImage == "" || err != nil {
4243
log.FromContext(ctx).Error(err, "Error getting container image from ConfigMap.")
4344
}
4445
containerImages.OrchestratorImage = orchestratorImage
45-
46+
log.FromContext(ctx).Info("using orchestratorImage " + orchestratorImage + "from config map " + r.Namespace + ":" + constants.ConfigMap)
4647
// Check if the vLLM gateway is enabled
4748
if orchestrator.Spec.VLLMGatewayConfig != nil {
4849
// Get the gateway and regex detector container images
49-
vllmGatewayImage, err := r.getImageFromConfigMap(ctx, vllmGatewayImageKey, orchestratorName+"-config", orchestrator.Namespace)
50+
vllmGatewayImage, err := r.getImageFromConfigMap(ctx, vllmGatewayImageKey, orchestratorConfigMapName, orchestrator.Namespace)
5051
if vllmGatewayImage == "" || err != nil {
5152
log.FromContext(ctx).Error(err, "Error getting vLLM gateway image from ConfigMap.")
5253
}
53-
regexDetectorImage, err := r.getImageFromConfigMap(ctx, regexDetectorImageKey, orchestratorName+"-config", orchestrator.Namespace)
54+
log.FromContext(ctx).Info("using vLLM gateway image " + vllmGatewayImage + "from config map " + orchestrator.Namespace + ":" + orchestratorConfigMapName)
55+
regexDetectorImage, err := r.getImageFromConfigMap(ctx, regexDetectorImageKey, orchestratorConfigMapName, orchestrator.Namespace)
5456
if regexDetectorImage == "" || err != nil {
5557
log.FromContext(ctx).Error(err, "Error getting regex detectors image from ConfigMap.")
5658
}
59+
log.FromContext(ctx).Info("using regex detectors image " + regexDetectorImage + "from config map " + orchestrator.Namespace + ":" + orchestratorConfigMapName)
5760
containerImages.GatewayImage = vllmGatewayImage
5861
containerImages.RegexDetectorImage = regexDetectorImage
5962
}

0 commit comments

Comments
 (0)