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: codeflare component #1387

Merged
39 changes: 27 additions & 12 deletions apis/components/v1/codeflare_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,12 @@ 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.

// CodeFlareSpec defines the desired state of CodeFlare
type CodeFlareSpec 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 CodeFlare. Edit codeflare_types.go to remove/update
Foo string `json:"foo,omitempty"`
}
const (
CodeFlareComponentName = "codeflare"
// value should match whats set in the XValidation below
CodeFlareInstanceName = "default-codeflare"
CodeFlareKind = "CodeFlare"
)

// CodeFlareStatus defines the observed state of CodeFlare
type CodeFlareStatus struct {
Expand All @@ -41,6 +36,9 @@ type CodeFlareStatus struct {
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster
// +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"
// +kubebuilder:validation:XValidation:rule="self.metadata.name == 'default-codeflare'",message="CodeFlare name must be default-codeflare"

// CodeFlare is the Schema for the codeflares API
type CodeFlare struct {
Expand All @@ -51,14 +49,26 @@ type CodeFlare struct {
Status CodeFlareStatus `json:"status,omitempty"`
}

type CodeFlareSpec struct {
CodeFlareCommonSpec `json:",inline"`
}

type CodeFlareCommonSpec struct {
components.DevFlagsSpec `json:",inline"`
}

func (c *CodeFlare) GetDevFlags() *components.DevFlags {
return nil
return c.Spec.DevFlags
}

func (c *CodeFlare) GetStatus() *components.Status {
return &c.Status.Status
}

func init() {
SchemeBuilder.Register(&CodeFlare{}, &CodeFlareList{})
}

// +kubebuilder:object:root=true

// CodeFlareList contains a list of CodeFlare
Expand All @@ -71,3 +81,8 @@ type CodeFlareList struct {
func init() {
SchemeBuilder.Register(&CodeFlare{}, &CodeFlareList{})
}

type DSCCodeFlare struct {
components.ManagementSpec `json:",inline"`
CodeFlareCommonSpec `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 @@ -26,7 +26,6 @@ import (

componentsv1 "github.com/opendatahub-io/opendatahub-operator/v2/apis/components/v1"
"github.com/opendatahub-io/opendatahub-operator/v2/components"
"github.com/opendatahub-io/opendatahub-operator/v2/components/codeflare"
"github.com/opendatahub-io/opendatahub-operator/v2/components/kserve"
"github.com/opendatahub-io/opendatahub-operator/v2/components/modelmeshserving"
"github.com/opendatahub-io/opendatahub-operator/v2/components/workbenches"
Expand Down Expand Up @@ -65,7 +64,7 @@ type Components struct {

// CodeFlare component configuration.
// If CodeFlare Operator has been installed in the cluster, it should be uninstalled first before enabled component.
CodeFlare codeflare.CodeFlare `json:"codeflare,omitempty"`
CodeFlare componentsv1.DSCCodeFlare `json:"codeflare,omitempty"`

// Ray component configuration.
Ray componentsv1.DSCRay `json:"ray,omitempty"`
Expand Down
140 changes: 0 additions & 140 deletions components/codeflare/codeflare.go

This file was deleted.

39 changes: 0 additions & 39 deletions components/codeflare/zz_generated.deepcopy.go

This file was deleted.

45 changes: 39 additions & 6 deletions config/crd/bases/components.opendatahub.io_codeflares.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,16 @@ spec:
singular: codeflare
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: CodeFlare is the Schema for the codeflares API
Expand All @@ -37,12 +46,33 @@ spec:
metadata:
type: object
spec:
description: CodeFlareSpec defines the desired state of CodeFlare
properties:
foo:
description: Foo is an example field of CodeFlare. Edit codeflare_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: CodeFlareStatus defines the observed state of CodeFlare
Expand Down Expand Up @@ -110,6 +140,9 @@ spec:
type: string
type: object
type: object
x-kubernetes-validations:
- message: CodeFlare name must be default-codeflare
rule: self.metadata.name == 'default-codeflare'
served: true
storage: true
subresources:
Expand Down
Loading