Skip to content

Commit 12b615e

Browse files
Merge pull request #911 from opendatahub-io/main
sync: main to stable
2 parents 9a262b3 + ad39ad1 commit 12b615e

File tree

115 files changed

+6790
-3522
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+6790
-3522
lines changed

.github/workflows/build-image-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
- name: Start Kind Cluster
4242
uses: helm/kind-action@v1.13.0
4343
with:
44-
node_image: "kindest/node:v1.27.11"
44+
node_image: "kindest/node:v1.33.7"
4545
- name: Load Local Registry Test Image
4646
env:
4747
IMG: "${{ env.IMG_REGISTRY }}/${{ env.IMG_ORG }}/${{ env.IMG_REPO }}:${{ steps.tags.outputs.tag }}"

.github/workflows/csi-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171
- name: Start KinD cluster
7272
uses: helm/kind-action@v1.13.0
7373
with:
74-
node_image: "kindest/node:v1.31.0"
74+
node_image: "kindest/node:v1.33.7"
7575

7676
- name: Install kustomize
7777
run: ./test/scripts/install_kustomize.sh

.github/workflows/go-mod-tidy-diff-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
go-version: "1.25.3"
2525

2626
- name: Cache Go modules
27-
uses: actions/cache@v4
27+
uses: actions/cache@v5
2828
with:
2929
path: ~/go/pkg/mod
3030
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}

.github/workflows/python-tests.yml

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
strategy:
2525
fail-fast: false
2626
matrix:
27-
python: ["3.12"]
27+
python: ["3.10"]
2828
session: [lint, mypy]
2929
env:
3030
NOXSESSION: ${{ matrix.session }}
@@ -120,24 +120,18 @@ jobs:
120120
strategy:
121121
fail-fast: false
122122
matrix:
123-
python: ["3.12"] # see below for versions 3.9-3.11
123+
python: ["3.12"] # see below for versions 3.10-3.11
124124
kubernetes-version:
125-
["v1.27.11", "v1.28.7", "v1.29.2", "v1.30.6", "v1.31.0"]
125+
["v1.33.7", "v1.34.3"]
126126
manifest-db: ["db", "postgres"] # subdirectory of manifests/kustomize/overlays to select which database: 'db' (MySQL) or 'postgres'
127127
exclude: # on main merges (not PRs), use also different K8s versions for E2E testing
128-
- kubernetes-version: ${{ github.event_name != 'push' && 'v1.28.7' }}
129-
- kubernetes-version: ${{ github.event_name != 'push' && 'v1.29.2' }}
130-
- kubernetes-version: ${{ github.event_name != 'push' && 'v1.30.6' }}
131-
- kubernetes-version: ${{ github.event_name != 'push' && 'v1.31.0' }}
132-
include: # test Py versions only with a reference K8s version, designated currently to kubernetes-version: v1.27.11
128+
- kubernetes-version: ${{ github.event_name != 'push' && 'v1.34.3' }}
129+
include: # test Py versions only with a reference K8s version, designated currently to kubernetes-version: v1.33.7
133130
- python: "3.11"
134-
kubernetes-version: "v1.27.11"
131+
kubernetes-version: "v1.33.7"
135132
manifest-db: "db"
136133
- python: "3.10"
137-
kubernetes-version: "v1.27.11"
138-
manifest-db: "db"
139-
- python: "3.9"
140-
kubernetes-version: "v1.27.11"
134+
kubernetes-version: "v1.33.7"
141135
manifest-db: "db"
142136
env:
143137
FORCE_COLOR: "1"
@@ -298,12 +292,12 @@ jobs:
298292
nox --python=${{ matrix.python }}
299293
poetry build
300294
- name: Upload dist
301-
uses: actions/upload-artifact@v5
295+
uses: actions/upload-artifact@v6.0.0
302296
with:
303297
name: py-dist
304298
path: clients/python/dist
305299
- name: Upload documentation
306-
uses: actions/upload-artifact@v5
300+
uses: actions/upload-artifact@v6.0.0
307301
with:
308302
name: py-docs
309303
path: clients/python/docs/_build

.github/workflows/scorecard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
5959
# format to the repository Actions tab.
6060
- name: "Upload artifact"
61-
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
61+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
6262
with:
6363
name: SARIF file
6464
path: results.sarif

.github/workflows/test-fuzz.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
fail-fast: false
2929
matrix:
3030
manifest-db: ["db", "postgres"] # subdirectory of manifests/kustomize/overlays to select which database: 'db' (MySQL) or 'postgres'
31-
kubernetes-version: ["v1.31.0"]
31+
kubernetes-version: ["v1.33.7"]
3232
env:
3333
DEPLOY_MANIFEST_DB: "${{ matrix.manifest-db }}"
3434
steps:

Makefile

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ CSI_PATH := $(PROJECT_PATH)/cmd/csi
88
CONTROLLER_PATH := $(PROJECT_PATH)/cmd/controller
99

1010
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
11-
ENVTEST_K8S_VERSION = 1.29
11+
ENVTEST_K8S_VERSION = 1.33
1212
ENVTEST ?= $(PROJECT_BIN)/setup-envtest
1313

1414
# add tools bin directory
@@ -169,7 +169,7 @@ clean/odh:
169169
rm -Rf ./model-registry
170170

171171
bin/envtest:
172-
GOBIN=$(PROJECT_BIN) ${GO} install sigs.k8s.io/controller-runtime/tools/setup-envtest@v0.0.0-20240320141353-395cfc7486e6
172+
GOBIN=$(PROJECT_BIN) ${GO} install sigs.k8s.io/controller-runtime/tools/setup-envtest@release-0.21
173173

174174
GOLANGCI_LINT ?= ${PROJECT_BIN}/golangci-lint
175175
bin/golangci-lint:
@@ -273,16 +273,16 @@ lint/csi: bin/golangci-lint
273273
${GOLANGCI_LINT} run internal/csi/...
274274

275275
.PHONY: test
276-
test: bin/envtest
277-
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" ${GO} test ./internal/... ./pkg/...
276+
test:
277+
${GO} test $$(${GO} list ./internal/... ./pkg/... | grep -v controller)
278278

279279
.PHONY: test-nocache
280-
test-nocache: bin/envtest
281-
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" ${GO} test ./internal/... ./pkg/... -count=1
280+
test-nocache:
281+
${GO} test $$(${GO} list ./internal/... ./pkg/... | grep -v controller) -count=1
282282

283283
.PHONY: test-cover
284-
test-cover: bin/envtest
285-
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" ${GO} test ./internal/... ./pkg/... -coverprofile=coverage.txt
284+
test-cover:
285+
${GO} test $$(${GO} list ./internal/... ./pkg/... | grep -v controller) -coverprofile=coverage.txt
286286
${GO} tool cover -html=coverage.txt -o coverage.html
287287

288288
.PHONY: run/proxy
@@ -364,7 +364,7 @@ controller/vet: ## Run go vet against code.
364364

365365
.PHONY: controller/test
366366
controller/test: controller/manifests controller/generate controller/fmt controller/vet bin/envtest ## Run tests.
367-
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(PROJECT_BIN) -p path)" go test $$(go list ./internal/controller/... | grep -vF /e2e) -coverprofile cover.out
367+
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(PROJECT_BIN) -p path)" go test $$(go list ./internal/controller/... ./pkg/inferenceservice-controller/... | grep -vF /e2e) -coverprofile cover.out
368368

369369
##@ Build
370370

catalog/README.md

Lines changed: 102 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The catalog service operates as a **metadata aggregation layer** that:
1313
### Supported Catalog Sources
1414

1515
- **YAML Catalog** - Static YAML files containing model metadata
16-
- **HuggingFace Hub** - Discover models from HuggingFace's model repository
16+
- **Hugging Face Hub** - Discover models from Hugging Face's model repository
1717

1818
## REST API
1919

@@ -274,20 +274,16 @@ catalogs:
274274
path: "./models"
275275
```
276276

277-
### HuggingFace Source Configuration
277+
### Hugging Face Source Configuration
278278

279-
The HuggingFace catalog source allows you to discover and import models from the HuggingFace Hub. To configure a HuggingFace source:
279+
The Hugging Face catalog source allows you to discover and import models from the Hugging Face Hub. To configure a Hugging Face source:
280280

281281
#### 1. Set Your API Key
282282

283283
Setting a Hugging Face API key is optional. Hugging Face requires an API key for authentication for full access to data of models that are private and/or gated. If an API key is NOT set, private models will be entirely unavailable and gated models will have limited metadata. By default, the service reads the API key from the `HF_API_KEY` environment variable:
284284

285-
```bash
286-
export HF_API_KEY="your-huggingface-api-key-here"
287-
```
288-
289-
**Getting a HuggingFace API Key:**
290-
1. Sign up or log in to [HuggingFace](https://huggingface.co)
285+
**Getting a Hugging Face API Key:**
286+
1. Sign up or log in to [Hugging Face](https://huggingface.co)
291287
2. Go to your [Settings > Access Tokens](https://huggingface.co/settings/tokens)
292288
3. Create a new token with "Read" permissions
293289
4. Copy the token and set it as an environment variable
@@ -297,52 +293,140 @@ export HF_API_KEY="your-huggingface-api-key-here"
297293
- Reference it in your deployment configuration
298294
- The catalog service will read it from the configured environment variable (defaults to `HF_API_KEY`)
299295

296+
```bash
297+
kubectl create secret generic model-catalog-hf-api-key \
298+
--from-literal=HF_API_KEY="your-api-key-here" \
299+
--dry-run=client -o yaml | kubectl apply -f -
300+
301+
kubectl rollout restart deployment model-catalog-server -n kubeflow
302+
```
303+
300304
**Custom Environment Variable Name:**
301305
You can configure a custom environment variable name per source by setting the `apiKeyEnvVar` property in your source configuration (see below). This is useful when you need different API keys for different sources.
302306

303307
**Important Notes:**
304308
- **Private Models**: For private models, the API key must belong to an account that has been granted access to the model. Without proper access, the catalog service will not be able to retrieve model information.
305-
- **Gated Models**: For gated models (models with usage restrictions), you must accept the model's terms of service on HuggingFace before the catalog service can access all available model information. Visit the model's page on HuggingFace and accept the terms to ensure full metadata is available.
309+
- **Gated Models**: For gated models (models with usage restrictions), you must accept the model's terms of service on Hugging Face before the catalog service can access all available model information. Visit the model's page on Hugging Face and accept the terms to ensure full metadata is available.
306310

307311
#### 2. Configure the Source
308312

309-
Add a HuggingFace source to your `catalog-sources.yaml`:
313+
Add a Hugging Face source to your `catalog-sources.yaml`:
310314

311315
```yaml
312316
catalogs:
313-
- name: "HuggingFace Hub"
317+
- name: "Hugging Face Hub"
314318
id: "huggingface"
315319
type: "hf"
316320
enabled: true
317321
# Required: List of model identifiers to include
318322
# Format: "organization/model-name" or "username/model-name"
323+
# Supports wildcard patterns: "organization/*" or "organization/prefix*"
319324
includedModels:
320325
- "meta-llama/Llama-3.1-8B-Instruct"
321-
- "ibm-granite/granite-4.0-h-small"
322326
- "microsoft/phi-2"
323-
327+
- "microsoft/phi-3*" # All models starting with "phi-3"
328+
324329
# Optional: Exclude specific models or patterns
325330
# Supports exact matches or patterns ending with "*"
326331
excludedModels:
327332
- "some-org/unwanted-model"
328333
- "another-org/test-*" # Excludes all models starting with "test-"
329-
334+
330335
# Optional: Configure a custom environment variable name for the API key
331336
# Defaults to "HF_API_KEY" if not specified
332337
properties:
333338
apiKeyEnvVar: "MY_CUSTOM_API_KEY_VAR"
334339
```
335340

341+
#### Organization-Restricted Sources
342+
343+
You can restrict a source to only fetch models from a specific organization using the `allowedOrganization` property. This automatically prefixes all model patterns with the organization name:
344+
345+
```yaml
346+
catalogs:
347+
- name: "Meta LLaMA Models"
348+
id: "meta-llama-models"
349+
type: "hf"
350+
enabled: true
351+
properties:
352+
allowedOrganization: "meta-llama"
353+
apiKeyEnvVar: "HF_API_KEY"
354+
includedModels:
355+
# These patterns are automatically prefixed with "meta-llama/"
356+
- "*" # Expands to: meta-llama/*
357+
- "Llama-3*" # Expands to: meta-llama/Llama-3*
358+
- "CodeLlama-*" # Expands to: meta-llama/CodeLlama-*
359+
excludedModels:
360+
- "*-4bit" # Excludes: meta-llama/*-4bit
361+
- "*-GGUF" # Excludes: meta-llama/*-GGUF
362+
```
363+
364+
**Benefits of organization-restricted sources:**
365+
- **Simplified configuration**: No need to repeat organization name in every pattern
366+
- **Security**: Prevents accidental inclusion of models from other organizations
367+
- **Convenience**: Use `"*"` to get all models from an organization
368+
- **Performance**: Optimized API calls when fetching from a single organization
369+
336370
#### Model Filtering
337371

338372
Both `includedModels` and `excludedModels` are top-level properties (not nested under `properties`):
339373

340-
- **`includedModels`** (required): List of model identifiers to fetch from HuggingFace. Format: `"organization/model-name"` or `"username/model-name"`
374+
- **`includedModels`** (required): List of model identifiers to fetch from Hugging Face
341375
- **`excludedModels`** (optional): List of models or patterns to exclude from the results
342376

343-
The `excludedModels` property supports:
377+
#### Supported Pattern Types
378+
379+
**Exact Model Names:**
380+
```yaml
381+
includedModels:
382+
- "meta-llama/Llama-3.1-8B-Instruct" # Specific model
383+
- "microsoft/phi-2" # Specific model
384+
```
385+
386+
**Wildcard Patterns:**
387+
388+
In `includedModels`, wildcards can match model names by a prefix.
389+
390+
```yaml
391+
includedModels:
392+
- "microsoft/phi-*" # All models starting with "phi-"
393+
- "meta-llama/Llama-3*" # All models starting with "Llama-3"
394+
- "huggingface/*" # All models from huggingface organization
395+
```
396+
397+
**Organization-Only Patterns (with `allowedOrganization`):**
398+
```yaml
399+
properties:
400+
allowedOrganization: "meta-llama"
401+
includedModels:
402+
- "*" # All models from meta-llama organization
403+
- "Llama-3*" # All meta-llama models starting with "Llama-3"
404+
- "CodeLlama-*" # All meta-llama models starting with "CodeLlama-"
405+
```
406+
407+
#### Pattern Validation
408+
409+
**Valid patterns:**
410+
- `"org/model"` - Exact model name
411+
- `"org/prefix*"` - Models starting with prefix
412+
- `"org/*"` - All models from organization
413+
- `"*"` - All models (only when using `allowedOrganization`)
414+
415+
**Invalid patterns (will be rejected):**
416+
- `"*"` - Global wildcard (without `allowedOrganization`)
417+
- `"*/*"` - Global organization wildcard
418+
- `"org*"` - Wildcard in organization name
419+
- `"org/"` - Empty model name
420+
- `"*prefix*"` - Multiple wildcards
421+
422+
#### Exclusion Patterns
423+
424+
The `excludedModels` property supports prefixes like `includedModels` and also suffixes and mid-name wildcards:
344425
- **Exact matches**: `"meta-llama/Llama-3.1-8B-Instruct"` - excludes this specific model
345-
- **Pattern matching**: `"test-*"` - excludes all models starting with "test-"
426+
- **Pattern matching**:
427+
- `"*-draft"` - excludes all models ending with "-draft"
428+
- `"Llama-3.*-Instruct"` - excludes all Llama 3.x models ending with "-Instruct"
429+
- **Organization patterns**: `"test-org/*"` - excludes all models from test-org
346430

347431
## Development
348432

catalog/internal/catalog/db_catalog.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ func (d *dbCatalogImpl) GetFilterOptions(ctx context.Context) (*apimodels.Filter
252252
Value: filter.Value,
253253
}
254254
}
255+
d.applyMinMax(apiFieldFilters, options)
255256
apiNamedQueries[queryName] = apiFieldFilters
256257
}
257258

@@ -266,6 +267,37 @@ func (d *dbCatalogImpl) GetFilterOptions(ctx context.Context) (*apimodels.Filter
266267
}, nil
267268
}
268269

270+
func (d *dbCatalogImpl) applyMinMax(query map[string]apimodels.FieldFilter, options map[string]apimodels.FilterOption) {
271+
// Find queries where the value is min or max and replace it with the
272+
// actual min or max from the filter options.
273+
for key, filter := range query {
274+
// Find string values that are either min or max
275+
value, ok := filter.Value.(string)
276+
if !ok || (value != "min" && value != "max") {
277+
continue
278+
}
279+
280+
option, ok := options[key]
281+
if !ok || option.Range == nil {
282+
// Skip fields without a corresponding option or options without a range.
283+
continue
284+
}
285+
286+
switch value {
287+
case "min":
288+
if option.Range.Min != nil {
289+
filter.Value = *option.Range.Min
290+
}
291+
case "max":
292+
if option.Range.Max != nil {
293+
filter.Value = *option.Range.Max
294+
}
295+
}
296+
297+
query[key] = filter
298+
}
299+
}
300+
269301
func (d *dbCatalogImpl) GetPerformanceArtifacts(ctx context.Context, modelName string, sourceID string, params ListPerformanceArtifactsParams) (apimodels.CatalogArtifactList, error) {
270302
// Get the model to validate it exists and get its ID
271303
modelsList, err := d.catalogModelRepository.List(dbmodels.CatalogModelListOptions{

0 commit comments

Comments
 (0)