Skip to content

Commit

Permalink
chore: added OdhNIMAccount API
Browse files Browse the repository at this point in the history
  • Loading branch information
xieshenzh committed Oct 23, 2024
1 parent 2e3317a commit 8353220
Show file tree
Hide file tree
Showing 28 changed files with 702 additions and 940 deletions.
2 changes: 1 addition & 1 deletion PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ resources:
crdVersion: v1alpha1
namespaced: true
domain: nim.opendatahub.io
kind: OdhNimApp
kind: OdhNIMAccount
path: github.com/opendatahub-io/odh-nim-operator/api/v1alpha1
version: v1alpha1
webhooks:
Expand Down
18 changes: 18 additions & 0 deletions api/v1alpha1/groupversion_info.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright (c) 2024 Red Hat, Inc.

package v1alpha1

import (
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/scheme"
)

// +groupName=nim.opendatahub.io
// +kubebuilder:object:generate=true
// +kubebuilder:validation:Required

var (
GroupVersion = schema.GroupVersion{Group: "nim.opendatahub.io", Version: "v1alpha1"}
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
Install = SchemeBuilder.AddToScheme
)
59 changes: 59 additions & 0 deletions api/v1alpha1/odhnimaccount_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Copyright (c) 2024 Red Hat, Inc.

package v1alpha1

import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

type (
// OdhNIMAccountSpec defines the desired state of an OdhNIMAccount object.
OdhNIMAccountSpec struct {
// A reference to the Secret containing the NGC API Key.
SecretRef corev1.ObjectReference `json:"secretRef"`
}

// OdhNIMAccountStatus defines the observed state of an OdhNIMAccount object.
OdhNIMAccountStatus struct {
// A reference to the Template for NIM ServingRuntime.
TemplateRef corev1.ObjectReference `json:"templateRef,omitempty"`
// A reference to the ConfigMap with data for NIM deployment.
ConfigMapRef corev1.ObjectReference `json:"configMapRef,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:type=status,xDescriptors={"urn:alm:descriptor:io.kubernetes.conditions"}
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

// OdhNIMAccount is used for adopting a NIM Account for Open Data Hub.
//
// +kubebuilder:object:root=true
// +kubebuilder:resource:shortName=onima
// +kubebuilder:subresource:status
//
// +kubebuilder:printcolumn:name="Template",type="string",JSONPath=".status.templateRef.name",description="The name of the Template"
// +kubebuilder:printcolumn:name="ConfigMap",type="string",JSONPath=".status.configMapRef.name",description="The name of the ConfigMap"
//
// +operator-sdk:csv:customresourcedefinitions:displayName="ODH NIM Account"
// +operator-sdk:csv:customresourcedefinitions:resources={{ConfigMap,v1},{Template,template.openshift.io/v1}}
OdhNIMAccount struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec OdhNIMAccountSpec `json:"spec,omitempty"`
Status OdhNIMAccountStatus `json:"status,omitempty"`
}

// OdhNIMAccountList is used for encapsulating OdhNIMAccount items.
//
// +kubebuilder:object:root=true
OdhNIMAccountList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []OdhNIMAccount `json:"items"`
}
)

func init() {
SchemeBuilder.Register(&OdhNIMAccount{}, &OdhNIMAccountList{})
}
2 changes: 1 addition & 1 deletion api/v1alpha1/odhnimruntime_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ type (
)

func init() {
schemeBuilder.Register(&OdhNIMRuntime{}, &OdhNIMRuntimeList{})
SchemeBuilder.Register(&OdhNIMRuntime{}, &OdhNIMRuntimeList{})
}
87 changes: 0 additions & 87 deletions api/v1alpha1/types.go

This file was deleted.

Loading

0 comments on commit 8353220

Please sign in to comment.