Documentation
¶
Index ¶
- Constants
- Variables
- func AccountFailCondition(gen int64, msg string) metav1.Condition
- func CleanupResources(ctx context.Context, account *v1.Account, kubeClient client.Client) error
- func ConvertToStructuredResource(yamlContent []byte, out runtime.Object) error
- func ConvertToUnstructuredResource(yamlContent []byte, out *unstructured.Unstructured) error
- func CreateSelfSignedCACertificate(ctx context.Context, c client.Client, secretName, domain, namespace string) error
- func CreateSelfSignedCertificate(ctx context.Context, c client.Client, ...) (*corev1.Secret, error)
- func FindSupportingRuntimeForISvc(ctx context.Context, cli client.Client, log logr.Logger, ...) (*kservev1alpha1.ServingRuntime, error)
- func GenerateSelfSignedCACertificateAsSecret(ctx context.Context, name, addr, namespace string) (*corev1.Secret, error)
- func GenerateSelfSignedCertificateAsSecret(caCertSecret *corev1.Secret, targetSecretName, targetNamespace string, ...) (*corev1.Secret, error)
- func GetApplicationNamespace(ctx context.Context, cli client.Client) (string, error)
- func GetAuthAudience(ctx context.Context, client client.Client, defaultAudience string) []string
- func GetAvailableResourcesForApi(config *rest.Config, groupVersion string) (*metav1.APIResourceList, error)
- func GetEnvOr(key, defaultValue string) string
- func GetGatewayInfoFromConfigMap(ctx context.Context, cli client.Client) (namespace, name string, err error)
- func GetInferenceServiceConfigMap(ctx context.Context, cli client.Client) (*corev1.ConfigMap, error)
- func GetMaaSRoleBindingName(llmisvc *kservev1alpha1.LLMInferenceService) string
- func GetMaaSRoleName(llmisvc *kservev1alpha1.LLMInferenceService) string
- func GetNimModelData(logger logr.Logger, apiKey string, runtimes []NimRuntime) (map[string]string, error)
- func GetNimServingRuntimeTemplate(scheme *runtime.Scheme) (*v1alpha1.ServingRuntime, error)
- func IsCrdAvailable(config *rest.Config, groupVersion, kind string) (bool, error)
- func IsManagedByOpenDataHub(obj client.Object) bool
- func IsManagedResource(owner client.Object, resource client.Object) bool
- func IsNil(i any) bool
- func IsNotNil(i any) bool
- func IsRayTLSSecret(name string) bool
- func MakeNimCondition(condType NimConditionType, status metav1.ConditionStatus, gen int64, ...) metav1.Condition
- func MergeUserLabelsAndAnnotations(desired, existing client.Object)
- func ObjectKeyFromReference(ref *corev1.ObjectReference) client.ObjectKey
- func RegisterSchemes(s *runtime.Scheme)
- func SetAvailableResourcesForApi(groupVersion string, resources *metav1.APIResourceList)
- func SetOpenshiftRouteTimeoutForIsvc(route *v1.Route, isvc *kservev1beta1.InferenceService)
- func SubstituteVariablesInQueries(data string, namespace string, name string) string
- func UpdateStatus(ctx context.Context, subject types.NamespacedName, status v1.AccountStatus, ...) error
- func ValidateApiKey(logger logr.Logger, apiKey string, runtimes []NimRuntime) error
- type HttpClient
- type NIMCleanupRunner
- type NimCatalogQuery
- type NimCatalogResponse
- type NimConditionType
- type NimModel
- type NimRuntime
- type NimTokenResponse
Constants ¶
const (
IsNimRuntimeAnnotation = "runtimes.opendatahub.io/nvidia-nim"
)
const (
KserveConfigMapName = "inferenceservice-config"
)
Variables ¶
var GVK = struct { DataScienceClusterInitialization, DataScienceCluster schema.GroupVersionKind }{ DataScienceCluster: schema.GroupVersionKind{ Group: "datasciencecluster.opendatahub.io", Version: "v1", Kind: "DataScienceCluster", }, DataScienceClusterInitialization: schema.GroupVersionKind{ Group: "dscinitialization.opendatahub.io", Version: "v1", Kind: "DSCInitialization", }, }
GVK is a struct that holds the GroupVersionKind for resources we don't have direct dependency on (by means of golang API) but we still want to interact with them e.g. through unstructured objects.
var NimConditions = []NimConditionType{ NimConditionAccountStatus, NimConditionTemplateUpdate, NimConditionSecretUpdate, NimConditionConfigMapUpdate, NimConditionAPIKeyValidation}
var NimEqualities semantic.Equalities
Functions ¶
func AccountFailCondition ¶
AccountFailCondition returns an AccountStatus failed condition
func CleanupResources ¶
CleanupResources is used for deleting the integration related resources (configmap, template, pull secret)
func ConvertToUnstructuredResource ¶
func ConvertToUnstructuredResource(yamlContent []byte, out *unstructured.Unstructured) error
func FindSupportingRuntimeForISvc ¶
func FindSupportingRuntimeForISvc(ctx context.Context, cli client.Client, log logr.Logger, isvc *kservev1beta1.InferenceService) (*kservev1alpha1.ServingRuntime, error)
func GetApplicationNamespace ¶
GetApplicationNamespace returns the namespace where the application components are installed. defaults to: RHOAI - redhat-ods-applications, ODH: opendatahub
func GetAuthAudience ¶
func GetAvailableResourcesForApi ¶
func GetAvailableResourcesForApi(config *rest.Config, groupVersion string) (*metav1.APIResourceList, error)
GetAvailableResourcesForApi returns the list of discovered resources that belong to the API specified in groupVersion. The first query to a specifig groupVersion will query the cluster API server to discover the available resources and the discovered resources will be cached and returned to subsequent invocations to prevent additional queries to the API server.
func GetMaaSRoleBindingName ¶
func GetMaaSRoleBindingName(llmisvc *kservev1alpha1.LLMInferenceService) string
GetMaaSRoleBindingName returns the name of the related RoleBinding resource for MaaS RBAC use cases
func GetMaaSRoleName ¶
func GetMaaSRoleName(llmisvc *kservev1alpha1.LLMInferenceService) string
GetMaaSRoleName returns the name of the related Role resource for MaaS RBAC use cases
func GetNimModelData ¶
func GetNimModelData(logger logr.Logger, apiKey string, runtimes []NimRuntime) (map[string]string, error)
GetNimModelData is used for fetching the model info for the given runtimes, returns configmap data
func GetNimServingRuntimeTemplate ¶
func GetNimServingRuntimeTemplate(scheme *runtime.Scheme) (*v1alpha1.ServingRuntime, error)
GetNimServingRuntimeTemplate returns the Template used by ODH for creating serving runtimes
func IsCrdAvailable ¶
IsCrdAvailable checks if a given CRD is present in the cluster by verifying the existence of its API.
func IsManagedByOpenDataHub ¶
func IsRayTLSSecret ¶
func MakeNimCondition ¶
func MakeNimCondition(condType NimConditionType, status metav1.ConditionStatus, gen int64, reason, msg string) metav1.Condition
MakeNimCondition is used for building a status condition for NIM integration
func MergeUserLabelsAndAnnotations ¶
MergeUserLabelsAndAnnotations merges user-added labels and annotations from existing resource into desired resource while preserving template-defined values
func ObjectKeyFromReference ¶
func ObjectKeyFromReference(ref *corev1.ObjectReference) client.ObjectKey
ObjectKeyFromReference returns the ObjectKey given a ObjectReference
func RegisterSchemes ¶
RegisterSchemes adds schemes of used resources to controller's scheme.
func SetAvailableResourcesForApi ¶
func SetAvailableResourcesForApi(groupVersion string, resources *metav1.APIResourceList)
SetAvailableResourcesForApi stores the value fo resources argument in the global cache of discovered API resources. This function should never be called directly. It is exported for usage in tests.
func SetOpenshiftRouteTimeoutForIsvc ¶
func SetOpenshiftRouteTimeoutForIsvc(route *v1.Route, isvc *kservev1beta1.InferenceService)
SetOpenshiftRouteTimeoutForIsvc sets the timeout value for Openshift routes created for inference services.
func UpdateStatus ¶
func UpdateStatus(ctx context.Context, subject types.NamespacedName, status v1.AccountStatus, kubeClient client.Client) error
UpdateStatus is used for fetching an updating the status of the account
func ValidateApiKey ¶
func ValidateApiKey(logger logr.Logger, apiKey string, runtimes []NimRuntime) error
ValidateApiKey is used for validating the given API key by retrieving the token and pulling the given custom runtime
Types ¶
type HttpClient ¶
var NimHttpClient HttpClient
type NIMCleanupRunner ¶
NIMCleanupRunner is a Runnable used for cleaning up NIM when disabled
type NimCatalogQuery ¶
type NimCatalogQuery struct { Query string `json:"query"` Page int `json:"page"` PageSize int `json:"pageSize"` }
NimCatalogQuery is used for constructing a query for NIM catalog fetch
type NimCatalogResponse ¶
type NimCatalogResponse struct { ResultPageTotal int `json:"resultPageTotal"` Params struct { Page int `json:"page"` } `json:"params"` Results []struct { GroupValue string `json:"groupValue"` Resources []struct { ResourceId string `json:"resourceId"` Attributes []struct { Key string `json:"key"` Value string `json:"value"` } `json:"attributes"` Name string `json:"name"` } `json:"resources"` } `json:"results"` }
NimCatalogResponse represents the NIM catalog fetch response
type NimConditionType ¶
type NimConditionType string
const ( NimConditionAccountStatus NimConditionType = "AccountStatus" NimConditionTemplateUpdate NimConditionType = "TemplateUpdate" NimConditionSecretUpdate NimConditionType = "SecretUpdate" NimConditionConfigMapUpdate NimConditionType = "ConfigMapUpdate" NimConditionAPIKeyValidation NimConditionType = "APIKeyValidation" )
func (NimConditionType) String ¶
func (r NimConditionType) String() string
type NimModel ¶
type NimModel struct { Name string `json:"name"` DisplayName string `json:"displayName"` ShortDescription string `json:"shortDescription"` Namespace string `json:"namespace"` Tags []string `json:"tags"` LatestTag string `json:"latestTag"` UpdatedDate string `json:"updatedDate"` }
NimModel is a representation of NIM model info
type NimRuntime ¶
type NimRuntime struct { Resource string Version string Org string Team string Image string Name string }
NimRuntime is a representation of a NIM custom runtime
func GetAvailableNimRuntimes ¶
func GetAvailableNimRuntimes(logger logr.Logger) ([]NimRuntime, error)
GetAvailableNimRuntimes is used for fetching a list of available NIM custom runtimes
type NimTokenResponse ¶
NimTokenResponse represents the NIM token response