This repository was archived by the owner on Sep 9, 2026. It is now read-only.
Repository navigation
OSAC-1419: add script for seeding default catalog items #724
Closed
vladikr
wants to merge
1
commit into
osac-project:main
from
vladikr:feat/OSAC-1419-seed-catalog-items
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| # Catalog Item Examples | ||
|
|
||
| This directory contains example catalog items that can be created in the OSAC fulfillment service. These YAML files can be used directly with `osac create -f` for one-off creation, or as reference for the `osac-dev seed-catalog-items` idempotent seeding command. | ||
|
|
||
| ## Contents | ||
|
|
||
| - `simple-ocp-4-17-cluster.yaml` — Simple OpenShift 4.17 cluster (fc430 hardware) | ||
| - `ocp-4-20-nico-baremetal-cluster.yaml` — OpenShift 4.20 cluster on NICo bare metal | ||
| - `linux-vm.yaml` — General-purpose Linux VM | ||
| - `windows-vm.yaml` — Windows VM | ||
|
|
||
| ## Usage | ||
|
|
||
| ### Using the osac CLI | ||
|
|
||
| Catalog items are part of the **private API**, so you must first log in with the `--private` flag to enable private API access: | ||
|
|
||
| ```bash | ||
| # Log in with private API access enabled | ||
| osac login --private ... | ||
|
|
||
| # Create each catalog item | ||
| osac create -f simple-ocp-4-17-cluster.yaml | ||
| osac create -f ocp-4-20-nico-baremetal-cluster.yaml | ||
| osac create -f linux-vm.yaml | ||
| osac create -f windows-vm.yaml | ||
| ``` | ||
|
|
||
| **Note:** The `osac create -f` command is **not idempotent** — it will fail if the catalog item already exists. | ||
|
|
||
| ### Using the osac-dev CLI (idempotent) | ||
|
|
||
| For idempotent seeding (safe to run multiple times), use the `osac-dev seed-catalog-items` subcommand: | ||
|
|
||
| ```bash | ||
| go run ./cmd/osac-dev seed-catalog-items \ | ||
| --api-url=fulfillment-api.osac.svc.cluster.local:443 \ | ||
| --token=$(kubectl create token -n osac client) \ | ||
| --insecure | ||
| ``` | ||
|
Comment on lines
+36
to
+40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Scope Please add a short warning that 🤖 Prompt for AI Agents |
||
|
|
||
| This command: | ||
| - Creates all 4 catalog items if they don't exist | ||
| - Skips items that already exist (by name) | ||
| - Connects directly to the gRPC API | ||
|
|
||
| ## Authentication | ||
|
|
||
| Both methods require authentication: | ||
|
|
||
| - **osac CLI**: Set up authentication with `osac login` first, or use `--token` flag | ||
| - **osac-dev CLI**: Requires `--api-url` and `--token` flags | ||
|
|
||
| Example token generation for development: | ||
|
|
||
| ```bash | ||
| kubectl create token -n osac client | ||
| ``` | ||
|
|
||
| ## File Format | ||
|
|
||
| These YAML files use the protobuf `Any` encoding format required by `osac create -f`. Each file includes: | ||
|
|
||
| - `@type` field: Identifies the protobuf message type (e.g., `type.googleapis.com/osac.private.v1.ClusterCatalogItem`) | ||
| - `metadata.name`: Unique identifier for the catalog item | ||
| - `title`: Human-friendly display name | ||
| - `description`: Detailed description (supports Markdown) | ||
| - `template`: Template identifier this catalog item references | ||
| - `published`: Whether visible in the public API | ||
| - `field_definitions`: List of user-editable fields with validation schemas | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # Linux Virtual Machine catalog item | ||
| # A general-purpose Linux virtual machine with customizable resources. | ||
|
|
||
| "@type": type.googleapis.com/osac.private.v1.ComputeInstanceCatalogItem | ||
| metadata: | ||
| name: linux-vm | ||
| title: Linux Virtual Machine | ||
| description: A general-purpose Linux virtual machine with customizable resources. | ||
| template: osac.templates.ocp_virt_vm | ||
| published: true | ||
| field_definitions: | ||
| - path: instance_type | ||
| display_name: Instance Type | ||
| editable: true | ||
| default: cx1.2xlarge | ||
| validation_schema: '{"type":"string","minLength":1}' | ||
| - path: boot_disk.size_gib | ||
| display_name: Boot Disk Size (GiB) | ||
| editable: true | ||
| default: 120 | ||
| validation_schema: '{"type":"integer","minimum":10,"maximum":1024}' | ||
| - path: image.source_ref | ||
| display_name: Container Disk Image | ||
| editable: true | ||
| default: quay.io/containerdisks/fedora:latest | ||
| validation_schema: '{"type":"string","pattern":"^[a-z0-9./-]+:[a-z0-9._-]+$"}' | ||
| - path: image.source_type | ||
| display_name: Image Source Type | ||
| editable: false | ||
| default: registry | ||
| validation_schema: '{"type":"string"}' | ||
| - path: run_strategy | ||
| display_name: Run Strategy | ||
| editable: true | ||
| default: Always | ||
| validation_schema: '{"type":"string","enum":["Always","Halted"]}' | ||
| - path: user_data | ||
| display_name: Cloud Init User Data | ||
| editable: true | ||
| validation_schema: '{"type":"string"}' |
20 changes: 20 additions & 0 deletions
20
examples/catalog-items/ocp-4-20-nico-baremetal-cluster.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # OpenShift 4.20 Cluster (NICo Bare Metal) catalog item | ||
| # An OpenShift 4.20 cluster on NICo bare metal infrastructure with DGX nodes. | ||
| # Optimized for GPU workloads and high-performance computing. | ||
|
|
||
| "@type": type.googleapis.com/osac.private.v1.ClusterCatalogItem | ||
| metadata: | ||
| name: ocp-4-20-nico-baremetal-cluster | ||
| title: OpenShift 4.20 Cluster (NICo Bare Metal) | ||
| description: An OpenShift 4.20 cluster on NICo bare metal infrastructure with DGX nodes. Optimized for GPU workloads and high-performance computing. | ||
| template: osac.templates.ocp_4_20_small_nico | ||
| published: true | ||
| field_definitions: | ||
| - path: spec.network.pod_cidr | ||
| display_name: Pod CIDR | ||
| editable: true | ||
| validation_schema: '{"type":"string","pattern":"^([0-9]{1,3}\\.){3}[0-9]{1,3}/[0-9]{1,2}$"}' | ||
| - path: spec.network.service_cidr | ||
| display_name: Service CIDR | ||
| editable: true | ||
| validation_schema: '{"type":"string","pattern":"^([0-9]{1,3}\\.){3}[0-9]{1,3}/[0-9]{1,2}$"}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # Simple OpenShift 4.17 Cluster catalog item | ||
| # A small OpenShift 4.17 cluster with 2 worker nodes on fc430 hardware. | ||
| # Suitable for development and testing workloads. | ||
|
|
||
| "@type": type.googleapis.com/osac.private.v1.ClusterCatalogItem | ||
| metadata: | ||
| name: simple-ocp-4-17-cluster | ||
| title: Simple OpenShift 4.17 Cluster | ||
| description: A small OpenShift 4.17 cluster with 2 worker nodes on fc430 hardware. Suitable for development and testing workloads. | ||
| template: osac.templates.ocp_4_17_small | ||
| published: true | ||
| field_definitions: | ||
| - path: spec.network.pod_cidr | ||
| display_name: Pod CIDR | ||
| editable: true | ||
| validation_schema: '{"type":"string","pattern":"^([0-9]{1,3}\\.){3}[0-9]{1,3}/[0-9]{1,2}$"}' | ||
| - path: spec.network.service_cidr | ||
| display_name: Service CIDR | ||
| editable: true | ||
| validation_schema: '{"type":"string","pattern":"^([0-9]{1,3}\\.){3}[0-9]{1,3}/[0-9]{1,2}$"}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # Windows Virtual Machine catalog item | ||
| # A Windows virtual machine with customizable resources. | ||
|
|
||
| "@type": type.googleapis.com/osac.private.v1.ComputeInstanceCatalogItem | ||
| metadata: | ||
| name: windows-vm | ||
| title: Windows Virtual Machine | ||
| description: A Windows virtual machine with customizable resources. | ||
| template: osac.templates.ocp_virt_vm | ||
| published: true | ||
| field_definitions: | ||
| - path: instance_type | ||
| display_name: Instance Type | ||
| editable: true | ||
| default: cx1.2xlarge | ||
| validation_schema: '{"type":"string","minLength":1}' | ||
| - path: boot_disk.size_gib | ||
| display_name: Boot Disk Size (GiB) | ||
| editable: true | ||
| default: 120 | ||
| validation_schema: '{"type":"integer","minimum":10,"maximum":1024}' | ||
| - path: image.source_ref | ||
| display_name: Container Disk Image | ||
| editable: true | ||
| default: quay.io/containerdisks/windows-server:latest | ||
| validation_schema: '{"type":"string","pattern":"^[a-z0-9./-]+:[a-z0-9._-]+$"}' | ||
| - path: image.source_type | ||
| display_name: Image Source Type | ||
| editable: false | ||
| default: registry | ||
| validation_schema: '{"type":"string"}' | ||
| - path: run_strategy | ||
| display_name: Run Strategy | ||
| editable: true | ||
| default: Always | ||
| validation_schema: '{"type":"string","enum":["Always","Halted"]}' | ||
| - path: user_data | ||
| display_name: Cloud Init User Data | ||
| editable: true | ||
| validation_schema: '{"type":"string"}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clarify the working directory for these
osac createexamples.These commands assume the current directory is
examples/catalog-items; otherwise-f simple-ocp-4-17-cluster.yamland-f .won’t target the intended files. Add an explicitcd examples/catalog-itemsstep or use repo-root-relative paths in the examples.🤖 Prompt for AI Agents