Skip to content

Commit 1f7f1ab

Browse files
authored
chore: refactor parameters-related api
commit f577f6d Author: zhangtao <[email protected]> Date: Thu Feb 27 19:11:15 2025 +0800 chore: refactor parameters partV: decouple apps dependence on parameters and tidy up (#8620) (cherry picked from commit 6340d2f) commit ae1fc8a Author: zhangtao <[email protected]> Date: Thu Feb 27 16:36:04 2025 +0800 chore: refactor parameters partⅣ: parameters-related controller impl (#8619) (cherry picked from commit fbe153b) commit deadb91 Author: zhangtao <[email protected]> Date: Wed Dec 11 14:42:51 2024 +0800 chore: refactor parameters partIII: removed deprecated api and tools to do rerender on pods (#8590) (cherry picked from commit 37f916e) commit cfc6379 Author: zhangtao <[email protected]> Date: Fri Feb 14 17:04:46 2025 +0800 chore: refactor parameters partI: add parameters group and api (#8582) (cherry picked from commit fd29cfe) commit 44abc0b Author: zhangtao <[email protected]> Date: Wed Dec 11 10:51:12 2024 +0800 chore: refactor parameters partII: refactor template render (#8588) (cherry picked from commit 248487d)
1 parent 17a3a4d commit 1f7f1ab

File tree

280 files changed

+16686
-10854
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

280 files changed

+16686
-10854
lines changed

PROJECT

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,4 +325,38 @@ resources:
325325
kind: SidecarDefinition
326326
path: github.com/apecloud/kubeblocks/apis/apps/v1
327327
version: v1
328+
- api:
329+
crdVersion: v1
330+
controller: true
331+
domain: kubeblocks.io
332+
group: parameters
333+
kind: ParametersDefinition
334+
path: github.com/apecloud/kubeblocks/apis/parameters/v1alpha1
335+
version: v1alpha1
336+
- api:
337+
crdVersion: v1
338+
namespaced: true
339+
controller: true
340+
domain: kubeblocks.io
341+
group: parameters
342+
kind: ComponentParameter
343+
path: github.com/apecloud/kubeblocks/apis/parameters/v1alpha1
344+
version: v1alpha1
345+
- api:
346+
crdVersion: v1
347+
namespaced: true
348+
controller: true
349+
domain: kubeblocks.io
350+
group: parameters
351+
kind: Parameter
352+
path: github.com/apecloud/kubeblocks/apis/parameters/v1alpha1
353+
version: v1alpha1
354+
- api:
355+
crdVersion: v1
356+
controller: true
357+
domain: kubeblocks.io
358+
group: parameters
359+
kind: ParamConfigRenderer
360+
path: github.com/apecloud/kubeblocks/apis/parameters/v1alpha1
361+
version: v1alpha1
328362
version: "3"

apis/apps/v1/componentdefinition_types.go

Lines changed: 1 addition & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ type ComponentDefinitionSpec struct {
336336
// +listType=map
337337
// +listMapKey=name
338338
// +optional
339-
Configs []ComponentConfigSpec `json:"configs,omitempty"`
339+
Configs []ComponentTemplateSpec `json:"configs,omitempty"`
340340

341341
// Defines the types of logs generated by instances of the Component and their corresponding file paths.
342342
// These logs can be collected for further analysis and monitoring.
@@ -1135,137 +1135,6 @@ type ComponentTemplateSpec struct {
11351135
DefaultMode *int32 `json:"defaultMode,omitempty" protobuf:"varint,3,opt,name=defaultMode"`
11361136
}
11371137

1138-
type ComponentConfigSpec struct {
1139-
ComponentTemplateSpec `json:",inline"`
1140-
1141-
// Specifies the configuration files within the ConfigMap that support dynamic updates.
1142-
//
1143-
// A configuration template (provided in the form of a ConfigMap) may contain templates for multiple
1144-
// configuration files.
1145-
// Each configuration file corresponds to a key in the ConfigMap.
1146-
// Some of these configuration files may support dynamic modification and reloading without requiring
1147-
// a pod restart.
1148-
//
1149-
// If empty or omitted, all configuration files in the ConfigMap are assumed to support dynamic updates,
1150-
// and ConfigConstraint applies to all keys.
1151-
//
1152-
// +listType=set
1153-
// +optional
1154-
Keys []string `json:"keys,omitempty"`
1155-
1156-
// Specifies the secondary rendered config spec for pod-specific customization.
1157-
//
1158-
// The template is rendered inside the pod (by the "config-manager" sidecar container) and merged with the main
1159-
// template's render result to generate the final configuration file.
1160-
//
1161-
// This field is intended to handle scenarios where different pods within the same Component have
1162-
// varying configurations. It allows for pod-specific customization of the configuration.
1163-
//
1164-
// Note: This field will be deprecated in future versions, and the functionality will be moved to
1165-
// `cluster.spec.componentSpecs[*].instances[*]`.
1166-
//
1167-
// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 0.9.0 and will be removed in 0.10.0"
1168-
// +optional
1169-
LegacyRenderedConfigSpec *LegacyRenderedTemplateSpec `json:"legacyRenderedConfigSpec,omitempty"`
1170-
1171-
// Specifies the name of the referenced configuration constraints object.
1172-
//
1173-
// +kubebuilder:validation:MaxLength=63
1174-
// +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$`
1175-
// +optional
1176-
ConfigConstraintRef string `json:"constraintRef,omitempty"`
1177-
1178-
// Specifies the containers to inject the ConfigMap parameters as environment variables.
1179-
//
1180-
// This is useful when application images accept parameters through environment variables and
1181-
// generate the final configuration file in the startup script based on these variables.
1182-
//
1183-
// This field allows users to specify a list of container names, and KubeBlocks will inject the environment
1184-
// variables converted from the ConfigMap into these designated containers. This provides a flexible way to
1185-
// pass the configuration items from the ConfigMap to the container without modifying the image.
1186-
//
1187-
// Deprecated: `asEnvFrom` has been deprecated since 0.9.0 and will be removed in 0.10.0.
1188-
// Use `injectEnvTo` instead.
1189-
//
1190-
// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 0.9.0 and will be removed in 0.10.0"
1191-
// +listType=set
1192-
// +optional
1193-
AsEnvFrom []string `json:"asEnvFrom,omitempty"`
1194-
1195-
// Specifies the containers to inject the ConfigMap parameters as environment variables.
1196-
//
1197-
// This is useful when application images accept parameters through environment variables and
1198-
// generate the final configuration file in the startup script based on these variables.
1199-
//
1200-
// This field allows users to specify a list of container names, and KubeBlocks will inject the environment
1201-
// variables converted from the ConfigMap into these designated containers. This provides a flexible way to
1202-
// pass the configuration items from the ConfigMap to the container without modifying the image.
1203-
//
1204-
//
1205-
// +listType=set
1206-
// +optional
1207-
InjectEnvTo []string `json:"injectEnvTo,omitempty"`
1208-
1209-
// Specifies whether the configuration needs to be re-rendered after v-scale or h-scale operations to reflect changes.
1210-
//
1211-
// In some scenarios, the configuration may need to be updated to reflect the changes in resource allocation
1212-
// or cluster topology. Examples:
1213-
//
1214-
// - Redis: adjust maxmemory after v-scale operation.
1215-
// - MySQL: increase max connections after v-scale operation.
1216-
// - Zookeeper: update zoo.cfg with new node addresses after h-scale operation.
1217-
//
1218-
// +listType=set
1219-
// +optional
1220-
ReRenderResourceTypes []RerenderResourceType `json:"reRenderResourceTypes,omitempty"`
1221-
1222-
// Whether to store the final rendered parameters as a secret.
1223-
//
1224-
// +optional
1225-
AsSecret *bool `json:"asSecret,omitempty"`
1226-
}
1227-
1228-
// LegacyRenderedTemplateSpec describes the configuration extension for the lazy rendered template.
1229-
// Deprecated: LegacyRenderedTemplateSpec has been deprecated since 0.9.0 and will be removed in 0.10.0
1230-
type LegacyRenderedTemplateSpec struct {
1231-
// Extends the configuration template.
1232-
ConfigTemplateExtension `json:",inline"`
1233-
}
1234-
1235-
type ConfigTemplateExtension struct {
1236-
// Specifies the name of the referenced configuration template ConfigMap object.
1237-
//
1238-
// +kubebuilder:validation:Required
1239-
// +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$`
1240-
TemplateRef string `json:"templateRef"`
1241-
1242-
// Specifies the namespace of the referenced configuration template ConfigMap object.
1243-
// An empty namespace is equivalent to the "default" namespace.
1244-
//
1245-
// +kubebuilder:default="default"
1246-
// +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\-]*[a-z0-9])?$`
1247-
// +optional
1248-
Namespace string `json:"namespace,omitempty"`
1249-
1250-
// Defines the strategy for merging externally imported templates into component templates.
1251-
//
1252-
// +kubebuilder:default="none"
1253-
// +optional
1254-
Policy MergedPolicy `json:"policy,omitempty"`
1255-
}
1256-
1257-
// MergedPolicy defines how to merge external imported templates into component templates.
1258-
// +enum
1259-
// +kubebuilder:validation:Enum={patch,replace,none}
1260-
type MergedPolicy string
1261-
1262-
const (
1263-
PatchPolicy MergedPolicy = "patch"
1264-
ReplacePolicy MergedPolicy = "replace"
1265-
OnlyAddPolicy MergedPolicy = "add"
1266-
NoneMergePolicy MergedPolicy = "none"
1267-
)
1268-
12691138
// RerenderResourceType defines the resource requirements for a component.
12701139
// +enum
12711140
// +kubebuilder:validation:Enum={vscale,hscale,tls}

apis/apps/v1/zz_generated.deepcopy.go

Lines changed: 1 addition & 78 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)