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

feat: support more customization for the job pod of the LMES #340

Merged
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
33 changes: 33 additions & 0 deletions api/lmes/v1alpha1/lmevaljob_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@ type LMEvalContainer struct {
// More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
// +optional
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
// SecurityContext defines the security options the container should be run with.
// If set, the fields of SecurityContext override the equivalent fields of PodSecurityContext.
// More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
// +optional
SecurityContext *corev1.SecurityContext `json:"securityContext,omitempty"`
}

// The following Getter-ish functions avoid nil pointer panic
Expand Down Expand Up @@ -183,6 +188,13 @@ type Outputs struct {
PersistentVolumeClaimManaged *PersistentVolumeClaimManaged `json:"pvcManaged,omitempty"`
}

func (c *LMEvalContainer) GetSecurityContext() *corev1.SecurityContext {
if c == nil {
return nil
}
return c.SecurityContext
}

type LMEvalPodSpec struct {
// Extra container data for the lm-eval container
// +optional
Expand All @@ -194,6 +206,13 @@ type LMEvalPodSpec struct {
// FIXME: aggregate the sidecar containers into the pod
// +optional
SideCars []corev1.Container `json:"sideCars,omitempty"`
// If specified, the pod's scheduling constraints
// +optional
Affinity *corev1.Affinity `json:"affinity,omitempty"`
// SecurityContext holds pod-level security attributes and common container settings.
// Optional: Defaults to empty. See type description for default values of each field.
// +optional
SecurityContext *corev1.PodSecurityContext `json:"securityContext,omitempty"`
}

// The following Getter-ish functions avoid nil pointer panic
Expand Down Expand Up @@ -228,6 +247,20 @@ type OfflineSpec struct {
StorageSpec OfflineStorageSpec `json:"storage"`
}

func (p *LMEvalPodSpec) GetAffinity() *corev1.Affinity {
if p == nil {
return nil
}
return p.Affinity
}

func (p *LMEvalPodSpec) GetSecurityContext() *corev1.PodSecurityContext {
if p == nil {
return nil
}
return p.SecurityContext
}

// LMEvalJobSpec defines the desired state of LMEvalJob
type LMEvalJobSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
Expand Down
15 changes: 15 additions & 0 deletions api/lmes/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading