Skip to content

Commit

Permalink
feat: add support for kueue component
Browse files Browse the repository at this point in the history
Signed-off-by: Wen Zhou <wenzhou@redhat.com>
  • Loading branch information
zdtsw committed Nov 5, 2024
1 parent 90bd116 commit 5f3498a
Show file tree
Hide file tree
Showing 23 changed files with 704 additions and 251 deletions.
54 changes: 34 additions & 20 deletions apis/components/v1/kueue_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,21 @@ import (
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.

// KueueSpec defines the desired state of Kueue
type KueueSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

// Foo is an example field of Kueue. Edit kueue_types.go to remove/update
Foo string `json:"foo,omitempty"`
}
const (
KueueComponentName = "kueue"
// value should match whats set in the XValidation below
KueueInstanceName = "default-kueue"
KueueKind = "Kueue"
)

// KueueStatus defines the observed state of Kueue
type KueueStatus struct {
components.Status `json:",inline"`
}
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster
// +kubebuilder:validation:XValidation:rule="self.metadata.name == 'default-kueue'",message="Kueue name must be default-kueue"
// +kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].status`,description="Ready"
// +kubebuilder:printcolumn:name="Reason",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].reason`,description="Reason"

// Kueue is the Schema for the kueues API
type Kueue struct {
Expand All @@ -51,16 +46,21 @@ type Kueue struct {
Status KueueStatus `json:"status,omitempty"`
}

func (c *Kueue) GetDevFlags() *components.DevFlags {
return nil
// KueueSpec defines the desired state of Kueue
type KueueSpec struct {
KueueCommonSpec `json:",inline"`
}

func (c *Kueue) GetStatus() *components.Status {
return &c.Status.Status
type KueueCommonSpec struct {
components.DevFlagsSpec `json:",inline"`
}

// +kubebuilder:object:root=true
// KueueStatus defines the observed state of Kueue
type KueueStatus struct {
components.Status `json:",inline"`
}

// +kubebuilder:object:root=true
// KueueList contains a list of Kueue
type KueueList struct {
metav1.TypeMeta `json:",inline"`
Expand All @@ -71,3 +71,17 @@ type KueueList struct {
func init() {
SchemeBuilder.Register(&Kueue{}, &KueueList{})
}

func (c *Kueue) GetDevFlags() *components.DevFlags {
return c.Spec.DevFlags
}
func (c *Kueue) GetStatus() *components.Status {
return &c.Status.Status
}

// DSCKueue contains all the configuration exposed in DSC instance for Kueue component
type DSCKueue struct {
components.ManagementSpec `json:",inline"`
// configuration fields common across components
KueueCommonSpec `json:",inline"`
}
36 changes: 35 additions & 1 deletion apis/components/v1/zz_generated.deepcopy.go

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

3 changes: 1 addition & 2 deletions apis/datasciencecluster/v1/datasciencecluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
"github.com/opendatahub-io/opendatahub-operator/v2/components/codeflare"
"github.com/opendatahub-io/opendatahub-operator/v2/components/datasciencepipelines"
"github.com/opendatahub-io/opendatahub-operator/v2/components/kserve"
"github.com/opendatahub-io/opendatahub-operator/v2/components/kueue"
"github.com/opendatahub-io/opendatahub-operator/v2/components/modelmeshserving"
"github.com/opendatahub-io/opendatahub-operator/v2/components/trainingoperator"
"github.com/opendatahub-io/opendatahub-operator/v2/components/trustyai"
Expand Down Expand Up @@ -65,7 +64,7 @@ type Components struct {
Kserve kserve.Kserve `json:"kserve,omitempty"`

// Kueue component configuration.
Kueue kueue.Kueue `json:"kueue,omitempty"`
Kueue componentsv1.DSCKueue `json:"kueue,omitempty"`

// CodeFlare component configuration.
// If CodeFlare Operator has been installed in the cluster, it should be uninstalled first before enabled component.
Expand Down
44 changes: 39 additions & 5 deletions bundle/manifests/components.opendatahub.io_kueues.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,16 @@ spec:
singular: kueue
scope: Cluster
versions:
- name: v1
- additionalPrinterColumns:
- description: Ready
jsonPath: .status.conditions[?(@.type=="Ready")].status
name: Ready
type: string
- description: Reason
jsonPath: .status.conditions[?(@.type=="Ready")].reason
name: Reason
type: string
name: v1
schema:
openAPIV3Schema:
description: Kueue is the Schema for the kueues API
Expand All @@ -39,10 +48,32 @@ spec:
spec:
description: KueueSpec defines the desired state of Kueue
properties:
foo:
description: Foo is an example field of Kueue. Edit kueue_types.go
to remove/update
type: string
devFlags:
description: Add developer fields
properties:
manifests:
description: List of custom manifests for the given component
items:
properties:
contextDir:
default: manifests
description: contextDir is the relative path to the folder
containing manifests in a repository, default value "manifests"
type: string
sourcePath:
default: ""
description: 'sourcePath is the subpath within contextDir
where kustomize builds start. Examples include any sub-folder
or path: `base`, `overlays/dev`, `default`, `odh` etc.'
type: string
uri:
default: ""
description: uri is the URI point to a git repo with tag/branch.
e.g. https://github.com/org/repo/tarball/<tag/branch>
type: string
type: object
type: array
type: object
type: object
status:
description: KueueStatus defines the observed state of Kueue
Expand Down Expand Up @@ -110,6 +141,9 @@ spec:
type: string
type: object
type: object
x-kubernetes-validations:
- message: Kueue name must be default-kueue
rule: self.metadata.name == 'default-kueue'
served: true
storage: true
subresources:
Expand Down
14 changes: 12 additions & 2 deletions bundle/manifests/opendatahub-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ metadata:
categories: AI/Machine Learning, Big Data
certified: "False"
containerImage: quay.io/opendatahub/opendatahub-operator:v2.19.0
createdAt: "2024-10-30T14:18:10Z"
createdAt: "2024-11-01T10:08:53Z"
olm.skipRange: '>=1.0.0 <2.19.0'
operators.operatorframework.io/builder: operator-sdk-v1.31.0
operators.operatorframework.io/internal-objects: '["featuretrackers.features.opendatahub.io",
Expand Down Expand Up @@ -837,7 +837,6 @@ spec:
- prometheuses
- prometheuses/finalizers
- prometheuses/status
- prometheusrules
- thanosrulers
- thanosrulers/finalizers
- thanosrulers/status
Expand All @@ -859,6 +858,17 @@ spec:
- patch
- update
- watch
- apiGroups:
- monitoring.coreos.com
resources:
- prometheusrules
verbs:
- create
- delete
- deletecollection
- get
- list
- patch
- apiGroups:
- monitoring.coreos.com
resources:
Expand Down
110 changes: 0 additions & 110 deletions components/kueue/kueue.go

This file was deleted.

Loading

0 comments on commit 5f3498a

Please sign in to comment.