Skip to content

Commit

Permalink
Merge pull request #203 from zqq454224016/main
Browse files Browse the repository at this point in the history
feat: develop model management API
  • Loading branch information
bjwswang authored Nov 16, 2023
2 parents a6ccea3 + 009ac72 commit a38c689
Show file tree
Hide file tree
Showing 13 changed files with 2,616 additions and 288 deletions.
4 changes: 2 additions & 2 deletions api/v1alpha1/dataset.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const (
var (
// LabelDatasetScene defines the content type of this dataset
LabelDatasetContentType = Group + "/content-type"
// LabelDatasetBestCase defines the best case to use this dataset
LabelDatasetBestCase = Group + "/best-case"
// LabelDatasetField defines the best field to use this dataset
LabelDatasetField = Group + "/field"
LabelDatasetFinalizer = Group + "/finalizers"
)
4 changes: 2 additions & 2 deletions api/v1alpha1/dataset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ type DatasetSpec struct {
// ContentType defines dataset
ContentType string `json:"contentType"`

// bestCase defines the best case to use this dataset
BestCase string `json:"bestCase,omitempty"`
// Model application fields
Field string `json:"field,omitempty"`
}

// DatasetStatus defines the observed state of Dataset
Expand Down
3 changes: 3 additions & 0 deletions api/v1alpha1/model_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ type ModelSpec struct {
// Description defines datasource description
Description string `json:"description,omitempty"`

// Model application fields
Field string `json:"field,omitempty"`

// Type defines what kind of model this is
Type ModelType `json:"type,omitempty"`

Expand Down
6 changes: 3 additions & 3 deletions charts/arcadia/crds/arcadia.kubeagi.k8s.com.cn_datasets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ spec:
spec:
description: DatasetSpec defines the desired state of Dataset
properties:
bestCase:
description: bestCase defines the best case to use this dataset
type: string
contentType:
description: ContentType defines dataset
type: string
Expand All @@ -57,6 +54,9 @@ spec:
displayName:
description: DisplayName defines datasource display name
type: string
field:
description: Model application fields
type: string
required:
- contentType
type: object
Expand Down
3 changes: 3 additions & 0 deletions charts/arcadia/crds/arcadia.kubeagi.k8s.com.cn_models.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ spec:
displayName:
description: DisplayName defines dataset display name
type: string
field:
description: Model application fields
type: string
type:
description: Type defines what kind of model this is
type: string
Expand Down
6 changes: 3 additions & 3 deletions config/crd/bases/arcadia.kubeagi.k8s.com.cn_datasets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ spec:
spec:
description: DatasetSpec defines the desired state of Dataset
properties:
bestCase:
description: bestCase defines the best case to use this dataset
type: string
contentType:
description: ContentType defines dataset
type: string
Expand All @@ -57,6 +54,9 @@ spec:
displayName:
description: DisplayName defines datasource display name
type: string
field:
description: Model application fields
type: string
required:
- contentType
type: object
Expand Down
3 changes: 3 additions & 0 deletions config/crd/bases/arcadia.kubeagi.k8s.com.cn_models.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ spec:
displayName:
description: DisplayName defines dataset display name
type: string
field:
description: Model application fields
type: string
type:
description: Type defines what kind of model this is
type: string
Expand Down
4 changes: 2 additions & 2 deletions controllers/dataset_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ func (r *DatasetReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
instance.Labels[arcadiav1alpha1.LabelDatasetContentType] = instance.Spec.ContentType
update = true
}
if v, ok := instance.Labels[arcadiav1alpha1.LabelDatasetBestCase]; !ok || v != instance.Spec.BestCase {
instance.Labels[arcadiav1alpha1.LabelDatasetBestCase] = instance.Spec.BestCase
if v, ok := instance.Labels[arcadiav1alpha1.LabelDatasetField]; !ok || v != instance.Spec.Field {
instance.Labels[arcadiav1alpha1.LabelDatasetField] = instance.Spec.Field
update = true
}
if !utils.ContainString(instance.Finalizers, arcadiav1alpha1.Finalizer) {
Expand Down
Loading

0 comments on commit a38c689

Please sign in to comment.