Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions apis/parameters/v1alpha1/componentparameter_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ func init() {
SchemeBuilder.Register(&ComponentParameter{}, &ComponentParameterList{})
}

// Deprecated: It is retained for API compatibility with existing ComponentParameter objects.
//
// Payload holds the payload data. This field is optional and can contain any type of data.
// Not included in the JSON representation of the object.
type Payload map[string]json.RawMessage
Expand All @@ -73,11 +75,9 @@ type ConfigTemplateItemDetail struct {
// +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$`
Name string `json:"name"`

// External controllers can trigger a configuration rerender by modifying this field.
//
// Note: Currently, the `payload` field is opaque and its content is not interpreted by the system.
// Modifying this field will cause a rerender, regardless of the specific content of this field.
// Deprecated: retained for API compatibility only.
//
// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 1.2.0"
// +kubebuilder:validation:Schemaless
// +kubebuilder:pruning:PreserveUnknownFields
// +kubebuilder:validation:Type=object
Expand Down
6 changes: 5 additions & 1 deletion apis/parameters/v1alpha1/paramconfigrenderer_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ import (
// +kubebuilder:printcolumn:name="PHASE",type="string",JSONPath=".status.phase",description="status phase"
// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp"

// ParamConfigRenderer is the Schema for the paramconfigrenderers API
// Deprecated: retained for API compatibility only.
//
// # ParamConfigRenderer is the Schema for the paramconfigrenderers API
//
// +kubebuilder:deprecatedversion:warning="This CRD has been deprecated since 1.2.0"
type ParamConfigRenderer struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand Down
28 changes: 28 additions & 0 deletions apis/parameters/v1alpha1/parametersdefinition_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,35 @@ func init() {

// ParametersDefinitionSpec defines the desired state of ParametersDefinition
type ParametersDefinitionSpec struct {
// Specifies the ComponentDefinition custom resource (CR) that defines the Component's characteristics and behavior.
// The value can represent an exact name, a name prefix, or a regular expression pattern.
//
// +optional
ComponentDef string `json:"componentDef,omitempty"`

// ServiceVersion specifies the version of the Service expected to be provisioned by this Component.
// The version should follow the syntax and semantics of the "Semantic Versioning" specification (http://semver.org/).
// If no version is specified, the latest available version will be used.
//
// +optional
ServiceVersion string `json:"serviceVersion,omitempty"`

// Specifies the name of the referenced config template.
//
// +optional
TemplateName string `json:"templateName,omitempty"`

// Specifies the config file name in the config template.
//
// +optional
FileName string `json:"fileName,omitempty"`

// Specifies the format of the configuration file and any associated parameters that are specific to the chosen format.
// Supported formats include `ini`, `xml`, `yaml`, `json`, `hcl`, `dotenv`, `properties`, and `toml`.
//
// +optional
FileFormatConfig *FileFormatConfig `json:"fileFormatConfig,omitempty"`

// Defines a list of parameters including their names, default values, descriptions,
// types, and constraints (permissible values or the range of valid values).
//
Expand All @@ -86,6 +110,7 @@ type ParametersDefinitionSpec struct {

// Specifies the policy when parameter be removed.
//
// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 1.2.0"
// +optional
ParameterDeletedPolicy *ParameterDeletedPolicy `json:"deletedPolicy,omitempty"`

Expand Down Expand Up @@ -137,6 +162,7 @@ type ParametersDefinitionSpec struct {
ImmutableParameters []string `json:"immutableParameters,omitempty"`
}

// Deprecated: It is retained for API compatibility with existing ParametersDefinition objects.
type ParameterDeletedPolicy struct {

// Specifies the method to handle the deletion of a parameter.
Expand Down Expand Up @@ -180,6 +206,8 @@ type ParametersDefinitionStatus struct {

// ReloadAction defines the mechanisms available for dynamically reloading a process within K8s without requiring a restart.
//
// Deprecated: It is retained for API compatibility with existing ParametersDefinition objects.
//
// Only one of the mechanisms can be specified at a time.
type ReloadAction struct {
// Allows to execute a custom shell script to reload the process.
Expand Down
4 changes: 4 additions & 0 deletions apis/parameters/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ const (
PDDeletingPhase ParametersDescPhase = "Deleting"
)

// Deprecated: It is retained for API compatibility with existing ParametersDefinition objects.
//
// ParameterDeletedMethod defines how to handle parameter remove
// +enum
// +kubebuilder:validation:Enum={RestoreToDefault, Reset}
Expand All @@ -56,6 +58,8 @@ const (
PDPReset ParameterDeletedMethod = "Reset"
)

// Deprecated: It is retained for API compatibility with existing ParamConfigRenderer objects.
//
// RerenderResourceType defines the resource requirements for a component.
// +enum
// +kubebuilder:validation:Enum={vscale,hscale,tls,shardingHScale}
Expand Down
5 changes: 5 additions & 0 deletions apis/parameters/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,14 @@ func main() {
setupLog.Error(err, "unable to create controller", "controller", "ComponentParameter")
os.Exit(1)
}
if err = (&parameterscontrollers.LegacyParamConfigRendererReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
Recorder: mgr.GetEventRecorderFor("legacy-param-config-renderer-controller"),
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "LegacyParamConfigRenderer")
os.Exit(1)
}
if err = (&parameterscontrollers.ComponentParameterReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
Expand All @@ -676,14 +684,6 @@ func main() {
setupLog.Error(err, "unable to create controller", "controller", "ReconfigureRequest")
os.Exit(1)
}
if err = (&parameterscontrollers.ParameterDrivenConfigRenderReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
Recorder: mgr.GetEventRecorderFor("component-driven-config-render-controller"),
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "ParamConfigRenderer")
os.Exit(1)
}
if err = (&parameterscontrollers.ParameterTemplateExtensionReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -652,12 +652,7 @@ spec:
pattern: ^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$
type: string
payload:
description: |-
External controllers can trigger a configuration rerender by modifying this field.


Note: Currently, the `payload` field is opaque and its content is not interpreted by the system.
Modifying this field will cause a rerender, regardless of the specific content of this field.
description: 'Deprecated: retained for API compatibility only.'
type: object
x-kubernetes-preserve-unknown-fields: true
userConfigTemplates:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,16 @@ spec:
- jsonPath: .metadata.creationTimestamp
name: AGE
type: date
deprecated: true
deprecationWarning: This CRD has been deprecated since 1.2.0
name: v1alpha1
schema:
openAPIV3Schema:
description: ParamConfigRenderer is the Schema for the paramconfigrenderers
API
description: |-
Deprecated: retained for API compatibility only.


# ParamConfigRenderer is the Schema for the paramconfigrenderers API
properties:
apiVersion:
description: |-
Expand Down Expand Up @@ -147,8 +152,11 @@ spec:
- MySQL: increase max connections after v-scale operation.
- Zookeeper: update zoo.cfg with new node addresses after h-scale operation.
items:
description: RerenderResourceType defines the resource requirements
for a component.
description: |-
Deprecated: It is retained for API compatibility with existing ParamConfigRenderer objects.


RerenderResourceType defines the resource requirements for a component.
enum:
- vscale
- hscale
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ spec:
spec:
description: ParametersDefinitionSpec defines the desired state of ParametersDefinition
properties:
componentDef:
description: |-
Specifies the ComponentDefinition custom resource (CR) that defines the Component's characteristics and behavior.
The value can represent an exact name, a name prefix, or a regular expression pattern.
type: string
deletedPolicy:
description: Specifies the policy when parameter be removed.
properties:
Expand Down Expand Up @@ -88,6 +93,49 @@ spec:
type: string
type: array
x-kubernetes-list-type: set
fileFormatConfig:
description: |-
Specifies the format of the configuration file and any associated parameters that are specific to the chosen format.
Supported formats include `ini`, `xml`, `yaml`, `json`, `hcl`, `dotenv`, `properties`, and `toml`.
properties:
format:
description: |-
The config file format. Valid values are `ini`, `xml`, `yaml`, `json`,
`hcl`, `dotenv`, `properties` and `toml`. Each format has its own characteristics and use cases.


- ini: is a text-based content with a structure and syntax comprising key–value pairs for properties, reference wiki: https://en.wikipedia.org/wiki/INI_file
- xml: refers to wiki: https://en.wikipedia.org/wiki/XML
- yaml: supports for complex data types and structures.
- json: refers to wiki: https://en.wikipedia.org/wiki/JSON
- hcl: The HashiCorp Configuration Language (HCL) is a configuration language authored by HashiCorp, reference url: https://www.linode.com/docs/guides/introduction-to-hcl/
- dotenv: is a plain text file with simple key–value pairs, reference wiki: https://en.wikipedia.org/wiki/Configuration_file#MS-DOS
- properties: a file extension mainly used in Java, reference wiki: https://en.wikipedia.org/wiki/.properties
- toml: refers to wiki: https://en.wikipedia.org/wiki/TOML
- props-plus: a file extension mainly used in Java, supports CamelCase(e.g: brokerMaxConnectionsPerIp)
enum:
- xml
- ini
- yaml
- json
- hcl
- dotenv
- toml
- properties
- redis
- props-plus
- props-ultra
type: string
iniConfig:
description: Holds options specific to the 'ini' file format.
properties:
sectionName:
description: A string that describes the name of the ini section.
type: string
type: object
required:
- format
type: object
fileName:
description: Specifies the config file name in the config template.
type: string
Expand Down Expand Up @@ -363,6 +411,12 @@ spec:
The "all" option is for certain engines that require static parameters to be set
via SQL statements before they can take effect on restart.
type: boolean
serviceVersion:
description: |-
ServiceVersion specifies the version of the Service expected to be provisioned by this Component.
The version should follow the syntax and semantics of the "Semantic Versioning" specification (http://semver.org/).
If no version is specified, the latest available version will be used.
type: string
staticParameters:
description: |-
List static parameters.
Expand All @@ -371,6 +425,9 @@ spec:
type: string
type: array
x-kubernetes-list-type: set
templateName:
description: Specifies the name of the referenced config template.
type: string
type: object
status:
description: ParametersDefinitionStatus defines the observed state of
Expand Down
10 changes: 0 additions & 10 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -855,8 +855,6 @@ rules:
resources:
- paramconfigrenderers
verbs:
- create
- delete
- get
- list
- patch
Expand All @@ -868,14 +866,6 @@ rules:
- paramconfigrenderers/finalizers
verbs:
- update
- apiGroups:
- parameters.kubeblocks.io
resources:
- paramconfigrenderers/status
verbs:
- get
- patch
- update
- apiGroups:
- parameters.kubeblocks.io
resources:
Expand Down
14 changes: 3 additions & 11 deletions controllers/parameters/componentdrivenparameter_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ func buildComponentParameter(reqCtx intctrlutil.RequestCtx, reader client.Reader
return nil, nil
}

configRender, paramsDefs, err := parameters.ResolveCmpdParametersDefs(reqCtx.Ctx, reader, cmpd)
configDescs, paramsDefs, err := parameters.ResolveCmpdParametersDefs(reqCtx.Ctx, reader, cmpd)
if err != nil {
return nil, err
}
Expand All @@ -278,7 +278,7 @@ func buildComponentParameter(reqCtx intctrlutil.RequestCtx, reader client.Reader
if err != nil {
return nil, err
}
parameterSpecs, err := parameters.ClassifyParamsFromConfigTemplate(initParameters, cmpd, paramsDefs, tpls, configRender)
parameterSpecs, err := parameters.ClassifyParamsFromConfigTemplate(initParameters, cmpd, paramsDefs, tpls, configDescs)
if err != nil {
return nil, err
}
Expand All @@ -301,14 +301,7 @@ func buildComponentParameter(reqCtx intctrlutil.RequestCtx, reader client.Reader
if err = intctrlutil.SetOwnerReference(comp, parameterObj); err != nil {
return nil, err
}
sharding, err := parameters.ResolveShardingReference(reqCtx.Ctx, reader, comp)
if err != nil {
return nil, err
}
if configRender != nil {
err = parameters.UpdateConfigPayload(&parameterObj.Spec, &comp.Spec, &configRender.Spec, sharding)
}
return parameterObj, err
return parameterObj, nil
}

// resolveLegacyConfigManagerRequirement reports whether this component still depends on the
Expand Down Expand Up @@ -471,7 +464,6 @@ func (r *ComponentDrivenParameterReconciler) mergeComponentParameter(expected *p
if expected.CustomTemplates != nil {
dest.CustomTemplates = expected.CustomTemplates
}
dest.Payload = expected.Payload
dest.ConfigSpec = expected.ConfigSpec
})
}
Loading
Loading