-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add lm-eval-service controller (#258)
* feat: Initial database support (#246) * Initial database support - Add status checking - Add better storage flags - Add spec.storage.format validation - Add DDL -Add HIBERNATE format to DB (test) - Update service image - Revert identifier to DATABASE - Update CR options (remove mandatory data) * Remove default DDL generation env var * Update service image to latest tag * Add migration awareness * Add updating pods for migration * Change JDBC url from mysql to mariadb * Fix TLS mount * Revert images * Remove redundant logic * Fix comments * feat: Add TLS certificate mount on ModelMesh (#255) * feat: Add TLS certificate mount on ModelMesh * Revert from http to https until kserve/modelmesh#147 is merged * Add lm-eval-service controller refactor the existing TrustyAIService controller and add LMEvalService controller Signed-off-by: Yihong Wang <[email protected]> --------- Signed-off-by: Yihong Wang <[email protected]> Co-authored-by: Rui Vieira <[email protected]>
- Loading branch information
Showing
76 changed files
with
5,764 additions
and
983 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FROM registry.access.redhat.com/ubi8/go-toolset:1.21 AS builder | ||
|
||
WORKDIR /go/src/github.com/trustyai-explainability/trustyai-service-operator | ||
COPY . . | ||
|
||
RUN GO111MODULE=on CGO_ENABLED=0 GOOS=linux go build -tags netgo -ldflags '-extldflags "-static"' -o /bin/driver ./cmd/lmes_driver/*.go | ||
|
||
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest | ||
|
||
COPY --from=builder /bin/driver /bin/driver | ||
|
||
USER 65532:65532 | ||
|
||
WORKDIR /bin | ||
|
||
ENTRYPOINT [ "/bin/driver" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
Copyright 2024. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
// Package v1alpha1 contains API Schema definitions for the trustyai.opendatahub.io v1alpha1 API group | ||
// +kubebuilder:object:generate=true | ||
// +groupName=trustyai.opendatahub.io | ||
package v1alpha1 | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
"sigs.k8s.io/controller-runtime/pkg/scheme" | ||
) | ||
|
||
const ( | ||
GroupName = "trustyai.opendatahub.io" | ||
Version = "v1alpha1" | ||
KindName = "LMEvalJob" | ||
FinalizerName = "trustyai.opendatahub.io/lmes-finalizer" | ||
) | ||
|
||
var ( | ||
// GroupVersion is group version used to register these objects | ||
GroupVersion = schema.GroupVersion{Group: GroupName, Version: Version} | ||
|
||
// SchemeBuilder is used to add go types to the GroupVersionKind scheme | ||
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} | ||
|
||
// AddToScheme adds the types in this group-version to the given scheme. | ||
AddToScheme = SchemeBuilder.AddToScheme | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
/* | ||
Copyright 2024. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
corev1 "k8s.io/api/core/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! | ||
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. | ||
|
||
// Represent a job's status | ||
// +kubebuilder:validation:Enum=New;Scheduled;Running;Complete;Cancelled | ||
type JobState string | ||
|
||
const ( | ||
// The job is just created | ||
NewJobState JobState = "New" | ||
// The job is scheduled and waiting for available resources to run it | ||
ScheduledJobState JobState = "Scheduled" | ||
// The job is running | ||
RunningJobState JobState = "Running" | ||
// The job is complete | ||
CompleteJobState JobState = "Complete" | ||
// The job is cancelled | ||
CancelledJobState JobState = "Cancelled" | ||
) | ||
|
||
// +kubebuilder:validation:Enum=NoReason;Succeeded;Failed;Cancelled | ||
type Reason string | ||
|
||
const ( | ||
// Job is still running and no final result yet | ||
NoReason Reason = "NoReason" | ||
// Job finished successfully | ||
SucceedReason Reason = "Succeeded" | ||
// Job failed | ||
FailedReason Reason = "Failed" | ||
// Job is cancelled | ||
CancelledReason Reason = "Cancelled" | ||
) | ||
|
||
type Arg struct { | ||
Name string `json:"name"` | ||
Value string `json:"value,omitempty"` | ||
} | ||
|
||
type EnvSecret struct { | ||
// Environment's name | ||
Env string `json:"env"` | ||
// The secret is from a secret object | ||
// +optional | ||
SecretRef *corev1.SecretKeySelector `json:"secretRef,omitempty"` | ||
// The secret is from a plain text | ||
// +optional | ||
Secret *string `json:"secret,omitempty"` | ||
} | ||
|
||
type FileSecret struct { | ||
// The secret object | ||
SecretRef corev1.SecretVolumeSource `json:"secretRef,omitempty"` | ||
// The path to mount the secret | ||
MountPath string `json:"mountPath"` | ||
} | ||
|
||
// LMEvalJobSpec defines the desired state of LMEvalJob | ||
type LMEvalJobSpec struct { | ||
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster | ||
// Important: Run "make" to regenerate code after modifying this file | ||
|
||
// Model name | ||
Model string `json:"model"` | ||
// Args for the model | ||
// +optional | ||
ModelArgs []Arg `json:"modelArgs,omitempty"` | ||
// Evaluation tasks | ||
Tasks []string `json:"tasks"` | ||
// Sets the number of few-shot examples to place in context | ||
// +optional | ||
NumFewShot *int `json:"numFewShot,omitempty"` | ||
// Accepts an integer, or a float between 0.0 and 1.0 . If passed, will limit | ||
// the number of documents to evaluate to the first X documents (if an integer) | ||
// per task or first X% of documents per task | ||
// +optional | ||
Limit string `json:"limit,omitempty"` | ||
// Map to `--gen_kwargs` parameter for the underlying library. | ||
// +optional | ||
GenArgs []Arg `json:"genArgs,omitempty"` | ||
// If this flag is passed, then the model's outputs, and the text fed into the | ||
// model, will be saved at per-document granularity | ||
// +optional | ||
LogSamples *bool `json:"logSamples,omitempty"` | ||
// Assign secrets to the environment variables | ||
// +optional | ||
EnvSecrets []EnvSecret `json:"envSecrets,omitempty"` | ||
// Use secrets as files | ||
FileSecrets []FileSecret `json:"fileSecrets,omitempty"` | ||
} | ||
|
||
// LMEvalJobStatus defines the observed state of LMEvalJob | ||
type LMEvalJobStatus struct { | ||
// Important: Run "make" to regenerate code after modifying this file | ||
|
||
// The name of the Pod that runs the evaluation job | ||
// +optional | ||
PodName string `json:"podName,omitempty"` | ||
// State of the job | ||
// +optional | ||
State JobState `json:"state,omitempty"` | ||
// Final result of the job | ||
// +optional | ||
Reason Reason `json:"reason,omitempty"` | ||
// Message about the current/final status | ||
// +optional | ||
Message string `json:"message,omitempty"` | ||
// Information when was the last time the job was successfully scheduled. | ||
// +optional | ||
LastScheduleTime *metav1.Time `json:"lastScheduleTime,omitempty"` | ||
// Information when the job's state changes to Complete. | ||
// +optional | ||
CompleteTime *metav1.Time `json:"completeTime,omitempty"` | ||
// Evaluation results | ||
// +optional | ||
Results string `json:"results,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:subresource:status | ||
|
||
// LMEvalJob is the Schema for the lmevaljobs API | ||
type LMEvalJob struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec LMEvalJobSpec `json:"spec,omitempty"` | ||
Status LMEvalJobStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// LMEvalJobList contains a list of LMEvalJob | ||
type LMEvalJobList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []LMEvalJob `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&LMEvalJob{}, &LMEvalJobList{}) | ||
} |
Oops, something went wrong.