Skip to content

chore(rest-api): Infer operating system isCloudInit from userData#3102

Merged
nvlitagaki merged 1 commit into
NVIDIA:mainfrom
nvlitagaki:chore/deprecate-is-cloud-init
Jul 2, 2026
Merged

chore(rest-api): Infer operating system isCloudInit from userData#3102
nvlitagaki merged 1 commit into
NVIDIA:mainfrom
nvlitagaki:chore/deprecate-is-cloud-init

Conversation

@nvlitagaki

@nvlitagaki nvlitagaki commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Historically we have ignored whatever value users have specified for isCloudInit on an operating system in favor of checking whether there is cloud-init user data to drive OS behavior. This PR formally deprecates the field on the REST API calls to create or update an operating system and removes the database field. We still however will return the value as part of API response, but it will be simply a derived value that reflects system behavior rather than the value of an unused database column.

Related issues

#3087

Type of Change

  • Add - New feature or capability
  • Change - Changes in existing functionality
  • Fix - Bug fixes
  • Remove - Removed features or deprecated functionality
  • Internal - Internal changes (refactoring, tests, docs, etc.)

Breaking Changes

  • This PR contains breaking changes

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed
  • No testing required (docs, internal refactor, etc.)

Additional Notes

@nvlitagaki nvlitagaki requested a review from a team as a code owner July 2, 2026 18:46
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 10ec2ca3-f068-4b92-9c03-ce082f31846c

📥 Commits

Reviewing files that changed from the base of the PR and between 43bc142 and b79de0e.

📒 Files selected for processing (11)
  • rest-api/api/pkg/api/handler/operatingsystem.go
  • rest-api/api/pkg/api/handler/operatingsystem_test.go
  • rest-api/api/pkg/api/model/operatingsystem.go
  • rest-api/api/pkg/api/model/operatingsystem_test.go
  • rest-api/cli/tui/commands.go
  • rest-api/db/pkg/db/model/operatingsystem.go
  • rest-api/db/pkg/db/model/operatingsystem_test.go
  • rest-api/db/pkg/migrations/20260702120000_drop_operating_system_is_cloud_init.go
  • rest-api/docs/index.html
  • rest-api/openapi/deprecations.md
  • rest-api/openapi/spec.yaml
💤 Files with no reviewable changes (2)
  • rest-api/api/pkg/api/handler/operatingsystem.go
  • rest-api/cli/tui/commands.go
✅ Files skipped from review due to trivial changes (2)
  • rest-api/openapi/deprecations.md
  • rest-api/openapi/spec.yaml
🚧 Files skipped from review as they are similar to previous changes (6)
  • rest-api/db/pkg/migrations/20260702120000_drop_operating_system_is_cloud_init.go
  • rest-api/api/pkg/api/handler/operatingsystem_test.go
  • rest-api/api/pkg/api/model/operatingsystem.go
  • rest-api/db/pkg/db/model/operatingsystem.go
  • rest-api/db/pkg/db/model/operatingsystem_test.go
  • rest-api/api/pkg/api/model/operatingsystem_test.go

Summary by CodeRabbit

  • Bug Fixes

    • Operating system cloud-init status is now derived from userData, so API responses match actual configuration.
    • The isCloudInit request value is deprecated and ignored for create and update.
  • New Features

    • Added support for saving and returning additional operating system fields, including root filesystem label and iPXE script.
  • Documentation

    • Updated API documentation and deprecation notes to reflect the new userData-driven isCloudInit behavior.
    • Updated interactive CLI flow to no longer prompt for a separate cloud-init setting.

Walkthrough

This PR removes persisted IsCloudInit storage, derives the API value from userData, and updates handlers, CLI input, database schema, tests, and OpenAPI documentation to match.

Changes

IsCloudInit derivation and removal

Layer / File(s) Summary
Derivation helper and API response mapping
rest-api/api/pkg/api/model/operatingsystem.go, rest-api/api/pkg/api/model/operatingsystem_test.go
Adds IsCloudInitFromUserData, updates API model comments, and sets response IsCloudInit from userData with unit tests.
Handler create/update field mapping
rest-api/api/pkg/api/handler/operatingsystem.go, rest-api/api/pkg/api/handler/operatingsystem_test.go
Removes IsCloudInit from create/update DB input mapping and adjusts handler fixtures and expectations.
DB model field and DAO removal
rest-api/db/pkg/db/model/operatingsystem.go, rest-api/db/pkg/db/model/operatingsystem_test.go
Removes IsCloudInit from the DB model, inputs, DAO logic, order-by fields, and DAO tests.
Database migration for column drop
rest-api/db/pkg/migrations/20260702120000_drop_operating_system_is_cloud_init.go
Adds an up/down migration that drops is_cloud_init and restores it from user_data on rollback.
CLI prompt and payload removal
rest-api/cli/tui/commands.go
Removes the cloud-init prompt and omits isCloudInit from the OS create payload.
OpenAPI and deprecation documentation updates
rest-api/openapi/spec.yaml, rest-api/openapi/deprecations.md
Marks request-side isCloudInit as deprecated, rewrites the response semantics, and updates examples and deprecation notes.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related issues

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly reflects the main change: deriving operating system isCloudInit from userData instead of persisting it.
Description check ✅ Passed The description is directly aligned with the PR, explaining the deprecation of isCloudInit, DB removal, and derived response behavior.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

🔍 Container Scan Summary

Service Total Critical High Medium Low Other
nico-flow 13 1 2 2 1 7
nico-nsm 5 0 0 4 1 0
nico-psm 13 1 2 2 1 7
nico-rest-api 13 1 2 2 1 7
nico-rest-cert-manager 12 1 2 2 0 7
nico-rest-db 13 1 2 2 1 7
nico-rest-site-agent 12 1 2 2 0 7
nico-rest-site-manager 12 1 2 2 0 7
nico-rest-workflow 13 1 2 2 1 7
TOTAL 106 8 16 20 6 56

Per-CVE detail lives in the per-service grype-* artifacts (JSON + SARIF). Severity counts only — no CVE IDs published here.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

🔐 TruffleHog Secret Scan

No secrets or credentials found!

Your code has been scanned for 700+ types of secrets and credentials. All clear! 🎉

🔗 View scan details

🕐 Last updated: 2026-07-02 18:50:05 UTC | Commit: 27ab053

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
rest-api/api/pkg/api/handler/operatingsystem_test.go (1)

1170-1477: 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

Compile break: IsCloudInit field no longer exists on cdbm.OperatingSystemCreateInput.

Thirteen osDAO.Create(...) calls in this test (os1 through os13, e.g. lines 1180, 1201, 1222, 1243, 1264, 1298, 1320, 1342, 1363, 1397, 1420, 1443, 1469) still set IsCloudInit: true on cdbm.OperatingSystemCreateInput. Per this PR's DB model changes (rest-api/db/pkg/db/model/operatingsystem.go), that field has been removed from OperatingSystemCreateInput. This test file will fail to compile as-is. The sibling db/pkg/db/model/operatingsystem_test.go in this same PR was correctly updated to drop the field — this file was missed.

🛠️ Proposed fix (apply to all 13 occurrences)
 		cdbm.OperatingSystemCreateInput{
 			Name:               "test-operating-system-1",
 			Description:        cutil.GetPtr("Test Description 1"),
 			Org:                ipOrg1,
 			TenantID:           &tenant1.ID,
 			OsType:             cdbm.OperatingSystemTypeIPXE,
 			IpxeScript:         cutil.GetPtr("ipxe"),
-			IsCloudInit:        true,
 			AllowOverride:      false,
 			EnableBlockStorage: false,
 			PhoneHomeEnabled:   false,
 			Status:             cdbm.OperatingSystemStatusPending,
 			CreatedBy:          user.ID,
 		},
🤖 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 `@rest-api/api/pkg/api/handler/operatingsystem_test.go` around lines 1170 -
1477, The `osDAO.Create` setup in `operatingsystem_test.go` still uses the
removed `cdbm.OperatingSystemCreateInput.IsCloudInit` field, causing a compile
break. Update every `os1` through `os13` test fixture to stop populating
`IsCloudInit` in the `OperatingSystemCreateInput` literals, matching the
already-updated `operatingsystem_test.go` in the db model package. Keep the rest
of each `osDAO.Create` call unchanged so the test data continues to cover the
same scenarios.
🤖 Prompt for all review comments with 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.

Outside diff comments:
In `@rest-api/api/pkg/api/handler/operatingsystem_test.go`:
- Around line 1170-1477: The `osDAO.Create` setup in `operatingsystem_test.go`
still uses the removed `cdbm.OperatingSystemCreateInput.IsCloudInit` field,
causing a compile break. Update every `os1` through `os13` test fixture to stop
populating `IsCloudInit` in the `OperatingSystemCreateInput` literals, matching
the already-updated `operatingsystem_test.go` in the db model package. Keep the
rest of each `osDAO.Create` call unchanged so the test data continues to cover
the same scenarios.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: b4d353bf-f96e-4da6-8853-bd18e41f4b41

📥 Commits

Reviewing files that changed from the base of the PR and between 7a199a7 and 27ab053.

📒 Files selected for processing (11)
  • rest-api/api/pkg/api/handler/operatingsystem.go
  • rest-api/api/pkg/api/handler/operatingsystem_test.go
  • rest-api/api/pkg/api/model/operatingsystem.go
  • rest-api/api/pkg/api/model/operatingsystem_test.go
  • rest-api/cli/tui/commands.go
  • rest-api/db/pkg/db/model/operatingsystem.go
  • rest-api/db/pkg/db/model/operatingsystem_test.go
  • rest-api/db/pkg/migrations/20260702120000_drop_operating_system_is_cloud_init.go
  • rest-api/docs/index.html
  • rest-api/openapi/deprecations.md
  • rest-api/openapi/spec.yaml
💤 Files with no reviewable changes (2)
  • rest-api/cli/tui/commands.go
  • rest-api/api/pkg/api/handler/operatingsystem.go

@nvlitagaki nvlitagaki force-pushed the chore/deprecate-is-cloud-init branch from 27ab053 to 43bc142 Compare July 2, 2026 19:03

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
rest-api/api/pkg/api/handler/operatingsystem_test.go (1)

1995-2012: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Stray IsCloudInit: true left in os6 fixture.

Every other OperatingSystemCreateInput literal in this file (lines 439-466, 507-541, 887-930, 1170-1450, delete-test fixtures) had IsCloudInit: true stripped, but this one at Line 2005 was missed. Since the dependent DB-model layer removes IsCloudInit from OperatingSystemCreateInput entirely, this leftover field reference will fail to compile once that change lands.

🔧 Proposed fix
 	os6, err := osDAO.Create(
 		ctx,
 		nil,
 		cdbm.OperatingSystemCreateInput{
 			Name:               "test-operating-system-6",
 			Description:        cutil.GetPtr("Test Description 6"),
 			Org:                tnOrg3,
 			TenantID:           &tenant3.ID,
 			OsType:             cdbm.OperatingSystemTypeImage,
 			ImageURL:           cutil.GetPtr("https://oldimagepath.iso"),
-			IsCloudInit:        true,
 			AllowOverride:      false,
 			EnableBlockStorage: true,
 			PhoneHomeEnabled:   false,
 			Status:             cdbm.OperatingSystemStatusReady,
 			CreatedBy:          tnu.ID,
 		},
 	)
🤖 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 `@rest-api/api/pkg/api/handler/operatingsystem_test.go` around lines 1995 -
2012, Remove the leftover IsCloudInit field from the os6
OperatingSystemCreateInput fixture in operatingsystem_test.go, since
OperatingSystemCreateInput no longer includes that property. Update the os6
setup in the Create call to match the other fixtures in this file and ensure the
test compiles against the current cdbm.OperatingSystemCreateInput definition.
🤖 Prompt for all review comments with 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.

Outside diff comments:
In `@rest-api/api/pkg/api/handler/operatingsystem_test.go`:
- Around line 1995-2012: Remove the leftover IsCloudInit field from the os6
OperatingSystemCreateInput fixture in operatingsystem_test.go, since
OperatingSystemCreateInput no longer includes that property. Update the os6
setup in the Create call to match the other fixtures in this file and ensure the
test compiles against the current cdbm.OperatingSystemCreateInput definition.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 46caed31-0bf8-4a41-b2b0-1f5ffe8df5f2

📥 Commits

Reviewing files that changed from the base of the PR and between 27ab053 and 43bc142.

📒 Files selected for processing (11)
  • rest-api/api/pkg/api/handler/operatingsystem.go
  • rest-api/api/pkg/api/handler/operatingsystem_test.go
  • rest-api/api/pkg/api/model/operatingsystem.go
  • rest-api/api/pkg/api/model/operatingsystem_test.go
  • rest-api/cli/tui/commands.go
  • rest-api/db/pkg/db/model/operatingsystem.go
  • rest-api/db/pkg/db/model/operatingsystem_test.go
  • rest-api/db/pkg/migrations/20260702120000_drop_operating_system_is_cloud_init.go
  • rest-api/docs/index.html
  • rest-api/openapi/deprecations.md
  • rest-api/openapi/spec.yaml
💤 Files with no reviewable changes (2)
  • rest-api/cli/tui/commands.go
  • rest-api/api/pkg/api/handler/operatingsystem.go
✅ Files skipped from review due to trivial changes (1)
  • rest-api/openapi/deprecations.md
🚧 Files skipped from review as they are similar to previous changes (6)
  • rest-api/db/pkg/migrations/20260702120000_drop_operating_system_is_cloud_init.go
  • rest-api/api/pkg/api/model/operatingsystem.go
  • rest-api/openapi/spec.yaml
  • rest-api/db/pkg/db/model/operatingsystem.go
  • rest-api/api/pkg/api/model/operatingsystem_test.go
  • rest-api/db/pkg/db/model/operatingsystem_test.go

Comment thread rest-api/db/pkg/db/model/operatingsystem.go
@nvlitagaki nvlitagaki force-pushed the chore/deprecate-is-cloud-init branch from 43bc142 to b79de0e Compare July 2, 2026 19:18

@hwadekar-nv hwadekar-nv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good Leah !!

@nvlitagaki nvlitagaki merged commit 643c9c2 into NVIDIA:main Jul 2, 2026
119 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants