Skip to content

Commit

Permalink
Merge branch 'feature-operator-refactor' into feature-branch-push
Browse files Browse the repository at this point in the history
  • Loading branch information
CFSNM committed Dec 2, 2024
2 parents 1a7296a + 15ca54e commit 2558a9e
Show file tree
Hide file tree
Showing 59 changed files with 2,264 additions and 787 deletions.
30 changes: 8 additions & 22 deletions .github/workflows/feature-branch-image.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,28 @@
---
name: Build and Push Feature Branch Custom Catalog
env:
OPERATOR_IMG: quay.io/${{ secrets.QUAY_ORG }}/opendatahub-operator:${{ github.head_ref }}
BUNDLE_IMG: quay.io/${{ secrets.QUAY_ORG }}/opendatahub-operator-bundle:${{ github.head_ref }}
BUNDLE_IMG: quay.io/${{ secrets.QUAY_ORG }}/opendatahub-operator:${{ github.head_ref }}
CATALOG_IMG: quay.io/${{ secrets.QUAY_ORG }}/opendatahub-operator-catalog:${{ github.head_ref }}
on:
pull_request_target:
pull_request:
branches:
- 'feature-**'
workflow_dispatch:
- "feature-**"
permissions:
packages: write
contents: read
pull-requests: read
checks: write
checks: read
jobs:
build-and-push-feature-branch-custom-catalog:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Wait for checks to be completed
uses: WyriHaximus/github-action-wait-for-status@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Login to quay.io
run: |
podman login -u ${{ secrets.QUAY_ID }} -p ${{ secrets.QUAY_TOKEN }} quay.io
- name: Build Feature Branch Image
run: |
make image-build -e IMG=${{ env.OPERATOR_IMG }}
- name: Push Feature Branch Image
run: |
make image-push -e IMG=${{ env.OPERATOR_IMG }}
- name: Build Bundle Manifests
run: |
make bundle
- name: Build Feature Branch Bundle
run: |
make bundle-build -e BUNDLE_IMG=${{ env.BUNDLE_IMG }}
- name: Push Feature Branch Bundle to quay.io
run: |
make bundle-push -e BUNDLE_IMG=${{ env.BUNDLE_IMG }}
- name: Build Feature Branch Catalog
run: |
make catalog-build -e CATALOG_IMG=${{ env.CATALOG_IMG }} -e BUNDLE_IMG=${{ env.BUNDLE_IMG }}
Expand Down
57 changes: 49 additions & 8 deletions apis/components/v1/kserve_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,50 @@ limitations under the License.
package v1

import (
"github.com/opendatahub-io/opendatahub-operator/v2/apis/components"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/opendatahub-io/opendatahub-operator/v2/apis/components"
infrav1 "github.com/opendatahub-io/opendatahub-operator/v2/apis/infrastructure/v1"
)

// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
const (
KserveComponentName = "kserve"
ModelControllerComponentName = "odh-model-controller" // shared by kserve and mm
// value should match what's set in the XValidation below
KserveInstanceName = "default-kserve"
KserveKind = "Kserve"
)

// +kubebuilder:validation:Pattern=`^(Serverless|RawDeployment)$`
type DefaultDeploymentMode string

const (
// Serverless will be used as the default deployment mode for Kserve. This requires Serverless and ServiceMesh operators configured as dependencies.
Serverless DefaultDeploymentMode = "Serverless"
// RawDeployment will be used as the default deployment mode for Kserve.
RawDeployment DefaultDeploymentMode = "RawDeployment"
)

// KserveCommonSpec spec defines the shared desired state of Kserve
type KserveCommonSpec struct {
components.DevFlagsSpec `json:",inline"`
// Serving configures the KNative-Serving stack used for model serving. A Service
// Mesh (Istio) is prerequisite, since it is used as networking layer.
Serving infrav1.ServingSpec `json:"serving,omitempty"`
// Configures the default deployment mode for Kserve. This can be set to 'Serverless' or 'RawDeployment'.
// The value specified in this field will be used to set the default deployment mode in the 'inferenceservice-config' configmap for Kserve.
// This field is optional. If no default deployment mode is specified, Kserve will use Serverless mode.
// +kubebuilder:validation:Enum=Serverless;RawDeployment
DefaultDeploymentMode DefaultDeploymentMode `json:"defaultDeploymentMode,omitempty"`
}

// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

// KserveSpec defines the desired state of Kserve
type KserveSpec 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 Kserve. Edit kserve_types.go to remove/update
Foo string `json:"foo,omitempty"`
// kserve spec exposed to DSC api
KserveCommonSpec `json:",inline"`
// kserve spec exposed only to internal api
}

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

// Kserve is the Schema for the kserves API
type Kserve struct {
Expand All @@ -52,7 +85,7 @@ type Kserve struct {
}

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

func (c *Kserve) GetStatus() *components.Status {
Expand All @@ -71,3 +104,11 @@ type KserveList struct {
func init() {
SchemeBuilder.Register(&Kserve{}, &KserveList{})
}

// DSCKserve contains all the configuration exposed in DSC instance for Kserve component
type DSCKserve struct {
// configuration fields common across components
components.ManagementSpec `json:",inline"`
// Kserve specific fields
KserveCommonSpec `json:",inline"`
}
37 changes: 36 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/kserve"
"github.com/opendatahub-io/opendatahub-operator/v2/components/modelmeshserving"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/cluster"
)
Expand Down Expand Up @@ -56,7 +55,7 @@ type Components struct {
// Kserve component configuration.
// Require OpenShift Serverless and OpenShift Service Mesh Operators to be installed before enable component
// Does not support enabled ModelMeshServing at the same time
Kserve kserve.Kserve `json:"kserve,omitempty"`
Kserve componentsv1.DSCKserve `json:"kserve,omitempty"`

// Kueue component configuration.
Kueue componentsv1.DSCKueue `json:"kueue,omitempty"`
Expand Down
45 changes: 39 additions & 6 deletions bundle/manifests/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

0 comments on commit 2558a9e

Please sign in to comment.