Skip to content

Commit 8d4e577

Browse files
authored
chore: expose cmpd file template variables (#10116)
1 parent 2e51cd5 commit 8d4e577

9 files changed

Lines changed: 399 additions & 0 deletions

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
@@ -4732,6 +4732,34 @@ spec:
47324732
maxLength: 63
47334733
pattern: ^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$
47344734
type: string
4735+
variables:
4736+
description: |-
4737+
Declares the user-configurable variables supported by this file template.
4738+
4739+
4740+
This field is used for API discovery so users can inspect the ComponentDefinition and learn which
4741+
variables are accepted by `cluster.spec.componentSpecs[*].configs[*].variables` without reading the
4742+
template content directly.
4743+
items:
4744+
description: FileTemplateVariable declares a user-configurable
4745+
variable supported by a file template.
4746+
properties:
4747+
defaultValue:
4748+
description: Specifies the default value used.
4749+
type: string
4750+
description:
4751+
description: Provides a human-readable explanation of
4752+
the variable's purpose.
4753+
type: string
4754+
name:
4755+
description: |-
4756+
Specifies the variable name that can be referenced from the file template and set by users
4757+
through `cluster.spec.componentSpecs[*].configs[*].variables`.
4758+
type: string
4759+
required:
4760+
- name
4761+
type: object
4762+
type: array
47354763
volumeName:
47364764
description: |-
47374765
Refers to the volume name of PodTemplate. The file produced through the template will be mounted to
@@ -19006,6 +19034,34 @@ spec:
1900619034
maxLength: 63
1900719035
pattern: ^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$
1900819036
type: string
19037+
variables:
19038+
description: |-
19039+
Declares the user-configurable variables supported by this file template.
19040+
19041+
19042+
This field is used for API discovery so users can inspect the ComponentDefinition and learn which
19043+
variables are accepted by `cluster.spec.componentSpecs[*].configs[*].variables` without reading the
19044+
template content directly.
19045+
items:
19046+
description: FileTemplateVariable declares a user-configurable
19047+
variable supported by a file template.
19048+
properties:
19049+
defaultValue:
19050+
description: Specifies the default value used.
19051+
type: string
19052+
description:
19053+
description: Provides a human-readable explanation of
19054+
the variable's purpose.
19055+
type: string
19056+
name:
19057+
description: |-
19058+
Specifies the variable name that can be referenced from the file template and set by users
19059+
through `cluster.spec.componentSpecs[*].configs[*].variables`.
19060+
type: string
19061+
required:
19062+
- name
19063+
type: object
19064+
type: array
1900919065
volumeName:
1901019066
description: |-
1901119067
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
@@ -661,6 +661,34 @@ spec:
661661
maxLength: 63
662662
pattern: ^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$
663663
type: string
664+
variables:
665+
description: |-
666+
Declares the user-configurable variables supported by this file template.
667+
668+
669+
This field is used for API discovery so users can inspect the ComponentDefinition and learn which
670+
variables are accepted by `cluster.spec.componentSpecs[*].configs[*].variables` without reading the
671+
template content directly.
672+
items:
673+
description: FileTemplateVariable declares a user-configurable
674+
variable supported by a file template.
675+
properties:
676+
defaultValue:
677+
description: Specifies the default value used.
678+
type: string
679+
description:
680+
description: Provides a human-readable explanation
681+
of the variable's purpose.
682+
type: string
683+
name:
684+
description: |-
685+
Specifies the variable name that can be referenced from the file template and set by users
686+
through `cluster.spec.componentSpecs[*].configs[*].variables`.
687+
type: string
688+
required:
689+
- name
690+
type: object
691+
type: array
664692
volumeName:
665693
description: |-
666694
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
@@ -4732,6 +4732,34 @@ spec:
47324732
maxLength: 63
47334733
pattern: ^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$
47344734
type: string
4735+
variables:
4736+
description: |-
4737+
Declares the user-configurable variables supported by this file template.
4738+
4739+
4740+
This field is used for API discovery so users can inspect the ComponentDefinition and learn which
4741+
variables are accepted by `cluster.spec.componentSpecs[*].configs[*].variables` without reading the
4742+
template content directly.
4743+
items:
4744+
description: FileTemplateVariable declares a user-configurable
4745+
variable supported by a file template.
4746+
properties:
4747+
defaultValue:
4748+
description: Specifies the default value used.
4749+
type: string
4750+
description:
4751+
description: Provides a human-readable explanation of
4752+
the variable's purpose.
4753+
type: string
4754+
name:
4755+
description: |-
4756+
Specifies the variable name that can be referenced from the file template and set by users
4757+
through `cluster.spec.componentSpecs[*].configs[*].variables`.
4758+
type: string
4759+
required:
4760+
- name
4761+
type: object
4762+
type: array
47354763
volumeName:
47364764
description: |-
47374765
Refers to the volume name of PodTemplate. The file produced through the template will be mounted to
@@ -19006,6 +19034,34 @@ spec:
1900619034
maxLength: 63
1900719035
pattern: ^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$
1900819036
type: string
19037+
variables:
19038+
description: |-
19039+
Declares the user-configurable variables supported by this file template.
19040+
19041+
19042+
This field is used for API discovery so users can inspect the ComponentDefinition and learn which
19043+
variables are accepted by `cluster.spec.componentSpecs[*].configs[*].variables` without reading the
19044+
template content directly.
19045+
items:
19046+
description: FileTemplateVariable declares a user-configurable
19047+
variable supported by a file template.
19048+
properties:
19049+
defaultValue:
19050+
description: Specifies the default value used.
19051+
type: string
19052+
description:
19053+
description: Provides a human-readable explanation of
19054+
the variable's purpose.
19055+
type: string
19056+
name:
19057+
description: |-
19058+
Specifies the variable name that can be referenced from the file template and set by users
19059+
through `cluster.spec.componentSpecs[*].configs[*].variables`.
19060+
type: string
19061+
required:
19062+
- name
19063+
type: object
19064+
type: array
1900919065
volumeName:
1901019066
description: |-
1901119067
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)