Skip to content

Commit

Permalink
Merge pull request #116 from zqq454224016/main
Browse files Browse the repository at this point in the history
feat: Develop CRD Datasource
  • Loading branch information
bjwswang authored Oct 18, 2023
2 parents c653dbe + b1bda3c commit 712af44
Show file tree
Hide file tree
Showing 21 changed files with 674 additions and 5 deletions.
12 changes: 12 additions & 0 deletions PROJECT
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 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 @@ -37,4 +41,12 @@ resources:
webhooks:
validation: true
webhookVersion: v1
- api:
crdVersion: v1
controller: true
domain: kubeagi.k8s.com.cn
group: arcadia
kind: Datasource
path: github.com/kubeagi/arcadia/api/v1alpha1
version: v1alpha1
version: "3"
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@ Our vision is to make it easier for cloud-native applications to integrate with

## Quick start

1. Install arcadia operator
1. Install kubebb-core

```
helm repo add kubebb https://kubebb.github.io/components/
helm repo update
helm install -nkubebb-system --create-namespace kubebb-core kubebb/kubebb-core
```

2. Install arcadia operator

We recommend that install arcadia under namespace `arcadia`

Expand All @@ -24,15 +32,15 @@ helm repo update
helm install --namespace arcadia --create-namespace arcadia arcadia/arcadia
```

2. Add a LLM along with the auth secret
3. Add a LLM along with the auth secret

> Update apiKey(`Base64 encoded`) in [secret](https://github.com/kubeagi/arcadia/blob/main/config/samples/arcadia_v1alpha1_llm.yaml#L7).
```shell
kubectl apply -f config/samples/arcadia_v1alpha1_llm.yaml
```

3. Create a prompt
4. Create a prompt

```shell
kubectl apply -f config/samples/arcadia_v1alpha1_prompt.yaml
Expand Down
64 changes: 64 additions & 0 deletions api/v1alpha1/datasource_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
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.

// DatasourceSpec defines the desired state of Datasource
type DatasourceSpec struct {
// URL defines datasource url
URL string `json:"url,omitempty"`
// AuthSecret defines datasource authsecret
AuthSecret string `json:"authsecret,omitempty"`
}

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

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:scope=Namespaced

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

Spec DatasourceSpec `json:"spec,omitempty"`
Status DatasourceStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

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

func init() {
SchemeBuilder.Register(&Datasource{}, &DatasourceList{})
}
90 changes: 90 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

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

2 changes: 1 addition & 1 deletion charts/arcadia/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: arcadia
description: A Helm chart(KubeBB Component) for KubeAGI Arcadia
type: application
version: 0.1.5
version: 0.1.6
appVersion: "0.0.0"
keywords:
- kubeagi
Expand Down
91 changes: 91 additions & 0 deletions charts/arcadia/crds/arcadia.kubeagi.k8s.com.cn_datasources.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.9.2
creationTimestamp: null
name: datasources.arcadia.kubeagi.k8s.com.cn
spec:
group: arcadia.kubeagi.k8s.com.cn
names:
kind: Datasource
listKind: DatasourceList
plural: datasources
singular: datasource
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: Datasource is the Schema for the datasources API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: DatasourceSpec defines the desired state of Datasource
properties:
authsecret:
description: AuthSecret defines datasource authsecret
type: string
url:
description: URL defines datasource url
type: string
type: object
status:
description: DatasourceStatus defines the observed state of Datasource
properties:
conditions:
description: Conditions of the resource.
items:
description: A Condition that may apply to a resource.
properties:
lastSuccessfulTime:
description: LastSuccessfulTime is repository Last Successful
Update Time
format: date-time
type: string
lastTransitionTime:
description: LastTransitionTime is the last time this condition
transitioned from one status to another.
format: date-time
type: string
message:
description: A Message containing details about this condition's
last transition from one status to another, if any.
type: string
reason:
description: A Reason for this condition's last transition from
one status to another.
type: string
status:
description: Status of this condition; is it currently True,
False, or Unknown
type: string
type:
description: Type of this condition. At most one of each condition
type may apply to a resource at any point in time.
type: string
required:
- lastTransitionTime
- reason
- status
- type
type: object
type: array
type: object
type: object
served: true
storage: true
subresources:
status: {}
12 changes: 12 additions & 0 deletions charts/arcadia/templates/minio.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: core.kubebb.k8s.com.cn/v1alpha1
kind: ComponentPlan
metadata:
name: my-minio
namespace: kubebb-system
spec:
approved: true
name: my-minio # similar to helm release name
version: 5.0.10
component:
name: kubebb.minio
namespace: kubebb-system
Loading

0 comments on commit 712af44

Please sign in to comment.