Skip to content
This repository was archived by the owner on Sep 9, 2026. It is now read-only.
Closed
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
70 changes: 70 additions & 0 deletions examples/catalog-items/README.md
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
```
Comment on lines +18 to +27

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Clarify the working directory for these osac create examples.

These commands assume the current directory is examples/catalog-items; otherwise -f simple-ocp-4-17-cluster.yaml and -f . won’t target the intended files. Add an explicit cd examples/catalog-items step or use repo-root-relative paths in the examples.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/catalog-items/README.md` around lines 18 - 24, The osac create
examples using `-f simple-ocp-4-17-cluster.yaml` and `-f .` are ambiguous about
the working directory context. Add an explicit step before these commands to
change into the examples/catalog-items directory using cd, or alternatively
modify the file path arguments to use repo-root-relative paths like `-f
examples/catalog-items/simple-ocp-4-17-cluster.yaml` and `-f
examples/catalog-items/` so the examples work regardless of the user's current
directory.


**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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Scope --insecure to local/dev-only usage in the example.

Please add a short warning that --insecure is only for development environments and should be removed when TLS is properly configured.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/catalog-items/README.md` around lines 33 - 37, The example command
using seed-catalog-items includes the --insecure flag without any warning or
context about its usage restrictions. Add a note or comment in the README
immediately before or after the command block that clearly indicates the
--insecure flag is for local development and testing only, and should be removed
when TLS is properly configured in production environments. This helps
developers understand the security implications and prevents accidental use of
insecure configurations.


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
40 changes: 40 additions & 0 deletions examples/catalog-items/linux-vm.yaml
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 examples/catalog-items/ocp-4-20-nico-baremetal-cluster.yaml
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}$"}'
20 changes: 20 additions & 0 deletions examples/catalog-items/simple-ocp-4-17-cluster.yaml
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}$"}'
40 changes: 40 additions & 0 deletions examples/catalog-items/windows-vm.yaml
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"}'
2 changes: 2 additions & 0 deletions internal/cmd/osac-dev/root_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/osac-project/fulfillment-service/internal/cache"
"github.com/osac-project/fulfillment-service/internal/cmd/cli/help"
"github.com/osac-project/fulfillment-service/internal/cmd/osac-dev/generate"
"github.com/osac-project/fulfillment-service/internal/cmd/osac-dev/seedcatalogitems"
"github.com/osac-project/fulfillment-service/internal/logging"
"github.com/osac-project/fulfillment-service/internal/terminal"
)
Expand Down Expand Up @@ -63,6 +64,7 @@ func Root() (result *cobra.Command, err error) {

// Add commands:
result.AddCommand(generate.Cmd())
result.AddCommand(seedcatalogitems.Cmd())

// Configure the root command, and therefore all its subcommands, to use Markdown for their help output:
help.Setup(result)
Expand Down
Loading