Skip to content

Commit

Permalink
implement genericjob interface
Browse files Browse the repository at this point in the history
Signed-off-by: ted chang <[email protected]>
  • Loading branch information
tedhtchang committed Oct 23, 2024
1 parent e23392b commit 6639b9b
Show file tree
Hide file tree
Showing 9 changed files with 165 additions and 105 deletions.
2 changes: 2 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import (
"github.com/trustyai-explainability/trustyai-service-operator/controllers"
"github.com/trustyai-explainability/trustyai-service-operator/controllers/constants"
"github.com/trustyai-explainability/trustyai-service-operator/controllers/utils"
kueuev1beta1 "sigs.k8s.io/kueue/apis/kueue/v1beta1"
//+kubebuilder:scaffold:imports
)

Expand All @@ -61,6 +62,7 @@ func init() {
utilruntime.Must(kservev1beta1.AddToScheme(scheme))
utilruntime.Must(routev1.AddToScheme(scheme))
utilruntime.Must(apiextensionsv1.AddToScheme(scheme))
utilruntime.Must(kueuev1beta1.AddToScheme(scheme))
//+kubebuilder:scaffold:scheme
}

Expand Down
75 changes: 29 additions & 46 deletions config/crd/bases/trustyai.opendatahub.io_lmevaljobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ spec:
description: |-
Requests describes the minimum amount of compute resources required.
If Requests is omitted for a container, it defaults to Limits if that is explicitly specified,
otherwise to an implementation-defined value.
otherwise to an implementation-defined value. Requests cannot exceed Limits.
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
type: object
type: object
Expand Down Expand Up @@ -764,9 +764,8 @@ spec:
format: int32
type: integer
grpc:
description: |-
GRPC specifies an action involving a GRPC port.
This is a beta field and requires enabling GRPCContainerProbe feature gate.
description: GRPC specifies an action involving a GRPC
port.
properties:
port:
description: Port number of the gRPC service. Number
Expand Down Expand Up @@ -977,9 +976,8 @@ spec:
format: int32
type: integer
grpc:
description: |-
GRPC specifies an action involving a GRPC port.
This is a beta field and requires enabling GRPCContainerProbe feature gate.
description: GRPC specifies an action involving a GRPC
port.
properties:
port:
description: Port number of the gRPC service. Number
Expand Down Expand Up @@ -1180,7 +1178,7 @@ spec:
description: |-
Requests describes the minimum amount of compute resources required.
If Requests is omitted for a container, it defaults to Limits if that is explicitly specified,
otherwise to an implementation-defined value.
otherwise to an implementation-defined value. Requests cannot exceed Limits.
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
type: object
type: object
Expand Down Expand Up @@ -1324,7 +1322,7 @@ spec:
localhostProfile indicates a profile defined in a file on the node should be used.
The profile must be preconfigured on the node to work.
Must be a descending path, relative to the kubelet's configured seccomp profile location.
Must only be set if type is "Localhost".
Must be set if type is "Localhost". Must NOT be set for any other type.
type: string
type:
description: |-
Expand Down Expand Up @@ -1358,12 +1356,9 @@ spec:
hostProcess:
description: |-
HostProcess determines if a container should be run as a 'Host Process' container.
This field is alpha-level and will only be honored by components that enable the
WindowsHostProcessContainers feature flag. Setting this field without the feature
flag will result in errors when validating the Pod. All of a Pod's containers must
have the same effective HostProcess value (it is not allowed to have a mix of HostProcess
containers and non-HostProcess containers). In addition, if HostProcess is true
then HostNetwork must also be set to true.
All of a Pod's containers must have the same effective HostProcess value
(it is not allowed to have a mix of HostProcess containers and non-HostProcess containers).
In addition, if HostProcess is true then HostNetwork must also be set to true.
type: boolean
runAsUserName:
description: |-
Expand Down Expand Up @@ -1405,9 +1400,8 @@ spec:
format: int32
type: integer
grpc:
description: |-
GRPC specifies an action involving a GRPC port.
This is a beta field and requires enabling GRPCContainerProbe feature gate.
description: GRPC specifies an action involving a GRPC
port.
properties:
port:
description: Port number of the gRPC service. Number
Expand Down Expand Up @@ -2051,7 +2045,7 @@ spec:
The maximum usage on memory medium EmptyDir would be the minimum value between
the SizeLimit specified here and the sum of memory limits of all containers in a pod.
The default is nil which means that the limit is undefined.
More info: http://kubernetes.io/docs/user-guide/volumes#emptydir
More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
type: object
Expand Down Expand Up @@ -2214,32 +2208,6 @@ spec:
status field of the claim.
More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources
properties:
claims:
description: |-
Claims lists the names of resources, defined in spec.resourceClaims,
that are used by this container.
This is an alpha field and requires enabling the
DynamicResourceAllocation feature gate.
This field is immutable. It can only be set for containers.
items:
description: ResourceClaim references
one entry in PodSpec.ResourceClaims.
properties:
name:
description: |-
Name must match the name of one entry in pod.spec.resourceClaims of
the Pod where this field is used. It makes that resource available
inside a container.
type: string
required:
- name
type: object
type: array
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
limits:
additionalProperties:
anyOf:
Expand All @@ -2261,7 +2229,7 @@ spec:
description: |-
Requests describes the minimum amount of compute resources required.
If Requests is omitted for a container, it defaults to Limits if that is explicitly specified,
otherwise to an implementation-defined value.
otherwise to an implementation-defined value. Requests cannot exceed Limits.
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
type: object
type: object
Expand Down Expand Up @@ -2316,6 +2284,21 @@ spec:
storageClassName is the name of the StorageClass required by the claim.
More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1
type: string
volumeAttributesClassName:
description: |-
volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim.
If specified, the CSI driver will create or update the volume with the attributes defined
in the corresponding VolumeAttributesClass. This has a different purpose than storageClassName,
it can be changed after the claim is created. An empty string value means that no VolumeAttributesClass
will be applied to the claim but it's not allowed to reset this field to empty string once it is set.
If unspecified and the PersistentVolumeClaim is unbound, the default VolumeAttributesClass
will be set by the persistentvolume controller if it exists.
If the resource referred to by volumeAttributesClass does not exist, this PersistentVolumeClaim will be
set to a Pending state, as reflected by the modifyVolumeStatus field, until such as a resource
exists.
More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#volumeattributesclass
(Alpha) Using this field requires the VolumeAttributesClass feature gate to be enabled.
type: string
volumeMode:
description: |-
volumeMode defines what type of volume is required by the claim.
Expand Down
2 changes: 1 addition & 1 deletion controllers/controllers.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var (

type EnabledServices []string

// regiser a service. it's a private function for now.
// register a service. it's a private function for now.
// add a file in the same folder to call this function.
func registerService(name string, setupf ControllerSetupFunc) {
TasServices[name] = setupf
Expand Down
23 changes: 23 additions & 0 deletions controllers/job_mgr.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
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 controllers

import "github.com/trustyai-explainability/trustyai-service-operator/controllers/job_mgr"

func init() {
registerService(job_mgr.ServiceName, job_mgr.ControllerSetUp)
}
5 changes: 5 additions & 0 deletions controllers/job_mgr/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package job_mgr

const (
ServiceName = "JOB_MGR"
)
Loading

0 comments on commit 6639b9b

Please sign in to comment.