Documentation
¶
Index ¶
- Constants
- Variables
- func AuthorinoEnabledWhenOperatorNotMissing(_, reason string) bool
- func ConvertToStructuredResource(yamlContent []byte, out runtime.Object) error
- func ConvertToUnstructuredResource(yamlContent []byte, out *unstructured.Unstructured) error
- func FindSupportingRuntimeForISvc(ctx context.Context, cli client.Client, log logr.Logger, ...) (*kservev1alpha1.ServingRuntime, error)
- func GetApplicationNamespace(ctx context.Context, cli client.Client) (string, error)
- func GetAvailableResourcesForApi(config *rest.Config, groupVersion string) (*metav1.APIResourceList, error)
- func GetIstioControlPlaneName(ctx context.Context, cli client.Client) (istioControlPlane string, meshNamespace string)
- func GetNimModelData(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 IsNil(i any) bool
- func IsNotNil(i any) bool
- func MakeNimCondition(condType NimConditionType, status metav1.ConditionStatus, gen int64, ...) metav1.Condition
- func RegisterSchemes(s *runtime.Scheme)
- func SetAvailableResourcesForApi(groupVersion string, resources *metav1.APIResourceList)
- func SubstituteVariablesInQueries(data string, namespace string, name string) string
- func ValidateApiKey(apiKey string, runtime NimRuntime) error
- func VerifyIfCapabilityIsEnabled(ctx context.Context, cli client.Client, capabilityName string, ...) (bool, error)
- func VerifyIfComponentIsEnabled(ctx context.Context, cli client.Client, componentName string) (bool, error)
- func VerifyIfMeshAuthorizationIsEnabled(ctx context.Context, cli client.Client) (bool, error)
- type HttpClient
- type IsvcDeploymentMode
- type NimCatalogQuery
- type NimCatalogResponse
- type NimConditionType
- type NimModel
- type NimRuntime
- type NimTokenResponse
Constants ¶
const ( KserveConfigMapName = "inferenceservice-config" KServeWithServiceMeshComponent = "kserve-service-mesh" )
const (
IsNimRuntimeAnnotation = "runtimes.opendatahub.io/nvidia-nim"
)
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.
Functions ¶
func AuthorinoEnabledWhenOperatorNotMissing ¶
AuthorinoEnabledWhenOperatorNotMissing is a helper function to check if Authorino is enabled when the Operator is not missing. This is defined by Condition.Reason=MissingOperator. In any other case, it is assumed that Authorino is enabled but DSC might not be in the Ready state and will reconcile.
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 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 GetIstioControlPlaneName ¶
func GetIstioControlPlaneName(ctx context.Context, cli client.Client) (istioControlPlane string, meshNamespace string)
GetIstioControlPlaneName return the name of the Istio Control Plane and the mesh namespace. It will first try to read the environment variables, if not found will then try to read the DSCI If the required value is not available in the DSCI, it will return the default values
func GetNimModelData ¶
func GetNimModelData(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 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 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 ValidateApiKey ¶
func ValidateApiKey(apiKey string, runtime NimRuntime) error
ValidateApiKey is used for validating the given API key by retrieving the token and pulling the given custom runtime
func VerifyIfCapabilityIsEnabled ¶
func VerifyIfCapabilityIsEnabled(ctx context.Context, cli client.Client, capabilityName string, enabledWhen func(status, reason string) bool) (bool, error)
VerifyIfCapabilityIsEnabled checks if given DSCI capability is enabled. It only fails if client call to fetch DSCI fails. In other cases it assumes capability is not enabled.
func VerifyIfComponentIsEnabled ¶
func VerifyIfComponentIsEnabled(ctx context.Context, cli client.Client, componentName string) (bool, error)
VerifyIfComponentIsEnabled will query the DCS in the cluster and see if the desired componentName is enabled
func VerifyIfMeshAuthorizationIsEnabled ¶
VerifyIfMeshAuthorizationIsEnabled func checks if Authorization has been configured for ODH platform. That check is done by verifying the presence of an Istio AuthorizationPolicy resource. This resource is expected to be present for both the ODH managed and unmanaged setups of the authorization capability. If it is not present, it is inferred that the authorization capability is not available.
Types ¶
type HttpClient ¶
var NimHttpClient HttpClient
type IsvcDeploymentMode ¶
type IsvcDeploymentMode string
var ( Serverless IsvcDeploymentMode = "Serverless" RawDeployment IsvcDeploymentMode = "RawDeployment" ModelMesh IsvcDeploymentMode = "ModelMesh" )
func GetDeploymentModeForIsvc ¶
func GetDeploymentModeForIsvc(ctx context.Context, cli client.Client, isvc *kservev1beta1.InferenceService) (IsvcDeploymentMode, error)
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 { Results []struct { GroupValue string `json:"groupValue"` Resources []struct { ResourceId string `json:"resourceId"` Attributes []struct { Key string `json:"key"` Value string `json:"value"` } `json:"attributes"` } `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 ¶
NimRuntime is a representation of a NIM custom runtime
func GetAvailableNimRuntimes ¶
func GetAvailableNimRuntimes() ([]NimRuntime, error)
GetAvailableNimRuntimes is used for fetching a list of available NIM custom runtimes
type NimTokenResponse ¶
NimTokenResponse represents the NIM token response