Skip to content

Commit 6698aaa

Browse files
committed
More unit test fixes
1 parent 3b89a57 commit 6698aaa

31 files changed

+124
-123
lines changed

controllers/gorch/deployment.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type DeploymentConfig struct {
2323
ContainerImages ContainerImages
2424
}
2525

26-
const deploymentTemplate = "gorch/templates/deployment.tmpl.yaml"
26+
const deploymentTemplate = "deployment.tmpl.yaml"
2727

2828
func (r *GuardrailsOrchestratorReconciler) createDeployment(ctx context.Context, orchestrator *gorchv1alpha1.GuardrailsOrchestrator) *appsv1.Deployment {
2929
var containerImages ContainerImages

controllers/gorch/guardrailsorchestrator_controller.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,12 @@ import (
3636
"sigs.k8s.io/controller-runtime/pkg/manager"
3737
)
3838

39-
const serviceTemplate = "gorch/templates/service.tmpl.yaml"
40-
const healthRouteTemplate = "gorch/templates/health-route.tmpl.yaml"
41-
const httpsRouteTemplate = "gorch/templates/https-route.tmpl.yaml"
39+
const (
40+
serviceTemplate = "service.tmpl.yaml"
41+
routeTemplate = "route.tmpl.yaml"
42+
httpsRoutePort = "https"
43+
healthRoutePort = "health"
44+
)
4245

4346
// GuardrailsOrchestratorReconciler reconciles a GuardrailsOrchestrator object
4447
type GuardrailsOrchestratorReconciler struct {
@@ -190,15 +193,16 @@ func (r *GuardrailsOrchestratorReconciler) Reconcile(ctx context.Context, req ct
190193
return ctrl.Result{}, err
191194
}
192195

193-
_, err = utils.ReconcileRoute(ctx, r.Client, orchestrator, httpsRouteTemplate, templateParser.ParseResource)
196+
_, err = utils.ReconcileRoute(ctx, r.Client, orchestrator, orchestrator.Name, httpsRoutePort, routeTemplate, templateParser.ParseResource)
194197
if err != nil {
195-
log.Error(err, "Failed to reconcile service")
198+
log.Error(err, "Failed to reconcile https route")
196199
return ctrl.Result{}, err
197200
}
198201

199-
_, err = utils.ReconcileRoute(ctx, r.Client, orchestrator, healthRouteTemplate, templateParser.ParseResource)
202+
healthRouteName := orchestrator.Name + "-" + healthRoutePort
203+
_, err = utils.ReconcileRoute(ctx, r.Client, orchestrator, healthRouteName, healthRoutePort, routeTemplate, templateParser.ParseResource)
200204
if err != nil {
201-
log.Error(err, "Failed to reconcile service")
205+
log.Error(err, "Failed to reconcile health route")
202206
return ctrl.Result{}, err
203207
}
204208

controllers/gorch/service_account.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"sigs.k8s.io/controller-runtime/pkg/log"
1111
)
1212

13-
const serviceAccountTemplatePath = "gorch/templates/serviceaccount.tmpl.yaml"
13+
const serviceAccountTemplatePath = "serviceaccount.tmpl.yaml"
1414

1515
type ServiceAccountConfig struct {
1616
Orchestrator *gorchv1alpha1.GuardrailsOrchestrator

controllers/gorch/templates/https-route.tmpl.yaml

Lines changed: 0 additions & 19 deletions
This file was deleted.

controllers/gorch/templates/parser.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ var templateFS embed.FS
1111

1212
func ParseResource[T any](templatePath string, data interface{}, outType reflect.Type) (*T, error) {
1313
return utils.ParseResourceFromFS[T](templatePath, data, outType, templateFS)
14-
}
14+
}

controllers/gorch/templates/health-route.tmpl.yaml renamed to controllers/gorch/templates/route.tmpl.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
kind: Route
22
apiVersion: route.openshift.io/v1
33
metadata:
4-
name: {{.Owner.Name}}-health
4+
name: {{.RouteName}}
55
namespace: {{.Owner.Namespace}}
66
labels:
77
app: {{.Owner.Name}}
@@ -12,7 +12,7 @@ spec:
1212
name: {{.Owner.Name}}-service
1313
weight: 100
1414
port:
15-
targetPort: health
15+
targetPort: {{.RoutePort}}
1616
tls:
1717
termination: edge
1818
insecureEdgeTerminationPolicy: Redirect
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ "__type__": "task_card", "loader": { "__type__": "load_hf", "path": "wmt16", "name": "de-en" }, "preprocess_steps": [ { "__type__": "copy", "field": "translation/en", "to_field": "text" }, { "__type__": "copy", "field": "translation/de", "to_field": "translation" }, { "__type__": "set", "fields": { "source_language": "english", "target_language": "deutch" } } ], "task": "tasks.translation.directed", "templates": "templates.translation.directed.all" }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"__type__": "llm_as_judge", "inference_model": { "__type__": "hf_pipeline_based_inference_engine", "model_name": "mistralai/Mistral-7B-Instruct-v0.2", "max_new_tokens": 256, "use_fp16": true }, "template": "templates.response_assessment.rating.mt_bench_single_turn", "task": "rating.single_turn", "format": "formats.models.mistral.instruction", "main_score": "mistral_7b_instruct_v0_2_huggingface_template_mt_bench_single_turn"}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ "__type__": "textual_system_prompt", "text": "this is a custom system prompt" }
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ "__type__": "task", "input_fields": { "input": "str", "type_of_input": "str", "type_of_output": "str" }, "reference_fields": { "output": "str" }, "prediction_type": "str", "metrics": [ "metrics.normalized_sacrebleu" ], "augmentable_inputs": [ "input" ], "defaults": { "type_of_output": "Text" } }

0 commit comments

Comments
 (0)