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

Update LMEvalJob CRD to pass secrets #23

Merged
merged 1 commit into from
Jul 24, 2024
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
49 changes: 48 additions & 1 deletion api/OpenAPI.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
openapi: 3.1.0
openapi: '3.1.0'
info:
title: LM Evaluation Harness API
description: API for submitting, polling, and retrieving results of LM Evaluation Harness jobs.
Expand Down Expand Up @@ -56,6 +56,53 @@ paths:
include_path:
type: string
description: Path to include in the evaluation.
secrets:
type: array
description: Provide the secrets to run the evulation job
items:
type: object
description: create environment variables to store the secrets or mount the secrets as files
oneOf:
- properties:
mountPath:
type: string
description: where to mount the secret object to
referenceObj:
type: object
description: use a secret object
properties:
name:
type: string
description: secret object's name
files:
type: array
description: specify the keys in a secret object and the path
items:
type: object
properties:
key:
type: string
description: specify the key of the secret object
path:
type: string
description: specify the file path
- properties:
env:
type: string
description: use the environment variable to access the secret
key:
type: string
description: the secret value
referenceObj:
type: object
description: use a secret object
properties:
name:
type: string
description: secret object's name
key:
type: string
description: specify the key of the secret object
required:
- model
- tasks
Expand Down
25 changes: 24 additions & 1 deletion api/v1beta1/lmevaljob_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package v1beta1

import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down Expand Up @@ -59,9 +60,26 @@ type Arg struct {
Value string `json:"value,omitempty"`
}

type EnvSecret struct {
yhwang marked this conversation as resolved.
Show resolved Hide resolved
// 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
Expand All @@ -86,6 +104,11 @@ type LMEvalJobSpec struct {
// 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
Expand Down
Loading
Loading