-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: refactor 1.0 parameter api #8441
base: main
Are you sure you want to change the base?
Changes from all commits
5ce7472
a8aa895
a3c4d28
fec6c0f
7e7bb15
8f7a823
34842d1
7edae77
c631e29
358f6b6
89d67ce
27bc828
8f9a7fc
eb5e660
5948a1b
fa5aea2
ae834f5
6e7bde5
b263edc
c0a7a1e
a8a6d0a
6acd520
f7e077f
a083b9a
adc3469
bead517
58575cc
b5a7709
d5e6feb
3b6fa81
74a2956
022df45
0a32383
fa5e3d6
a29766a
29e535b
60b1cbd
5a12c2f
353a5fd
9e0446b
6064ff8
5c441af
34118fe
a5d2001
2db9e9f
952191f
97addde
d9d5027
2f8e80a
eaa4ea0
949fa18
58a161a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -289,6 +289,11 @@ type ComponentSpec struct { | |
// | ||
// +optional | ||
Sidecars []Sidecar `json:"sidecars,omitempty"` | ||
|
||
// Specifies the initialization parameters. | ||
// | ||
// +optional | ||
InitParameters ComponentParameters `json:"initParameters,omitempty"` | ||
} | ||
|
||
// ComponentStatus represents the observed state of a Component within the Cluster. | ||
|
@@ -378,3 +383,5 @@ const ( | |
// FailedComponentPhase indicates that there are some pods of the component not in a 'Running' state. | ||
FailedComponentPhase ComponentPhase = "Failed" | ||
) | ||
|
||
type ComponentParameters map[string]*string | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. // Better with {name:, value:}, perhaps a parameter will come from a secret or config map? |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -318,7 +318,7 @@ type ComponentDefinitionSpec struct { | |
// +listType=map | ||
// +listMapKey=name | ||
// +optional | ||
Configs []ComponentConfigSpec `json:"configs,omitempty"` | ||
Configs []ComponentTemplateSpec `json:"configs,omitempty"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The ComponentConfigSpec could be deleted from this package? |
||
|
||
// Defines the types of logs generated by instances of the Component and their corresponding file paths. | ||
// These logs can be collected for further analysis and monitoring. | ||
|
@@ -1031,103 +1031,6 @@ type ComponentTemplateSpec struct { | |
DefaultMode *int32 `json:"defaultMode,omitempty" protobuf:"varint,3,opt,name=defaultMode"` | ||
} | ||
|
||
type ComponentConfigSpec struct { | ||
ComponentTemplateSpec `json:",inline"` | ||
|
||
// Specifies the configuration files within the ConfigMap that support dynamic updates. | ||
// | ||
// A configuration template (provided in the form of a ConfigMap) may contain templates for multiple | ||
// configuration files. | ||
// Each configuration file corresponds to a key in the ConfigMap. | ||
// Some of these configuration files may support dynamic modification and reloading without requiring | ||
// a pod restart. | ||
// | ||
// If empty or omitted, all configuration files in the ConfigMap are assumed to support dynamic updates, | ||
// and ConfigConstraint applies to all keys. | ||
// | ||
// +listType=set | ||
// +optional | ||
Keys []string `json:"keys,omitempty"` | ||
|
||
// Specifies the secondary rendered config spec for pod-specific customization. | ||
// | ||
// The template is rendered inside the pod (by the "config-manager" sidecar container) and merged with the main | ||
// template's render result to generate the final configuration file. | ||
// | ||
// This field is intended to handle scenarios where different pods within the same Component have | ||
// varying configurations. It allows for pod-specific customization of the configuration. | ||
// | ||
// Note: This field will be deprecated in future versions, and the functionality will be moved to | ||
// `cluster.spec.componentSpecs[*].instances[*]`. | ||
// | ||
// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 0.9.0 and will be removed in 0.10.0" | ||
// +optional | ||
LegacyRenderedConfigSpec *LegacyRenderedTemplateSpec `json:"legacyRenderedConfigSpec,omitempty"` | ||
|
||
// Specifies the name of the referenced configuration constraints object. | ||
// | ||
// +kubebuilder:validation:MaxLength=63 | ||
// +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$` | ||
// +optional | ||
ConfigConstraintRef string `json:"constraintRef,omitempty"` | ||
|
||
// Specifies the containers to inject the ConfigMap parameters as environment variables. | ||
// | ||
// This is useful when application images accept parameters through environment variables and | ||
// generate the final configuration file in the startup script based on these variables. | ||
// | ||
// This field allows users to specify a list of container names, and KubeBlocks will inject the environment | ||
// variables converted from the ConfigMap into these designated containers. This provides a flexible way to | ||
// pass the configuration items from the ConfigMap to the container without modifying the image. | ||
// | ||
// Deprecated: `asEnvFrom` has been deprecated since 0.9.0 and will be removed in 0.10.0. | ||
// Use `injectEnvTo` instead. | ||
// | ||
// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 0.9.0 and will be removed in 0.10.0" | ||
// +listType=set | ||
// +optional | ||
AsEnvFrom []string `json:"asEnvFrom,omitempty"` | ||
|
||
// Specifies the containers to inject the ConfigMap parameters as environment variables. | ||
// | ||
// This is useful when application images accept parameters through environment variables and | ||
// generate the final configuration file in the startup script based on these variables. | ||
// | ||
// This field allows users to specify a list of container names, and KubeBlocks will inject the environment | ||
// variables converted from the ConfigMap into these designated containers. This provides a flexible way to | ||
// pass the configuration items from the ConfigMap to the container without modifying the image. | ||
// | ||
// | ||
// +listType=set | ||
// +optional | ||
InjectEnvTo []string `json:"injectEnvTo,omitempty"` | ||
|
||
// Specifies whether the configuration needs to be re-rendered after v-scale or h-scale operations to reflect changes. | ||
// | ||
// In some scenarios, the configuration may need to be updated to reflect the changes in resource allocation | ||
// or cluster topology. Examples: | ||
// | ||
// - Redis: adjust maxmemory after v-scale operation. | ||
// - MySQL: increase max connections after v-scale operation. | ||
// - Zookeeper: update zoo.cfg with new node addresses after h-scale operation. | ||
// | ||
// +listType=set | ||
// +optional | ||
ReRenderResourceTypes []RerenderResourceType `json:"reRenderResourceTypes,omitempty"` | ||
|
||
// Whether to store the final rendered parameters as a secret. | ||
// | ||
// +optional | ||
AsSecret *bool `json:"asSecret,omitempty"` | ||
} | ||
|
||
// LegacyRenderedTemplateSpec describes the configuration extension for the lazy rendered template. | ||
// Deprecated: LegacyRenderedTemplateSpec has been deprecated since 0.9.0 and will be removed in 0.10.0 | ||
type LegacyRenderedTemplateSpec struct { | ||
// Extends the configuration template. | ||
ConfigTemplateExtension `json:",inline"` | ||
} | ||
|
||
type ConfigTemplateExtension struct { | ||
// Specifies the name of the referenced configuration template ConfigMap object. | ||
// | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be added into spec.components.configs, and be used as init values to render config templates.