Skip to content

Commit 6ed48d1

Browse files
committed
feat: expose cmpd file template variables
1 parent ba55563 commit 6ed48d1

9 files changed

+399
-0
lines changed

apis/apps/v1/componentdefinition_types.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,6 +1133,34 @@ type ComponentFileTemplate struct {
11331133
//
11341134
// +optional
11351135
ExternalManaged *bool `json:"externalManaged,omitempty"`
1136+
1137+
// Declares the user-configurable variables supported by this file template.
1138+
//
1139+
// This field is used for API discovery so users can inspect the ComponentDefinition and learn which
1140+
// variables are accepted by `cluster.spec.componentSpecs[*].configs[*].variables` without reading the
1141+
// template content directly.
1142+
//
1143+
// +optional
1144+
Variables []FileTemplateVariable `json:"variables,omitempty"`
1145+
}
1146+
1147+
// FileTemplateVariable declares a user-configurable variable supported by a file template.
1148+
type FileTemplateVariable struct {
1149+
// Specifies the variable name that can be referenced from the file template and set by users
1150+
// through `cluster.spec.componentSpecs[*].configs[*].variables`.
1151+
//
1152+
// +kubebuilder:validation:Required
1153+
Name string `json:"name"`
1154+
1155+
// Provides a human-readable explanation of the variable's purpose.
1156+
//
1157+
// +optional
1158+
Description string `json:"description,omitempty"`
1159+
1160+
// Specifies the default value used.
1161+
//
1162+
// +optional
1163+
DefaultValue string `json:"defaultValue,omitempty"`
11361164
}
11371165

11381166
type LogConfig struct {

apis/apps/v1/zz_generated.deepcopy.go

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/apps.kubeblocks.io_componentdefinitions.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4734,6 +4734,34 @@ spec:
47344734
maxLength: 63
47354735
pattern: ^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$
47364736
type: string
4737+
variables:
4738+
description: |-
4739+
Declares the user-configurable variables supported by this file template.
4740+
4741+
4742+
This field is used for API discovery so users can inspect the ComponentDefinition and learn which
4743+
variables are accepted by `cluster.spec.componentSpecs[*].configs[*].variables` without reading the
4744+
template content directly.
4745+
items:
4746+
description: FileTemplateVariable declares a user-configurable
4747+
variable supported by a file template.
4748+
properties:
4749+
defaultValue:
4750+
description: Specifies the default value used.
4751+
type: string
4752+
description:
4753+
description: Provides a human-readable explanation of
4754+
the variable's purpose.
4755+
type: string
4756+
name:
4757+
description: |-
4758+
Specifies the variable name that can be referenced from the file template and set by users
4759+
through `cluster.spec.componentSpecs[*].configs[*].variables`.
4760+
type: string
4761+
required:
4762+
- name
4763+
type: object
4764+
type: array
47374765
volumeName:
47384766
description: |-
47394767
Refers to the volume name of PodTemplate. The file produced through the template will be mounted to
@@ -19008,6 +19036,34 @@ spec:
1900819036
maxLength: 63
1900919037
pattern: ^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$
1901019038
type: string
19039+
variables:
19040+
description: |-
19041+
Declares the user-configurable variables supported by this file template.
19042+
19043+
19044+
This field is used for API discovery so users can inspect the ComponentDefinition and learn which
19045+
variables are accepted by `cluster.spec.componentSpecs[*].configs[*].variables` without reading the
19046+
template content directly.
19047+
items:
19048+
description: FileTemplateVariable declares a user-configurable
19049+
variable supported by a file template.
19050+
properties:
19051+
defaultValue:
19052+
description: Specifies the default value used.
19053+
type: string
19054+
description:
19055+
description: Provides a human-readable explanation of
19056+
the variable's purpose.
19057+
type: string
19058+
name:
19059+
description: |-
19060+
Specifies the variable name that can be referenced from the file template and set by users
19061+
through `cluster.spec.componentSpecs[*].configs[*].variables`.
19062+
type: string
19063+
required:
19064+
- name
19065+
type: object
19066+
type: array
1901119067
volumeName:
1901219068
description: |-
1901319069
Refers to the volume name of PodTemplate. The file produced through the template will be mounted to

config/crd/bases/apps.kubeblocks.io_sidecardefinitions.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,34 @@ spec:
565565
maxLength: 63
566566
pattern: ^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$
567567
type: string
568+
variables:
569+
description: |-
570+
Declares the user-configurable variables supported by this file template.
571+
572+
573+
This field is used for API discovery so users can inspect the ComponentDefinition and learn which
574+
variables are accepted by `cluster.spec.componentSpecs[*].configs[*].variables` without reading the
575+
template content directly.
576+
items:
577+
description: FileTemplateVariable declares a user-configurable
578+
variable supported by a file template.
579+
properties:
580+
defaultValue:
581+
description: Specifies the default value used.
582+
type: string
583+
description:
584+
description: Provides a human-readable explanation of
585+
the variable's purpose.
586+
type: string
587+
name:
588+
description: |-
589+
Specifies the variable name that can be referenced from the file template and set by users
590+
through `cluster.spec.componentSpecs[*].configs[*].variables`.
591+
type: string
592+
required:
593+
- name
594+
type: object
595+
type: array
568596
volumeName:
569597
description: |-
570598
Refers to the volume name of PodTemplate. The file produced through the template will be mounted to
@@ -2437,6 +2465,34 @@ spec:
24372465
maxLength: 63
24382466
pattern: ^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$
24392467
type: string
2468+
variables:
2469+
description: |-
2470+
Declares the user-configurable variables supported by this file template.
2471+
2472+
2473+
This field is used for API discovery so users can inspect the ComponentDefinition and learn which
2474+
variables are accepted by `cluster.spec.componentSpecs[*].configs[*].variables` without reading the
2475+
template content directly.
2476+
items:
2477+
description: FileTemplateVariable declares a user-configurable
2478+
variable supported by a file template.
2479+
properties:
2480+
defaultValue:
2481+
description: Specifies the default value used.
2482+
type: string
2483+
description:
2484+
description: Provides a human-readable explanation of
2485+
the variable's purpose.
2486+
type: string
2487+
name:
2488+
description: |-
2489+
Specifies the variable name that can be referenced from the file template and set by users
2490+
through `cluster.spec.componentSpecs[*].configs[*].variables`.
2491+
type: string
2492+
required:
2493+
- name
2494+
type: object
2495+
type: array
24402496
volumeName:
24412497
description: |-
24422498
Refers to the volume name of PodTemplate. The file produced through the template will be mounted to

config/crd/bases/parameters.kubeblocks.io_componentparameters.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,34 @@ spec:
629629
maxLength: 63
630630
pattern: ^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$
631631
type: string
632+
variables:
633+
description: |-
634+
Declares the user-configurable variables supported by this file template.
635+
636+
637+
This field is used for API discovery so users can inspect the ComponentDefinition and learn which
638+
variables are accepted by `cluster.spec.componentSpecs[*].configs[*].variables` without reading the
639+
template content directly.
640+
items:
641+
description: FileTemplateVariable declares a user-configurable
642+
variable supported by a file template.
643+
properties:
644+
defaultValue:
645+
description: Specifies the default value used.
646+
type: string
647+
description:
648+
description: Provides a human-readable explanation
649+
of the variable's purpose.
650+
type: string
651+
name:
652+
description: |-
653+
Specifies the variable name that can be referenced from the file template and set by users
654+
through `cluster.spec.componentSpecs[*].configs[*].variables`.
655+
type: string
656+
required:
657+
- name
658+
type: object
659+
type: array
632660
volumeName:
633661
description: |-
634662
Refers to the volume name of PodTemplate. The file produced through the template will be mounted to

deploy/helm/crds/apps.kubeblocks.io_componentdefinitions.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4734,6 +4734,34 @@ spec:
47344734
maxLength: 63
47354735
pattern: ^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$
47364736
type: string
4737+
variables:
4738+
description: |-
4739+
Declares the user-configurable variables supported by this file template.
4740+
4741+
4742+
This field is used for API discovery so users can inspect the ComponentDefinition and learn which
4743+
variables are accepted by `cluster.spec.componentSpecs[*].configs[*].variables` without reading the
4744+
template content directly.
4745+
items:
4746+
description: FileTemplateVariable declares a user-configurable
4747+
variable supported by a file template.
4748+
properties:
4749+
defaultValue:
4750+
description: Specifies the default value used.
4751+
type: string
4752+
description:
4753+
description: Provides a human-readable explanation of
4754+
the variable's purpose.
4755+
type: string
4756+
name:
4757+
description: |-
4758+
Specifies the variable name that can be referenced from the file template and set by users
4759+
through `cluster.spec.componentSpecs[*].configs[*].variables`.
4760+
type: string
4761+
required:
4762+
- name
4763+
type: object
4764+
type: array
47374765
volumeName:
47384766
description: |-
47394767
Refers to the volume name of PodTemplate. The file produced through the template will be mounted to
@@ -19008,6 +19036,34 @@ spec:
1900819036
maxLength: 63
1900919037
pattern: ^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$
1901019038
type: string
19039+
variables:
19040+
description: |-
19041+
Declares the user-configurable variables supported by this file template.
19042+
19043+
19044+
This field is used for API discovery so users can inspect the ComponentDefinition and learn which
19045+
variables are accepted by `cluster.spec.componentSpecs[*].configs[*].variables` without reading the
19046+
template content directly.
19047+
items:
19048+
description: FileTemplateVariable declares a user-configurable
19049+
variable supported by a file template.
19050+
properties:
19051+
defaultValue:
19052+
description: Specifies the default value used.
19053+
type: string
19054+
description:
19055+
description: Provides a human-readable explanation of
19056+
the variable's purpose.
19057+
type: string
19058+
name:
19059+
description: |-
19060+
Specifies the variable name that can be referenced from the file template and set by users
19061+
through `cluster.spec.componentSpecs[*].configs[*].variables`.
19062+
type: string
19063+
required:
19064+
- name
19065+
type: object
19066+
type: array
1901119067
volumeName:
1901219068
description: |-
1901319069
Refers to the volume name of PodTemplate. The file produced through the template will be mounted to

deploy/helm/crds/apps.kubeblocks.io_sidecardefinitions.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,34 @@ spec:
565565
maxLength: 63
566566
pattern: ^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$
567567
type: string
568+
variables:
569+
description: |-
570+
Declares the user-configurable variables supported by this file template.
571+
572+
573+
This field is used for API discovery so users can inspect the ComponentDefinition and learn which
574+
variables are accepted by `cluster.spec.componentSpecs[*].configs[*].variables` without reading the
575+
template content directly.
576+
items:
577+
description: FileTemplateVariable declares a user-configurable
578+
variable supported by a file template.
579+
properties:
580+
defaultValue:
581+
description: Specifies the default value used.
582+
type: string
583+
description:
584+
description: Provides a human-readable explanation of
585+
the variable's purpose.
586+
type: string
587+
name:
588+
description: |-
589+
Specifies the variable name that can be referenced from the file template and set by users
590+
through `cluster.spec.componentSpecs[*].configs[*].variables`.
591+
type: string
592+
required:
593+
- name
594+
type: object
595+
type: array
568596
volumeName:
569597
description: |-
570598
Refers to the volume name of PodTemplate. The file produced through the template will be mounted to
@@ -2437,6 +2465,34 @@ spec:
24372465
maxLength: 63
24382466
pattern: ^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$
24392467
type: string
2468+
variables:
2469+
description: |-
2470+
Declares the user-configurable variables supported by this file template.
2471+
2472+
2473+
This field is used for API discovery so users can inspect the ComponentDefinition and learn which
2474+
variables are accepted by `cluster.spec.componentSpecs[*].configs[*].variables` without reading the
2475+
template content directly.
2476+
items:
2477+
description: FileTemplateVariable declares a user-configurable
2478+
variable supported by a file template.
2479+
properties:
2480+
defaultValue:
2481+
description: Specifies the default value used.
2482+
type: string
2483+
description:
2484+
description: Provides a human-readable explanation of
2485+
the variable's purpose.
2486+
type: string
2487+
name:
2488+
description: |-
2489+
Specifies the variable name that can be referenced from the file template and set by users
2490+
through `cluster.spec.componentSpecs[*].configs[*].variables`.
2491+
type: string
2492+
required:
2493+
- name
2494+
type: object
2495+
type: array
24402496
volumeName:
24412497
description: |-
24422498
Refers to the volume name of PodTemplate. The file produced through the template will be mounted to

0 commit comments

Comments
 (0)