Skip to content

Commit 59c9b6e

Browse files
committed
refine API
1 parent 3a2bd3a commit 59c9b6e

15 files changed

+363
-132
lines changed

apis/apps/v1/componentdefinition_types.go

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,25 +1106,35 @@ type ComponentFileTemplate struct {
11061106
// +optional
11071107
DefaultMode *int32 `json:"defaultMode,omitempty"`
11081108

1109-
// ExternalManaged indicates whether the configuration is managed by an external system.
1110-
// When set to true, the controller will ignore the management of this configuration.
1111-
//
1112-
// +optional
1113-
ExternalManaged *bool `json:"externalManaged,omitempty"`
1114-
1115-
// Specifies whether to restart the pods when the configuration changes.
1109+
// Specifies whether to restart the workload when the file changes.
11161110
//
11171111
// +optional
11181112
RestartOnFileChange *bool `json:"restartOnFileChange,omitempty"`
11191113

1120-
// Defines the procedure that reloads the configuration when the file changes.
1114+
// Defines the procedure that reloads the file when it's content changes.
1115+
//
1116+
// If specified, this action overrides the global reconfigure action defined in lifecycle actions
1117+
// for this specific file template.
11211118
//
11221119
// When @restartOnFileChange is set to true, this action will be ignored.
11231120
//
1121+
// The container executing this action has access to following variables:
1122+
//
1123+
// - KB_CONFIG_FILES_CREATED: file1,file2...
1124+
// - KB_CONFIG_FILES_REMOVED: file1,file2...
1125+
// - KB_CONFIG_FILES_UPDATED: file1:checksum1,file2:checksum2...
1126+
//
11241127
// Note: This field is immutable once it has been set.
11251128
//
11261129
// +optional
11271130
Reconfigure *Action `json:"reconfigure,omitempty"`
1131+
1132+
// ExternalManaged specifies whether the file management is delegated to an external system or manual user control.
1133+
//
1134+
// When set to true, the controller will ignore the management of this file.
1135+
//
1136+
// +optional
1137+
ExternalManaged *bool `json:"externalManaged,omitempty"`
11281138
}
11291139

11301140
type LogConfig struct {

apis/apps/v1/types.go

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -529,22 +529,33 @@ type ClusterComponentConfig struct {
529529
// The external source for the configuration.
530530
ClusterComponentConfigSource `json:",inline"`
531531

532-
// ExternalManaged indicates whether the configuration is managed by an external system.
533-
// When set to true, the controller will use the user-provided template and reconfigure action,
534-
// ignoring the default template and update behavior.
532+
// ExternalManaged specifies whether the configuration management is delegated to an external system
533+
// or manual user control.
534+
//
535+
// When set to true, the controller will exclusively utilize the user-provided configuration source
536+
// and the 'reconfigure' action defined in this config, bypassing the default templates and
537+
// update behaviors specified in the ComponentDefinition.
535538
//
536539
// +optional
537540
ExternalManaged *bool `json:"externalManaged,omitempty"`
538541

539542
// Represents a checksum or hash of the configuration content.
543+
//
540544
// The controller uses this value to detect changes and determine if a reconfiguration or restart
541545
// is necessary to apply updates.
542546
//
543547
// +optional
544548
ConfigHash *string `json:"configHash,omitempty"`
545549

550+
// Specifies whether to restart the component to reload the updated configuration.
551+
//
552+
// +optional
553+
RestartOnConfigChange *bool `json:"restartOnConfigChange,omitempty"`
554+
546555
// The custom reconfigure action to reload the updated configuration.
547556
//
557+
// When @restartOnConfigChange is set to true, this action will be ignored.
558+
//
548559
// The container executing this action has access to following variables:
549560
//
550561
// - KB_CONFIG_FILES_CREATED: file1,file2...
@@ -553,11 +564,6 @@ type ClusterComponentConfig struct {
553564
//
554565
// +optional
555566
Reconfigure *Action `json:"reconfigure,omitempty"`
556-
557-
// Specifies whether to restart the component to reload the updated configuration.
558-
//
559-
// +optional
560-
RestartOnChange *bool `json:"restartOnChange,omitempty"`
561567
}
562568

563569
// ClusterComponentConfigSource represents the source of a configuration for a component.

apis/apps/v1/zz_generated.deepcopy.go

Lines changed: 10 additions & 10 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_clusters.yaml

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,8 @@ spec:
217217
configHash:
218218
description: |-
219219
Represents a checksum or hash of the configuration content.
220+
221+
220222
The controller uses this value to detect changes and determine if a reconfiguration or restart
221223
is necessary to apply updates.
222224
type: string
@@ -286,9 +288,13 @@ spec:
286288
x-kubernetes-map-type: atomic
287289
externalManaged:
288290
description: |-
289-
ExternalManaged indicates whether the configuration is managed by an external system.
290-
When set to true, the controller will use the user-provided template and reconfigure action,
291-
ignoring the default template and update behavior.
291+
ExternalManaged specifies whether the configuration management is delegated to an external system
292+
or manual user control.
293+
294+
295+
When set to true, the controller will exclusively utilize the user-provided configuration source
296+
and the 'reconfigure' action defined in this config, bypassing the default templates and
297+
update behaviors specified in the ComponentDefinition.
292298
type: boolean
293299
name:
294300
description: The name of the config.
@@ -300,6 +306,9 @@ spec:
300306
The custom reconfigure action to reload the updated configuration.
301307

302308

309+
When @restartOnConfigChange is set to true, this action will be ignored.
310+
311+
303312
The container executing this action has access to following variables:
304313

305314

@@ -742,7 +751,7 @@ spec:
742751
format: int32
743752
type: integer
744753
type: object
745-
restartOnChange:
754+
restartOnConfigChange:
746755
description: Specifies whether to restart the component
747756
to reload the updated configuration.
748757
type: boolean
@@ -11556,6 +11565,8 @@ spec:
1155611565
configHash:
1155711566
description: |-
1155811567
Represents a checksum or hash of the configuration content.
11568+
11569+
1155911570
The controller uses this value to detect changes and determine if a reconfiguration or restart
1156011571
is necessary to apply updates.
1156111572
type: string
@@ -11625,9 +11636,13 @@ spec:
1162511636
x-kubernetes-map-type: atomic
1162611637
externalManaged:
1162711638
description: |-
11628-
ExternalManaged indicates whether the configuration is managed by an external system.
11629-
When set to true, the controller will use the user-provided template and reconfigure action,
11630-
ignoring the default template and update behavior.
11639+
ExternalManaged specifies whether the configuration management is delegated to an external system
11640+
or manual user control.
11641+
11642+
11643+
When set to true, the controller will exclusively utilize the user-provided configuration source
11644+
and the 'reconfigure' action defined in this config, bypassing the default templates and
11645+
update behaviors specified in the ComponentDefinition.
1163111646
type: boolean
1163211647
name:
1163311648
description: The name of the config.
@@ -11639,6 +11654,9 @@ spec:
1163911654
The custom reconfigure action to reload the updated configuration.
1164011655

1164111656

11657+
When @restartOnConfigChange is set to true, this action will be ignored.
11658+
11659+
1164211660
The container executing this action has access to following variables:
1164311661

1164411662

@@ -12085,7 +12103,7 @@ spec:
1208512103
format: int32
1208612104
type: integer
1208712105
type: object
12088-
restartOnChange:
12106+
restartOnConfigChange:
1208912107
description: Specifies whether to restart the component
1209012108
to reload the updated configuration.
1209112109
type: boolean

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

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4257,8 +4257,10 @@ spec:
42574257
type: integer
42584258
externalManaged:
42594259
description: |-
4260-
ExternalManaged indicates whether the configuration is managed by an external system.
4261-
When set to true, the controller will ignore the management of this configuration.
4260+
ExternalManaged specifies whether the file management is delegated to an external system or manual user control.
4261+
4262+
4263+
When set to true, the controller will ignore the management of this file.
42624264
type: boolean
42634265
name:
42644266
description: Specifies the name of the template.
@@ -4274,12 +4276,24 @@ spec:
42744276
type: string
42754277
reconfigure:
42764278
description: |-
4277-
Defines the procedure that reloads the configuration when the file changes.
4279+
Defines the procedure that reloads the file when it's content changes.
4280+
4281+
4282+
If specified, this action overrides the global reconfigure action defined in lifecycle actions
4283+
for this specific file template.
42784284

42794285

42804286
When @restartOnFileChange is set to true, this action will be ignored.
42814287

42824288

4289+
The container executing this action has access to following variables:
4290+
4291+
4292+
- KB_CONFIG_FILES_CREATED: file1,file2...
4293+
- KB_CONFIG_FILES_REMOVED: file1,file2...
4294+
- KB_CONFIG_FILES_UPDATED: file1:checksum1,file2:checksum2...
4295+
4296+
42834297
Note: This field is immutable once it has been set.
42844298
properties:
42854299
exec:
@@ -4714,8 +4728,8 @@ spec:
47144728
type: integer
47154729
type: object
47164730
restartOnFileChange:
4717-
description: Specifies whether to restart the pods when the
4718-
configuration changes.
4731+
description: Specifies whether to restart the workload when
4732+
the file changes.
47194733
type: boolean
47204734
template:
47214735
description: Specifies the name of the referenced template ConfigMap
@@ -18508,8 +18522,10 @@ spec:
1850818522
type: integer
1850918523
externalManaged:
1851018524
description: |-
18511-
ExternalManaged indicates whether the configuration is managed by an external system.
18512-
When set to true, the controller will ignore the management of this configuration.
18525+
ExternalManaged specifies whether the file management is delegated to an external system or manual user control.
18526+
18527+
18528+
When set to true, the controller will ignore the management of this file.
1851318529
type: boolean
1851418530
name:
1851518531
description: Specifies the name of the template.
@@ -18525,12 +18541,24 @@ spec:
1852518541
type: string
1852618542
reconfigure:
1852718543
description: |-
18528-
Defines the procedure that reloads the configuration when the file changes.
18544+
Defines the procedure that reloads the file when it's content changes.
18545+
18546+
18547+
If specified, this action overrides the global reconfigure action defined in lifecycle actions
18548+
for this specific file template.
1852918549

1853018550

1853118551
When @restartOnFileChange is set to true, this action will be ignored.
1853218552

1853318553

18554+
The container executing this action has access to following variables:
18555+
18556+
18557+
- KB_CONFIG_FILES_CREATED: file1,file2...
18558+
- KB_CONFIG_FILES_REMOVED: file1,file2...
18559+
- KB_CONFIG_FILES_UPDATED: file1:checksum1,file2:checksum2...
18560+
18561+
1853418562
Note: This field is immutable once it has been set.
1853518563
properties:
1853618564
exec:
@@ -18965,8 +18993,8 @@ spec:
1896518993
type: integer
1896618994
type: object
1896718995
restartOnFileChange:
18968-
description: Specifies whether to restart the pods when the
18969-
configuration changes.
18996+
description: Specifies whether to restart the workload when
18997+
the file changes.
1897018998
type: boolean
1897118999
template:
1897219000
description: Specifies the name of the referenced template ConfigMap

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

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ spec:
9393
configHash:
9494
description: |-
9595
Represents a checksum or hash of the configuration content.
96+
97+
9698
The controller uses this value to detect changes and determine if a reconfiguration or restart
9799
is necessary to apply updates.
98100
type: string
@@ -161,9 +163,13 @@ spec:
161163
x-kubernetes-map-type: atomic
162164
externalManaged:
163165
description: |-
164-
ExternalManaged indicates whether the configuration is managed by an external system.
165-
When set to true, the controller will use the user-provided template and reconfigure action,
166-
ignoring the default template and update behavior.
166+
ExternalManaged specifies whether the configuration management is delegated to an external system
167+
or manual user control.
168+
169+
170+
When set to true, the controller will exclusively utilize the user-provided configuration source
171+
and the 'reconfigure' action defined in this config, bypassing the default templates and
172+
update behaviors specified in the ComponentDefinition.
167173
type: boolean
168174
name:
169175
description: The name of the config.
@@ -175,6 +181,9 @@ spec:
175181
The custom reconfigure action to reload the updated configuration.
176182

177183

184+
When @restartOnConfigChange is set to true, this action will be ignored.
185+
186+
178187
The container executing this action has access to following variables:
179188

180189

@@ -613,7 +622,7 @@ spec:
613622
format: int32
614623
type: integer
615624
type: object
616-
restartOnChange:
625+
restartOnConfigChange:
617626
description: Specifies whether to restart the component to reload
618627
the updated configuration.
619628
type: boolean

0 commit comments

Comments
 (0)