Skip to content

Commit

Permalink
Merge pull request #587 from helixml/fix/v1alpha1
Browse files Browse the repository at this point in the history
Fix/v1alpha1
  • Loading branch information
lukemarsden authored Nov 7, 2024
2 parents 04b64d3 + e0ad9a9 commit 8166f07
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 28 deletions.
2 changes: 1 addition & 1 deletion api/pkg/controller/knowledge/crawler/default_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,5 +160,5 @@ func TestDefault_ConvertHTMLToMarkdown(t *testing.T) {
doc, err := d.crawlWithBrowser(ctx, b, "https://www.starbucks.com/store-locator/store/50766-275766/target-austin-ut-campus-3250-2021-guadalupe-st-austin-tx-78705-us")
require.NoError(t, err)

assert.Contains(t, doc.Content, "Target Austin UT Campus")
assert.True(t, strings.Contains(doc.Content, "Target Austin UT Campus") || strings.Contains(doc.Content, "This site uses cookies"))
}
4 changes: 2 additions & 2 deletions operator/PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ resources:
domain: aispec.org
group: app
kind: AIApp
path: github.com/helixml/helix/operator/api/v1
version: v1
path: github.com/helixml/helix/operator/api/v1alpha1
version: v1alpha1
version: "3"
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package v1
package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -170,8 +170,8 @@ type ToolConfig struct {

// AIAppSpec defines the desired state of AIApp
type AIAppSpec struct {
Name string `json:"name"`
Description string `json:"description"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
Avatar string `json:"avatar,omitempty"`
Image string `json:"image,omitempty"`
Assistants []AssistantConfig `json:"assistants,omitempty"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// Package v1 contains API Schema definitions for the app v1 API group.
// Package v1alpha1 contains API Schema definitions for the app v1alpha1 API group.
// +kubebuilder:object:generate=true
// +groupName=app.aispec.org
package v1
package v1alpha1

import (
"k8s.io/apimachinery/pkg/runtime/schema"
Expand All @@ -26,7 +26,7 @@ import (

var (
// GroupVersion is group version used to register these objects.
GroupVersion = schema.GroupVersion{Group: "app.aispec.org", Version: "v1"}
GroupVersion = schema.GroupVersion{Group: "app.aispec.org", Version: "v1alpha1"}

// SchemeBuilder is used to add go types to the GroupVersionKind scheme.
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
Expand Down

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

4 changes: 2 additions & 2 deletions operator/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
"sigs.k8s.io/controller-runtime/pkg/webhook"

appv1 "github.com/helixml/helix/operator/api/v1"
appv1alpha1 "github.com/helixml/helix/operator/api/v1alpha1"
"github.com/helixml/helix/operator/internal/controller"
// +kubebuilder:scaffold:imports
)
Expand All @@ -48,7 +48,7 @@ var (
func init() {
utilruntime.Must(clientgoscheme.AddToScheme(scheme))

utilruntime.Must(appv1.AddToScheme(scheme))
utilruntime.Must(appv1alpha1.AddToScheme(scheme))
// +kubebuilder:scaffold:scheme
}

Expand Down
5 changes: 1 addition & 4 deletions operator/config/crd/bases/app.aispec.org_aiapps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
singular: aiapp
scope: Namespaced
versions:
- name: v1
- name: v1alpha1
schema:
openAPIV3Schema:
description: AIApp is the Schema for the aiapps API
Expand Down Expand Up @@ -323,9 +323,6 @@ spec:
type: string
name:
type: string
required:
- description
- name
type: object
status:
description: AIAppStatus defines the observed state of AIApp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: app.aispec.org/v1
apiVersion: app.aispec.org/v1alpha1
kind: AIApp
metadata:
labels:
Expand Down
2 changes: 1 addition & 1 deletion operator/config/samples/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Append samples of your project ##
resources:
- app_v1_aiapp.yaml
- app_v1alpha1_aiapp.yaml
# +kubebuilder:scaffold:manifestskustomizesamples
8 changes: 4 additions & 4 deletions operator/internal/controller/aiapp_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (

helixclient "github.com/helixml/helix/api/pkg/client"
"github.com/helixml/helix/api/pkg/types"
appv1 "github.com/helixml/helix/operator/api/v1"
appv1alpha1 "github.com/helixml/helix/operator/api/v1alpha1"
)

const (
Expand All @@ -56,7 +56,7 @@ func (r *AIAppReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl
logger := log.FromContext(ctx)

// Get the AIApp resource
var aiapp appv1.AIApp
var aiapp appv1alpha1.AIApp
if err := r.Get(ctx, req.NamespacedName, &aiapp); err != nil {
return ctrl.Result{}, client.IgnoreNotFound(err)
}
Expand Down Expand Up @@ -222,7 +222,7 @@ func (r *AIAppReconciler) SetupWithManager(mgr ctrl.Manager) error {
}

return ctrl.NewControllerManagedBy(mgr).
For(&appv1.AIApp{}).
For(&appv1alpha1.AIApp{}).
Named("aiapp").
Complete(r)
}
Expand All @@ -246,7 +246,7 @@ func removeString(slice []string, s string) []string {
return result
}

func (r *AIAppReconciler) handleDeletion(ctx context.Context, aiapp *appv1.AIApp, appID string) (ctrl.Result, error) {
func (r *AIAppReconciler) handleDeletion(ctx context.Context, aiapp *appv1alpha1.AIApp, appID string) (ctrl.Result, error) {
logger := log.FromContext(ctx)

if containsString(aiapp.Finalizers, finalizerName) {
Expand Down
8 changes: 4 additions & 4 deletions operator/internal/controller/aiapp_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

appv1 "github.com/helixml/helix/operator/api/v1"
appv1alpha1 "github.com/helixml/helix/operator/api/v1alpha1"
)

var _ = Describe("AIApp Controller", func() {
Expand All @@ -40,13 +40,13 @@ var _ = Describe("AIApp Controller", func() {
Name: resourceName,
Namespace: "default", // TODO(user):Modify as needed
}
aiapp := &appv1.AIApp{}
aiapp := &appv1alpha1.AIApp{}

BeforeEach(func() {
By("creating the custom resource for the Kind AIApp")
err := k8sClient.Get(ctx, typeNamespacedName, aiapp)
if err != nil && errors.IsNotFound(err) {
resource := &appv1.AIApp{
resource := &appv1alpha1.AIApp{
ObjectMeta: metav1.ObjectMeta{
Name: resourceName,
Namespace: "default",
Expand All @@ -59,7 +59,7 @@ var _ = Describe("AIApp Controller", func() {

AfterEach(func() {
// TODO(user): Cleanup logic after each test, like removing the resource instance.
resource := &appv1.AIApp{}
resource := &appv1alpha1.AIApp{}
err := k8sClient.Get(ctx, typeNamespacedName, resource)
Expect(err).NotTo(HaveOccurred())

Expand Down
4 changes: 2 additions & 2 deletions operator/internal/controller/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/log/zap"

appv1 "github.com/helixml/helix/operator/api/v1"
appv1alpha1 "github.com/helixml/helix/operator/api/v1alpha1"
// +kubebuilder:scaffold:imports
)

Expand Down Expand Up @@ -77,7 +77,7 @@ var _ = BeforeSuite(func() {
Expect(err).NotTo(HaveOccurred())
Expect(cfg).NotTo(BeNil())

err = appv1.AddToScheme(scheme.Scheme)
err = appv1alpha1.AddToScheme(scheme.Scheme)
Expect(err).NotTo(HaveOccurred())

// +kubebuilder:scaffold:scheme
Expand Down

0 comments on commit 8166f07

Please sign in to comment.