Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for NeMo Customizer #305

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
9 changes: 9 additions & 0 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,13 @@ resources:
kind: NIMPipeline
path: github.com/NVIDIA/k8s-nim-operator/api/apps/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: nvidia.com
group: apps
kind: NemoCustomizer
path: github.com/NVIDIA/k8s-nim-operator/api/apps/v1alpha1
version: v1alpha1
version: "3"
8 changes: 6 additions & 2 deletions api/apps/v1alpha1/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,13 @@ type Service struct {
Type corev1.ServiceType `json:"type,omitempty"`
// override the default service name
Name string `json:"name,omitempty"`
// Deprecated: Use Ports instead.
// +kubebuilder:deprecatedversion
// +kubebuilder:default=8000
Port int32 `json:"port"`
Annotations map[string]string `json:"annotations,omitempty"`
Port int32 `json:"port,omitempty"`
// Defines multiple ports for the service
Ports []corev1.ServicePort `json:"ports,omitempty"`
Annotations map[string]string `json:"annotations,omitempty"`
}

// Metrics defines attributes to setup metrics collection
Expand Down
87 changes: 77 additions & 10 deletions api/apps/v1alpha1/nemo_common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ type DataStore struct {
Endpoint string `json:"endpoint"`
}

// DatabaseConfig is the external database configuration
type DatabaseConfig struct {
// Host is the hostname of the database.
// Required, must not be empty.
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
Host string `json:"host,omitempty"`
Host string `json:"host"`
// Port is the port where the database is reachable at.
// If specified, this must be a valid port number, 0 < databasePort < 65536.
// Defaults to 5432.
Expand All @@ -47,32 +47,99 @@ type DatabaseConfig struct {
// DatabaseName is the database name for a NEMO Service.
// Required, must not be empty.
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
DatabaseName string `json:"databaseName,omitempty"`
DatabaseName string `json:"databaseName"`
// DatabaseCredentials stores the configuration to retrieve the database credentials.
// Required, must not be nil.
//
// +kubebuilder:validation:Required
Credentials *DatabaseCredentials `json:"credentials,omitempty"`
Credentials *DatabaseCredentials `json:"credentials"`
}

// DatabaseCredentials are the external database credentials
type DatabaseCredentials struct {
// User is the non-root username for a NEMO Service in the database.
// Required, must not be empty.
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
User string `json:"user,omitempty"`
User string `json:"user"`
// SecretName is the name of the secret which has the database credentials for a NEMO service user.
// Required, must not be empty.
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
SecretName string `json:"secretName,omitempty"`
SecretName string `json:"secretName"`
// PasswordKey is the name of the key in the `CredentialsSecret` secret for the database credentials.
// Defaults to "password".
//
// +kubebuilder:default:="password"
PasswordKey string `json:"passwordKey,omitempty"`
}

// WandBSecret represents the secret and key details for the Weights and Biases service.
type WandBSecret struct {
// Name is the name of the Kubernetes Secret containing the WandB API key.
// Required, must not be empty.
//
// +kubebuilder:validation:MinLength=1
Name string `json:"name"`

// APIKeyKey is the key in the Secret that holds the WandB API key.
// Defaults to "apiKey".
// +kubebuilder:default="apiKey"
// +kubebuilder:validation:MinLength=1
APIKeyKey string `json:"apiKeyKey"`

// EncryptionKey is an optional key in the secret used for encrypting WandB credentials.
// This can be used for additional security layers if required.
// Defaults to "encryptionKey".
// +kubebuilder:validation:Optional
// +kubebuilder:default="encryptionKey"
EncryptionKey string `json:"encryptionKey,omitempty"`
}

// OTelSpec defines the settings for OpenTelemetry
type OTelSpec struct {
// Enabled indicates if opentelemetry collector and tracing are enabled
Enabled *bool `json:"enabled,omitempty"`

// ExporterOtlpEndpoint is the OTLP collector endpoint.
// +kubebuilder:validation:MinLength=1
ExporterOtlpEndpoint string `json:"exporterOtlpEndpoint"`

// DisableLogging indicates whether Python logging auto-instrumentation should be disabled.
// +kubebuilder:validation:Optional
DisableLogging *bool `json:"disableLogging,omitempty"`

// ExporterConfig defines configuration for different OTel exporters
// +kubebuilder:validation:Optional
ExporterConfig ExporterConfig `json:"exporterConfig,omitempty"`

// ExcludedUrls defines URLs to be excluded from tracing.
// +kubebuilder:validation:Optional
// +kubebuilder:default={"health"}
ExcludedUrls []string `json:"excludedUrls,omitempty"`

// LogLevel defines the log level (e.g., INFO, DEBUG).
// +kubebuilder:validation:Optional
// +kubebuilder:default="INFO"
LogLevel string `json:"logLevel,omitempty"`
}

// ExporterConfig stores configuration for different OTel exporters
type ExporterConfig struct {
// TracesExporter sets the traces exporter: (otlp, console, none).
// +kubebuilder:validation:Optional
// +kubebuilder:default="otlp"
shivamerla marked this conversation as resolved.
Show resolved Hide resolved
TracesExporter string `json:"tracesExporter,omitempty"`

// MetricsExporter sets the metrics exporter: (otlp, console, none).
// +kubebuilder:validation:Optional
// +kubebuilder:validation:Enum=otlp;console;none
// +kubebuilder:default="otlp"
MetricsExporter string `json:"metricsExporter,omitempty"`

// LogsExporter sets the logs exporter: (otlp, console, none).
// +kubebuilder:validation:Optional
// +kubebuilder:validation:Enum=otlp;console;none
// +kubebuilder:default="otlp"
LogsExporter string `json:"logsExporter,omitempty"`
}
Loading