Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ spec:
name:
minLength: 1
type: string
namespace:
type: string
version:
minLength: 1
type: string
Expand All @@ -61,11 +59,14 @@ spec:
properties:
name:
type: string
namespace:
type: string
type:
type: string
url:
description: |-
URL of the Helm repository or OCI registry.
Examples:
oci://ghcr.io/my-org/charts
https://charts.example.com
minLength: 1
pattern: ^(oci://|https?://).+
type: string
values:
additionalProperties:
Expand All @@ -75,7 +76,6 @@ spec:
type: string
required:
- name
- type
- url
- version
type: object
Expand Down
3 changes: 1 addition & 2 deletions suse-ai-operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@ metadata:
spec:
helm:
name: suse-ai-lifecycle-manager
url: "ghcr.io/suse/chart/suse-ai-lifecycle-manager"
url: "oci://ghcr.io/suse/chart/suse-ai-lifecycle-manager"
version: "1.0.0"
type: "oci"
extension:
name: suse-ai-lifecycle-manager
version: "1.0.0"
Expand Down
29 changes: 13 additions & 16 deletions suse-ai-operator/api/v1alpha1/installaiextension_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,30 +32,27 @@ type InstallAIExtensionSpec struct {
Extension ExtensionSpec `json:"extension"`
}

type HelmRepoType string

const (
HelmRepoTypeOCI HelmRepoType = "oci"
HelmRepoTypeHTTP HelmRepoType = "http"
)

type HelmSpec struct {
Name string `json:"name"`
URL string `json:"url"`
Namespace string `json:"namespace,omitempty"`
Type HelmRepoType `json:"type"`
Version string `json:"version"`
Values map[string]apixv1.JSON `json:"values,omitempty"`
Name string `json:"name"`
// URL of the Helm repository or OCI registry.
// Examples:
// oci://ghcr.io/my-org/charts
// https://charts.example.com
//
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:Pattern=`^(oci://|https?://).+`
URL string `json:"url"`
Version string `json:"version"`
Values map[string]apixv1.JSON `json:"values,omitempty"`
}

type ExtensionSpec struct {
// +kubebuilder:validation:MinLength=1
Name string `json:"name"`

// +kubebuilder:validation:MinLength=1
Version string `json:"version"`
Namespace string `json:"namespace,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
Version string `json:"version"`
Metadata map[string]string `json:"metadata,omitempty"`
}

// InstallAIExtensionStatus defines the observed state of InstallAIExtension.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import (
"context"
"fmt"

urlpkg "net/url"

"github.com/go-logr/logr"
"helm.sh/helm/v3/pkg/cli"
"k8s.io/apimachinery/pkg/runtime"
Expand Down Expand Up @@ -86,10 +88,19 @@ func (r *InstallAIExtensionReconciler) Reconcile(ctx context.Context, req ctrl.R

chart := ""

switch installExt.Spec.Helm.Type {
case "oci":
chart = "oci://" + installExt.Spec.Helm.URL
url := installExt.Spec.Helm.URL

u, err := urlpkg.Parse(url)
if err != nil {
log.Error(err, "invalid helm url %q", url)
}

switch u.Scheme {
case "oci", "https":
chart = url
default:
log.Error(err, "unsupported helm url scheme: %s", u.Scheme)
return ctrl.Result{}, err
}

settings := cli.New()
Expand Down
5 changes: 2 additions & 3 deletions suse-ai-operator/samples/installaiextension.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ metadata:
spec:
helm:
name: suse-ai-lifecycle-manager
url: "ghcr.io/suse/chart/suse-ai-lifecycle-manager"
url: "oci://ghcr.io/suse/chart/suse-ai-lifecycle-manager"
version: "1.0.0"
type: "oci"
extension:
name: suse-ai-lifecycle-manager
version: "1.0.0"
version: "1.0.0"