Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
王鑫彪 committed Nov 3, 2023
2 parents 346edc6 + 66806e1 commit 928d346
Show file tree
Hide file tree
Showing 103 changed files with 5,664 additions and 214 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/example_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
mkdir -p ${GITHUB_WORKSPACE}/bin
cp /usr/local/bin/kustomize ${GITHUB_WORKSPACE}/bin/kustomize
- name: Example test
run: config/samples/example-test.sh
run: tests/example-test.sh
- name: Upload logs if test fail
if: failure()
uses: actions/upload-artifact@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
check-latest: true

- name: Set up chart-testing
uses: helm/chart-testing-action@v2.4.0
uses: helm/chart-testing-action@v2.6.0

- name: Run chart-testing (list-changed)
id: list-changed
Expand Down
10 changes: 0 additions & 10 deletions .kubeagi_repo.yaml

This file was deleted.

1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ COPY go.mod go.mod
COPY go.sum go.sum
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go env -w GOPROXY=https://goproxy.cn,direct
RUN go mod download

# Copy the go source
Expand Down
22 changes: 18 additions & 4 deletions PROJECT
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Code generated by tool. DO NOT EDIT.
# This file is used to track the info used to scaffold your project
# and allow the plugins properly work.
# More info: https://book.kubebuilder.io/reference/project-config.html
componentConfig: true
domain: kubeagi.k8s.com.cn
layout:
Expand Down Expand Up @@ -58,4 +54,22 @@ resources:
kind: Embedders
path: github.com/kubeagi/arcadia/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: kubeagi.k8s.com.cn
group: arcadia
kind: Dataset
path: github.com/kubeagi/arcadia/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: kubeagi.k8s.com.cn
group: arcadia
kind: VersionedDataset
path: github.com/kubeagi/arcadia/api/v1alpha1
version: v1alpha1
version: "3"
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ Our design and development in Arcadia design follows operator pattern which exte
helm install --namespace arcadia --create-namespace arcadia arcadia/arcadia
```

More conveniently,you can use [kubebb](https://github.com/kubebb) to install and upgrade arcadia automatically:
> Pre-requsities
> - [kubebb](https://kubebb.github.io/website/docs/quick-start/core_quickstart)
```shell
kubectl apply -f ./kubeagi.yaml
```

## CLI

We provide a Command Line Tool `arctl` to interact with `arcadia`. See [here](./arctl/README.md) for more details.
Expand Down
26 changes: 26 additions & 0 deletions api/v1alpha1/condition.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,32 @@ const (
ReasonReconcilePaused ConditionReason = "ReconcilePaused"
)

// Some Data related Condition Types
const (
// Dataset have 3 phases: load -> process -> publish
// TypeLoaded resources are believed to be loaded
TypeLoaded ConditionType = "Loaded"
// TypeProcessed resources are believed to be processed
TypeProcessed ConditionType = "Processed"
// TypePublished resources are believed to be published
TypePublished ConditionType = "Published"
)

// Some Dataset related Condition reasons
const (
// Load data
ReasonDataLoading ConditionReason = "DataLoading"
ReasonDataLoadError ConditionReason = "DataLoadError"
ReasonDataLoadSuccess ConditionReason = "DataLoadSuccess"
// Process data
ReasonDataProcessing ConditionReason = "DataProcessing"
ReasonDataProcessError ConditionReason = "DataProcessError"
ReasonDataProcessSuccess ConditionReason = "DataProcessSuccess"
// Publish dataset
ReasonDatasetUnpublished ConditionReason = "DatasetUnpublished"
ReasonDatasetPublished ConditionReason = "DatasetPublished"
)

// A Condition that may apply to a resource.
type Condition struct {
// Type of this condition. At most one of each condition type may apply to
Expand Down
33 changes: 33 additions & 0 deletions api/v1alpha1/dataset.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
Copyright 2023 KubeAGI.
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 v1alpha1

type DatasetContentType string

const (
DatasetContentTypeText DatasetContentType = "text"
DatasetContentTypeImage DatasetContentType = "image"
DatasetContentTypeVoice DatasetContentType = "voice"
DatasetContentTypeVideo DatasetContentType = "video"
)

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"
)
72 changes: 72 additions & 0 deletions api/v1alpha1/dataset_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
Copyright 2023 KubeAGI.
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 v1alpha1

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.

// DatasetSpec defines the desired state of Dataset
type DatasetSpec struct {
// Creator defines dataset creator(AUTO-FILLED by webhook)
Creator string `json:"creator,omitempty"`

// DisplayName defines dataset display name
DiplayName string `json:"displayName"`

// ContentType defines dataset
ContentType string `json:"contentType"`

// bestCase defines the best case to use this dataset
BestCase string `json:"bestCase,omitempty"`
}

// DatasetStatus defines the observed state of Dataset
type DatasetStatus struct {
// ConditionedStatus is the current status
ConditionedStatus `json:",inline"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:printcolumn:name="display-name",type=string,JSONPath=`.spec.displayName`
//+kubebuilder:printcolumn:name="type",type=string,JSONPath=`.spec.contentType`

// Dataset is the Schema for the datasets API
type Dataset struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec DatasetSpec `json:"spec,omitempty"`
Status DatasetStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

// DatasetList contains a list of Dataset
type DatasetList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Dataset `json:"items"`
}

func init() {
SchemeBuilder.Register(&Dataset{}, &DatasetList{})
}
8 changes: 8 additions & 0 deletions api/v1alpha1/datasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,19 @@ const (
type DatasourceType string

const (
DatasourceTypeLocal DatasourceType = "local"
DatasourceTypeOSS DatasourceType = "oss"
DatasourceTypeUnknown DatasourceType = "unknown"
)

func (ds DatasourceSpec) Type() DatasourceType {
// if endpoint is nil,this must be a `Local` datasource which utilize `SystemDatasource` by default to host its data
if ds.Enpoint == nil {
return DatasourceTypeLocal
}

// For third party datasources

// Object storage service
if ds.OSS != nil {
return DatasourceTypeOSS
Expand Down
6 changes: 4 additions & 2 deletions api/v1alpha1/datasource_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ type DatasourceSpec struct {
Creator string `json:"creator,omitempty"`

// DisplayName defines datasource display name
DiplayName string `json:"displayName,omitempty"`
DiplayName string `json:"displayName"`

// Description defines datasource description
Description string `json:"description,omitempty"`

// Enpoint defines connection info
Enpoint Endpoint `json:"endpoint"`
Enpoint *Endpoint `json:"endpoint,omitempty"`

// OSS defines info for object storage service
OSS *OSS `json:"oss,omitempty"`
Expand All @@ -56,6 +56,8 @@ type DatasourceStatus struct {
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:scope=Namespaced
//+kubebuilder:printcolumn:name="display-name",type=string,JSONPath=`.spec.displayName`
//+kubebuilder:printcolumn:name="type",type=string,JSONPath=`.metadata.labels.arcadia\.kubeagi\.k8s\.com\.cn/datasource-type`

// Datasource is the Schema for the datasources API
type Datasource struct {
Expand Down
21 changes: 21 additions & 0 deletions api/v1alpha1/versioneddataset.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
Copyright 2023 KubeAGI.
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 v1alpha1

var (
LabelVersionedDatasetVersion = Group + "/version"
)
77 changes: 77 additions & 0 deletions api/v1alpha1/versioneddataset_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
Copyright 2023 KubeAGI.
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 v1alpha1

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.

type FileGroup struct {
// From defines the datasource which provides this `File`
Datasource *TypedObjectReference `json:"datasource"`
// Paths defines the detail paths to get objects from above datasource
Paths []string `json:"paths"`
}

// VersionedDatasetSpec defines the desired state of VersionedDataset
type VersionedDatasetSpec struct {
// Dataset which this `VersionedDataset` belongs to
Dataset *TypedObjectReference `json:"dataset"`

// Version
Version string `json:"version"`

// FileGroups included in this `VersionedDataset`
// Grouped by Datasource
FileGroups []FileGroup `json:"fileGroups,omitempty"`
}

// VersionedDatasetStatus defines the observed state of VersionedDataset
type VersionedDatasetStatus struct {
// ConditionedStatus is the current status
ConditionedStatus `json:",inline"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:printcolumn:name="dataset",type=string,JSONPath=`.spec.dataset.name`
//+kubebuilder:printcolumn:name="version",type=string,JSONPath=`.spec.version`

// VersionedDataset is the Schema for the versioneddatasets API
type VersionedDataset struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec VersionedDatasetSpec `json:"spec,omitempty"`
Status VersionedDatasetStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

// VersionedDatasetList contains a list of VersionedDataset
type VersionedDatasetList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []VersionedDataset `json:"items"`
}

func init() {
SchemeBuilder.Register(&VersionedDataset{}, &VersionedDatasetList{})
}
Loading

0 comments on commit 928d346

Please sign in to comment.