Skip to content

Commit edbff89

Browse files
authored
chore(parameters): remove deprecated fields from ParametersDefinition API (#10097)
1 parent 9973e02 commit edbff89

12 files changed

Lines changed: 37 additions & 1350 deletions

File tree

apis/parameters/v1alpha1/parametersdefinition_types.go

Lines changed: 3 additions & 148 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ limitations under the License.
1717
package v1alpha1
1818

1919
import (
20-
corev1 "k8s.io/api/core/v1"
2120
apiext "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
2221
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2322
)
@@ -81,35 +80,10 @@ type ParametersDefinitionSpec struct {
8180
// If `reloadAction` is not set or the modified parameters are not listed in `dynamicParameters`,
8281
// dynamic reloading will not be triggered.
8382
//
84-
// Example:
85-
// ```yaml
86-
// dynamicReloadAction:
87-
// tplScriptTrigger:
88-
// namespace: kb-system
89-
// scriptConfigMapRef: mysql-reload-script
90-
// sync: true
91-
// ```
92-
//
83+
// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 1.2.0"
9384
// +optional
9485
ReloadAction *ReloadAction `json:"reloadAction,omitempty"`
9586

96-
// TODO: migrate DownwardAPITriggeredActions to ComponentDefinition.spec.lifecycleActions
97-
// Specifies a list of actions to execute specified commands based on Pod labels.
98-
//
99-
// It utilizes the K8s Downward API to mount label information as a volume into the pod.
100-
// The 'config-manager' sidecar container watches for changes in the role label and dynamically invoke
101-
// registered commands (usually execute some SQL statements) when a change is detected.
102-
//
103-
// It is designed for scenarios where:
104-
//
105-
// - Replicas with different roles have different configurations, such as Redis primary & secondary replicas.
106-
// - After a role switch (e.g., from secondary to primary), some changes in configuration are needed
107-
// to reflect the new role.
108-
//
109-
// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 1.1.0"
110-
// +optional
111-
DownwardAPIChangeTriggeredActions []DownwardAPIChangeTriggeredAction `json:"downwardAPIChangeTriggeredActions,omitempty"`
112-
11387
// Specifies the policy when parameter be removed.
11488
//
11589
// +optional
@@ -123,6 +97,7 @@ type ParametersDefinitionSpec struct {
12397
// This flag allows for more efficient handling of configuration changes by potentially eliminating
12498
// an unnecessary reload step.
12599
//
100+
// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 1.2.0"
126101
// +optional
127102
MergeReloadAndRestart *bool `json:"mergeReloadAndRestart,omitempty"`
128103

@@ -136,6 +111,7 @@ type ParametersDefinitionSpec struct {
136111
// The "all" option is for certain engines that require static parameters to be set
137112
// via SQL statements before they can take effect on restart.
138113
//
114+
// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 1.2.0"
139115
// +optional
140116
ReloadStaticParamsBeforeRestart *bool `json:"reloadStaticParamsBeforeRestart,omitempty"`
141117

@@ -206,23 +182,11 @@ type ParametersDefinitionStatus struct {
206182
//
207183
// Only one of the mechanisms can be specified at a time.
208184
type ReloadAction struct {
209-
// Used to trigger a reload by sending a specific Unix signal to the process.
210-
//
211-
// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 1.1.0"
212-
// +optional
213-
UnixSignalTrigger *UnixSignalTrigger `json:"unixSignalTrigger,omitempty"`
214-
215185
// Allows to execute a custom shell script to reload the process.
216186
//
217187
// +optional
218188
ShellTrigger *ShellTrigger `json:"shellTrigger,omitempty"`
219189

220-
// Enables reloading process using a Go template script.
221-
//
222-
// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 1.1.0"
223-
// +optional
224-
TPLScriptTrigger *TPLScriptTrigger `json:"tplScriptTrigger"`
225-
226190
// Automatically perform the reload when specified conditions are met.
227191
//
228192
// +optional
@@ -240,19 +204,6 @@ type ReloadAction struct {
240204
TargetPodSelector *metav1.LabelSelector `json:"targetPodSelector,omitempty"`
241205
}
242206

243-
// UnixSignalTrigger is used to trigger a reload by sending a specific Unix signal to the process.
244-
type UnixSignalTrigger struct {
245-
// Specifies a valid Unix signal to be sent.
246-
//
247-
// +kubebuilder:validation:Required
248-
Signal SignalType `json:"signal"`
249-
250-
// Identifies the name of the process to which the Unix signal will be sent.
251-
//
252-
// +kubebuilder:validation:Required
253-
ProcessName string `json:"processName"`
254-
}
255-
256207
// ToolsSetup prepares the tools for dynamic reloads used in ShellTrigger from a specified container image.
257208
//
258209
// Example:
@@ -375,41 +326,6 @@ type ImageMapping struct {
375326
Image string `json:"image"`
376327
}
377328

378-
// DownwardAPIChangeTriggeredAction defines an action that triggers specific commands in response to changes in Pod labels.
379-
// For example, a command might be executed when the 'role' label of the Pod is updated.
380-
type DownwardAPIChangeTriggeredAction struct {
381-
// Specifies the name of the field. It must be a string of maximum length 63.
382-
// The name should match the regex pattern `^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$`.
383-
//
384-
// +kubebuilder:validation:Required
385-
// +kubebuilder:validation:MaxLength=63
386-
// +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$`
387-
Name string `json:"name"`
388-
389-
// Specifies the mount point of the Downward API volume.
390-
//
391-
// +kubebuilder:validation:Required
392-
// +kubebuilder:validation:MaxLength=128
393-
MountPoint string `json:"mountPoint"`
394-
395-
// Represents a list of files under the Downward API volume.
396-
//
397-
// +kubebuilder:validation:Required
398-
Items []corev1.DownwardAPIVolumeFile `json:"items"`
399-
400-
// Specifies the command to be triggered when changes are detected in Downward API volume files.
401-
// It relies on the inotify mechanism in the config-manager sidecar to monitor file changes.
402-
//
403-
// +optional
404-
Command []string `json:"command,omitempty"`
405-
406-
// ScriptConfig object specifies a ConfigMap that contains script files that should be mounted inside the pod.
407-
// The scripts are mounted as volumes and can be referenced and executed by the DownwardAction to perform specific tasks or configurations.
408-
//
409-
// +optional
410-
ScriptConfig *ScriptConfig `json:"scriptConfig,omitempty"`
411-
}
412-
413329
type ScriptConfig struct {
414330
// Specifies the reference to the ConfigMap containing the scripts.
415331
//
@@ -441,49 +357,6 @@ type ShellTrigger struct {
441357
// +optional
442358
Sync *bool `json:"sync,omitempty"`
443359

444-
// Controls whether parameter updates are processed individually or collectively in a batch:
445-
//
446-
// - 'True': Processes all changes in one batch reload.
447-
// - 'False': Processes each change individually.
448-
//
449-
// Defaults to 'False' if unspecified.
450-
//
451-
// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 1.1.0"
452-
// +optional
453-
BatchReload *bool `json:"batchReload,omitempty"`
454-
455-
// Specifies a Go template string for formatting batch input data.
456-
// It's used when `batchReload` is 'True' to format data passed into STDIN of the script.
457-
// The template accesses key-value pairs of updated parameters via the '$' variable.
458-
// This allows for custom formatting of the input data.
459-
//
460-
// Example template:
461-
//
462-
// ```yaml
463-
// batchParamsFormatterTemplate: |-
464-
// {{- range $pKey, $pValue := $ }}
465-
// {{ printf "%s:%s" $pKey $pValue }}
466-
// {{- end }}
467-
// ```
468-
//
469-
// This example generates batch input data in a key:value format, sorted by keys.
470-
// ```
471-
// key1:value1
472-
// key2:value2
473-
// key3:value3
474-
// ```
475-
//
476-
// If not specified, the default format is key=value, sorted by keys, for each updated parameter.
477-
// ```
478-
// key1=value1
479-
// key2=value2
480-
// key3=value3
481-
// ```
482-
//
483-
// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 1.1.0"
484-
// +optional
485-
BatchParamsFormatterTemplate string `json:"batchParamsFormatterTemplate,omitempty"`
486-
487360
// Specifies the tools container image used by ShellTrigger for dynamic reload.
488361
// If the dynamic reload action is triggered by a ShellTrigger, this field is required.
489362
// This image must contain all necessary tools for executing the ShellTrigger scripts.
@@ -502,24 +375,6 @@ type ShellTrigger struct {
502375
ScriptConfig *ScriptConfig `json:"scriptConfig,omitempty"`
503376
}
504377

505-
// TPLScriptTrigger Enables reloading process using a Go template script.
506-
type TPLScriptTrigger struct {
507-
// Specifies the ConfigMap that contains the script to be executed for reload.
508-
//
509-
ScriptConfig `json:",inline"`
510-
511-
// Determines whether parameter updates should be synchronized with the "config-manager".
512-
// Specifies the controller's reload strategy:
513-
//
514-
// - If set to 'True', the controller executes the reload action in synchronous mode,
515-
// pausing execution until the reload completes.
516-
// - If set to 'False', the controller executes the reload action in asynchronous mode,
517-
// updating the ConfigMap without waiting for the reload process to finish.
518-
//
519-
// +optional
520-
Sync *bool `json:"sync,omitempty"`
521-
}
522-
523378
// AutoTrigger automatically perform the reload when specified conditions are met.
524379
type AutoTrigger struct {
525380
// The name of the process.

apis/parameters/v1alpha1/types.go

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,6 @@ limitations under the License.
1616

1717
package v1alpha1
1818

19-
// DynamicParameterSelectedPolicy determines how to select the parameters of dynamic reload actions
20-
//
21-
// +enum
22-
// +kubebuilder:validation:Enum={all,dynamic}
23-
type DynamicParameterSelectedPolicy string
24-
25-
const (
26-
SelectedAllParameters DynamicParameterSelectedPolicy = "all"
27-
SelectedDynamicParameters DynamicParameterSelectedPolicy = "dynamic"
28-
)
29-
3019
// CfgFileFormat defines formatter of configuration files.
3120
// +enum
3221
// +kubebuilder:validation:Enum={xml,ini,yaml,json,hcl,dotenv,toml,properties,redis,props-plus,props-ultra}
@@ -46,58 +35,6 @@ const (
4635
PropertiesUltra CfgFileFormat = "props-ultra"
4736
)
4837

49-
// DynamicReloadType defines reload method.
50-
// +enum
51-
type DynamicReloadType string
52-
53-
const (
54-
UnixSignalType DynamicReloadType = "signal" // deprecated since 1.1.0
55-
SQLType DynamicReloadType = "sql"
56-
ShellType DynamicReloadType = "exec"
57-
HTTPType DynamicReloadType = "http"
58-
TPLScriptType DynamicReloadType = "tpl"
59-
AutoType DynamicReloadType = "auto"
60-
)
61-
62-
// SignalType defines which signals are valid.
63-
// +enum
64-
// +kubebuilder:validation:Enum={SIGHUP,SIGINT,SIGQUIT,SIGILL,SIGTRAP,SIGABRT,SIGBUS,SIGFPE,SIGKILL,SIGUSR1,SIGSEGV,SIGUSR2,SIGPIPE,SIGALRM,SIGTERM,SIGSTKFLT,SIGCHLD,SIGCONT,SIGSTOP,SIGTSTP,SIGTTIN,SIGTTOU,SIGURG,SIGXCPU,SIGXFSZ,SIGVTALRM,SIGPROF,SIGWINCH,SIGIO,SIGPWR,SIGSYS}
65-
type SignalType string
66-
67-
const (
68-
SIGHUP SignalType = "SIGHUP"
69-
SIGINT SignalType = "SIGINT"
70-
SIGQUIT SignalType = "SIGQUIT"
71-
SIGILL SignalType = "SIGILL"
72-
SIGTRAP SignalType = "SIGTRAP"
73-
SIGABRT SignalType = "SIGABRT"
74-
SIGBUS SignalType = "SIGBUS"
75-
SIGFPE SignalType = "SIGFPE"
76-
SIGKILL SignalType = "SIGKILL"
77-
SIGUSR1 SignalType = "SIGUSR1"
78-
SIGSEGV SignalType = "SIGSEGV"
79-
SIGUSR2 SignalType = "SIGUSR2"
80-
SIGPIPE SignalType = "SIGPIPE"
81-
SIGALRM SignalType = "SIGALRM"
82-
SIGTERM SignalType = "SIGTERM"
83-
SIGSTKFLT SignalType = "SIGSTKFLT"
84-
SIGCHLD SignalType = "SIGCHLD"
85-
SIGCONT SignalType = "SIGCONT"
86-
SIGSTOP SignalType = "SIGSTOP"
87-
SIGTSTP SignalType = "SIGTSTP"
88-
SIGTTIN SignalType = "SIGTTIN"
89-
SIGTTOU SignalType = "SIGTTOU"
90-
SIGURG SignalType = "SIGURG"
91-
SIGXCPU SignalType = "SIGXCPU"
92-
SIGXFSZ SignalType = "SIGXFSZ"
93-
SIGVTALRM SignalType = "SIGVTALRM"
94-
SIGPROF SignalType = "SIGPROF"
95-
SIGWINCH SignalType = "SIGWINCH"
96-
SIGIO SignalType = "SIGIO"
97-
SIGPWR SignalType = "SIGPWR"
98-
SIGSYS SignalType = "SIGSYS"
99-
)
100-
10138
// ParametersDescPhase defines the ParametersDescription CR .status.phase
10239
// +enum
10340
// +kubebuilder:validation:Enum={Available,Unavailable, Deleting}
@@ -165,19 +102,6 @@ type ParametersInFile struct {
165102
Parameters map[string]*string `json:"parameters,omitempty"`
166103
}
167104

168-
// ReloadPolicy defines the policy of reconfiguring.
169-
// +enum
170-
// +kubebuilder:validation:Enum={none,restart,asyncReload,syncReload,dynamicReloadBeginRestart}
171-
type ReloadPolicy string
172-
173-
const (
174-
NonePolicy ReloadPolicy = "none"
175-
RestartPolicy ReloadPolicy = "restart"
176-
AsyncDynamicReloadPolicy ReloadPolicy = "asyncReload"
177-
SyncDynamicReloadPolicy ReloadPolicy = "syncReload"
178-
DynamicReloadAndRestartPolicy ReloadPolicy = "dynamicReloadBeginRestart"
179-
)
180-
181105
type ComponentParameters map[string]*string
182106

183107
// MergedPolicy defines how to merge external imported templates into component templates.

0 commit comments

Comments
 (0)