Synchronize from Git repository
This guide explains how to create templates by synchronizing them from a Git repository. The system supports both public and private Git repositories, allowing you to maintain your templates in version control.
Required Parameters
To synchronize a template from a Git repository, you need to provide the following parameters:
Basic Information
name
: A unique name for the template
Git Configuration
git.url
: Repository URL (e.g., https://github.com/org/template-repo.git)git.branch
: Branch name (e.g., main)git.credentials
: Git token or password (for private repositories)git.username
: Git username (for private repositories)git.email
: Git user email (for private repositories)git.base_path
: Path where templates are stored (e.g., templates/)
Repository Structure
Your Git repository should follow this structure. You can find a complete example in our template repository:
repository/
├── .kublade/ # Kublade-specific configuration
│ ├── fields.json # Field configuration
│ └── ports.json # Port configuration
├── kustomization.yaml # Kustomize configuration
├── namespace.yaml # Namespace definition
├── deployment.yaml # Deployment manifest
├── service.yaml # Service manifest
└── other-resources/ # Additional resources
├── configmap.yaml
└── secret.yaml
Field Configuration
The .kublade/fields.json
file defines the input fields that will be available in the template. Each field has specific properties:
[
{
"type": "input_text",
"key": "text_example",
"label": "Text Example",
"value": "example",
"required": true,
"secret": false,
"set_on_create": true,
"set_on_update": false
},
{
"type": "textarea",
"key": "textarea_example",
"label": "Textarea Example",
"value": null,
"required": true,
"secret": false,
"set_on_create": false,
"set_on_update": true
},
{
"type": "input_number",
"key": "number_example",
"label": "Number Example",
"value": 20,
"min": 10,
"max": 100,
"step": 10,
"required": true,
"secret": true,
"set_on_create": true,
"set_on_update": true
},
{
"type": "input_range",
"key": "range_example",
"label": "Range Example",
"value": 5,
"min": 1,
"max": 10,
"step": 1,
"required": false,
"secret": false,
"set_on_create": true,
"set_on_update": true
},
{
"type": "input_radio",
"key": "radio_example",
"label": "Radio Example",
"value": null,
"options": [
{ "label": "Option 1", "value": "option1", "default": true },
{ "label": "Option 2", "value": "option2", "default": false }
],
"required": false,
"secret": false,
"set_on_create": true,
"set_on_update": true
},
{
"type": "input_radio_image",
"key": "radio_image_example",
"label": "Radio Image Example",
"value": null,
"options": [
{ "label": "https://placehold.co/600x400", "value": "option1", "default": true },
{ "label": "https://placehold.co/400x600", "value": "option2", "default": false }
],
"required": false,
"secret": false,
"set_on_create": true,
"set_on_update": true
},
{
"type": "select",
"key": "select_example",
"label": "Select Example",
"value": null,
"options": [
{ "label": "Option 1", "value": "option1", "default": false },
{ "label": "Option 2", "value": "option2", "default": true }
],
"required": false,
"secret": false,
"set_on_create": true,
"set_on_update": true
},
{
"type": "input_checkbox",
"key": "checkbox_example",
"label": "Checkbox Example",
"value": "example",
"required": true,
"secret": false,
"set_on_create": true,
"set_on_update": true
}
]
Field Types and Properties
-
Common Properties
type
: The type of input fieldkey
: Unique identifier for the fieldlabel
: Display name for the fieldvalue
: Default valuerequired
: Whether the field is mandatorysecret
: Whether the field contains sensitive dataset_on_create
: Whether the field can be set during creationset_on_update
: Whether the field can be updated after creation
-
Available Field Types
input_text
: Single-line text inputtextarea
: Multi-line text inputinput_number
: Numeric input with min/max/stepinput_range
: Slider input with min/max/stepinput_radio
: Radio button groupinput_radio_image
: Radio buttons with imagesselect
: Dropdown selectioninput_checkbox
: Checkbox input
Port Configuration
The .kublade/ports.json
file defines the port claims for your template:
[
{
"group": "k8s-test",
"claim": "httpExample",
"preferred_port": 8080,
"random": true
},
{
"group": "k8s-test",
"claim": "httpsExample",
"preferred_port": 8443,
"random": true
}
]
Port Properties
- Common Properties
group
: The port group (e.g., "k8s-test")claim
: Unique identifier for the port claimpreferred_port
: The preferred port numberrandom
: Whether a random port should be used if the preferred port is unavailable
Template Rendering
For detailed information about templating your Kubernetes manifests, including variable usage, conditional logic, and port management, refer to:
- Blade Templating Guide: Learn how to use the Blade templating engine for dynamic manifest generation
- Port Management Guide: Understand how to manage port claims and reservations
Synchronization Process
When synchronizing a template, the system will:
- Clone the specified repository
- Read the template contents
- Validate the template structure
- Make the template available for use
- Periodically check for updates