Skip to content

Add initial feature for resource template and replay with the template#2352

Merged
cb-github-robot merged 4 commits intocloud-barista:mainfrom
seokho-son:main
Mar 10, 2026
Merged

Add initial feature for resource template and replay with the template#2352
cb-github-robot merged 4 commits intocloud-barista:mainfrom
seokho-son:main

Conversation

@seokho-son
Copy link
Copy Markdown
Member

  • Add initial feature for resource template and replay with the template

Now, we can support user's custom resource template, default resource template, example resource template, and so on. ;)

Currently, It is an initial version that covers MCI, vNet, SG. Will add template types for the other resource types, once the feature is stable.

Signed-off-by: Seokho Son <shsongist@gmail.com>
Signed-off-by: Seokho Son <shsongist@gmail.com>
Signed-off-by: Seokho Son <shsongist@gmail.com>
Copilot AI review requested due to automatic review settings March 9, 2026 16:20
@seokho-son seokho-son requested a review from yunkon-kim as a code owner March 9, 2026 16:20
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces an initial resource template feature for CB-Tumblebug, enabling users to create, manage, and replay (apply) reusable templates for MCI, vNet, and SecurityGroup resources. Templates are stored in ETCD and can be created manually or extracted from existing MCI configurations. The PR also includes an init script integration for loading template files from disk, example template JSON files, and a cb-spider version bump.

Changes:

  • Add template CRUD model types (MciDynamicTemplateInfo, VNetTemplateInfo, SecurityGroupTemplateInfo, etc.) and backend logic for template create/read/update/delete operations via ETCD
  • Register new REST API routes for template management (CRUD) and template-based resource provisioning for MCI, vNet, and SecurityGroup, along with corresponding Swagger documentation
  • Add init script support for loading template JSON files from init/templates/ directory, with example templates for MCI, vNet, and SecurityGroup

Reviewed changes

Copilot reviewed 16 out of 17 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/core/model/template.go New model types for template Info, Req, ApplyReq, and ListResponse for MCI, vNet, and SecurityGroup
src/core/common/template.go CRUD functions for all three template types, storing/retrieving from ETCD
src/core/common/utility.go New GenTemplateKey function for generating ETCD key paths for templates
src/core/infra/template.go CreateMciDynamicFromTemplate (apply template) and ExtractAndCreateTemplate (extract from existing MCI)
src/interface/rest/server/server.go Route registrations for template CRUD and template-based provisioning endpoints
src/interface/rest/server/infra/manageInfo.go Extended configCopy endpoint to optionally save extracted config as template
src/core/model/common.go Added StrTemplate constant; formatting change in ResourceTypeRegistry
src/core/model/label.go Whitespace-only change (blank line added)
src/interface/rest/docs/swagger.yaml Swagger spec for new template API endpoints and schemas
src/interface/rest/docs/docs.go Go-embedded Swagger doc template with new API definitions
init/init.py New --load-templates CLI option for loading template files from init/templates/
init/templates/global-mci-template.json Example MCI template (extracted from real deployment)
init/templates/aws-small-web.json Example small AWS MCI template
init/templates/aws-web-sg.json Example SecurityGroup template
init/templates/aws-standard-vpc.json Example vNet template
docker-compose.yaml Bumps cb-spider image from 0.12.6 to 0.12.7

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: Seokho Son <shsongist@gmail.com>
@seokho-son
Copy link
Copy Markdown
Member Author

/approve

@github-actions github-actions bot added the approved This PR is approved and will be merged soon. label Mar 10, 2026
@cb-github-robot cb-github-robot merged commit a4e9bde into cloud-barista:main Mar 10, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved This PR is approved and will be merged soon.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants