Skip to content

Commit 4b48fe6

Browse files
committed
Remove on-marked-down shutdown-sessions feature
As requested in PR review, this feature is being added separately in PR percona#2205. Also fixed HA_SERVER_OPTIONS to allow custom values via secret: - When healthCheck is not configured in the CR, HA_SERVER_OPTIONS env var is not set by the operator, allowing it to be customized via the haproxy-env-vars secret or use the script's default value - When healthCheck is configured, the operator generates HA_SERVER_OPTIONS with the specified interval, rise, and fall values Changes: - Removed ShutdownOnMarkDown field from HAProxyHealthCheckSpec API - Removed HA_SHUTDOWN_ON_MARK_DOWN env var and shutdown_on_mark_down logic - Updated CRDs and generated code - Updated tests - Updated example CR documentation
1 parent 4179786 commit 4b48fe6

File tree

11 files changed

+50667
-2132
lines changed

11 files changed

+50667
-2132
lines changed

build/haproxy_add_pxc_nodes.sh

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,10 @@ function main() {
2424

2525
SERVER_OPTIONS=${HA_SERVER_OPTIONS:-'resolvers kubernetes check inter 10000 rise 1 fall 2 weight 1'}
2626
send_proxy=''
27-
shutdown_on_mark_down=''
2827
path_to_haproxy_cfg='/etc/haproxy/pxc'
2928
if [[ "${IS_PROXY_PROTOCOL}" = "yes" ]]; then
3029
send_proxy='send-proxy-v2'
3130
fi
32-
if [[ "${HA_SHUTDOWN_ON_MARK_DOWN}" = "yes" ]]; then
33-
shutdown_on_mark_down='on-marked-down shutdown-sessions'
34-
fi
3531

3632
while read -r pxc_host; do
3733
if [ -z "$pxc_host" ]; then
@@ -41,19 +37,19 @@ function main() {
4137

4238
node_name=$(echo "$pxc_host" | cut -d . -f -1)
4339
node_id=$(echo "$node_name" | awk -F'-' '{print $NF}')
44-
NODE_LIST_REPL+=("server $node_name $pxc_host:3306 $send_proxy $SERVER_OPTIONS${shutdown_on_mark_down:+ }$shutdown_on_mark_down")
40+
NODE_LIST_REPL+=("server $node_name $pxc_host:3306 $send_proxy $SERVER_OPTIONS")
4541
if [ "$node_id" = '0' ]; then
4642
firs_node_replica="$pxc_host"
4743
main_node="$pxc_host"
48-
firs_node="server $node_name $pxc_host:3306 $send_proxy $SERVER_OPTIONS on-marked-up shutdown-backup-sessions${shutdown_on_mark_down:+ }$shutdown_on_mark_down"
49-
firs_node_admin="server $node_name $pxc_host:33062 $SERVER_OPTIONS on-marked-up shutdown-backup-sessions${shutdown_on_mark_down:+ }$shutdown_on_mark_down"
50-
firs_node_mysqlx="server $node_name $pxc_host:33060 $SERVER_OPTIONS on-marked-up shutdown-backup-sessions${shutdown_on_mark_down:+ }$shutdown_on_mark_down"
44+
firs_node="server $node_name $pxc_host:3306 $send_proxy $SERVER_OPTIONS on-marked-up shutdown-backup-sessions"
45+
firs_node_admin="server $node_name $pxc_host:33062 $SERVER_OPTIONS on-marked-up shutdown-backup-sessions"
46+
firs_node_mysqlx="server $node_name $pxc_host:33060 $SERVER_OPTIONS on-marked-up shutdown-backup-sessions"
5147
continue
5248
fi
5349
NODE_LIST_BACKUP+=("galera-nodes/$node_name" "galera-admin-nodes/$node_name")
54-
NODE_LIST+=("server $node_name $pxc_host:3306 $send_proxy $SERVER_OPTIONS backup${shutdown_on_mark_down:+ }$shutdown_on_mark_down")
55-
NODE_LIST_ADMIN+=("server $node_name $pxc_host:33062 $SERVER_OPTIONS backup${shutdown_on_mark_down:+ }$shutdown_on_mark_down")
56-
NODE_LIST_MYSQLX+=("server $node_name $pxc_host:33060 $send_proxy $SERVER_OPTIONS backup${shutdown_on_mark_down:+ }$shutdown_on_mark_down")
50+
NODE_LIST+=("server $node_name $pxc_host:3306 $send_proxy $SERVER_OPTIONS backup")
51+
NODE_LIST_ADMIN+=("server $node_name $pxc_host:33062 $SERVER_OPTIONS backup")
52+
NODE_LIST_MYSQLX+=("server $node_name $pxc_host:33060 $send_proxy $SERVER_OPTIONS backup")
5753
done
5854

5955
if [ -n "$firs_node" ]; then

config/crd/bases/pxc.percona.com_perconaxtradbclusterbackups.yaml

Lines changed: 106 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.16.3
6+
controller-gen.kubebuilder.io/version: v0.18.0
77
name: perconaxtradbclusterbackups.pxc.percona.com
88
spec:
99
group: pxc.percona.com
@@ -46,8 +46,19 @@ spec:
4646
openAPIV3Schema:
4747
properties:
4848
apiVersion:
49+
description: |-
50+
APIVersion defines the versioned schema of this representation of an object.
51+
Servers should convert recognized schemas to the latest internal value, and
52+
may reject unrecognized values.
53+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
4954
type: string
5055
kind:
56+
description: |-
57+
Kind is a string value representing the REST resource this object represents.
58+
Servers may infer this from the endpoint the client submits requests to.
59+
Cannot be updated.
60+
In CamelCase.
61+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
5162
type: string
5263
metadata:
5364
type: object
@@ -79,46 +90,100 @@ spec:
7990
type: object
8091
env:
8192
items:
93+
description: EnvVar represents an environment variable present
94+
in a Container.
8295
properties:
8396
name:
97+
description: |-
98+
Name of the environment variable.
99+
May consist of any printable ASCII characters except '='.
84100
type: string
85101
value:
102+
description: |-
103+
Variable references $(VAR_NAME) are expanded
104+
using the previously defined environment variables in the container and
105+
any service environment variables. If a variable cannot be resolved,
106+
the reference in the input string will be unchanged. Double $$ are reduced
107+
to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e.
108+
"$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)".
109+
Escaped references will never be expanded, regardless of whether the variable
110+
exists or not.
111+
Defaults to "".
86112
type: string
87113
valueFrom:
114+
description: Source for the environment variable's value.
115+
Cannot be used if value is not empty.
88116
properties:
89117
configMapKeyRef:
118+
description: Selects a key of a ConfigMap.
90119
properties:
91120
key:
121+
description: The key to select.
92122
type: string
93123
name:
94124
default: ""
125+
description: |-
126+
Name of the referent.
127+
This field is effectively required, but due to backwards compatibility is
128+
allowed to be empty. Instances of this type with an empty value here are
129+
almost certainly wrong.
130+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
95131
type: string
96132
optional:
133+
description: Specify whether the ConfigMap or its
134+
key must be defined
97135
type: boolean
98136
required:
99137
- key
100138
type: object
101139
x-kubernetes-map-type: atomic
102140
fieldRef:
141+
description: |-
142+
Selects a field of the pod: supports metadata.name, metadata.namespace, `metadata.labels['<KEY>']`, `metadata.annotations['<KEY>']`,
143+
spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs.
103144
properties:
104145
apiVersion:
146+
description: Version of the schema the FieldPath
147+
is written in terms of, defaults to "v1".
105148
type: string
106149
fieldPath:
150+
description: Path of the field to select in the
151+
specified API version.
107152
type: string
108153
required:
109154
- fieldPath
110155
type: object
111156
x-kubernetes-map-type: atomic
112157
fileKeyRef:
158+
description: |-
159+
FileKeyRef selects a key of the env file.
160+
Requires the EnvFiles feature gate to be enabled.
113161
properties:
114162
key:
163+
description: |-
164+
The key within the env file. An invalid key will prevent the pod from starting.
165+
The keys defined within a source may consist of any printable ASCII characters except '='.
166+
During Alpha stage of the EnvFiles feature gate, the key size is limited to 128 characters.
115167
type: string
116168
optional:
117169
default: false
170+
description: |-
171+
Specify whether the file or its key must be defined. If the file or key
172+
does not exist, then the env var is not published.
173+
If optional is set to true and the specified key does not exist,
174+
the environment variable will not be set in the Pod's containers.
175+
176+
If optional is set to false and the specified key does not exist,
177+
an error will be returned during Pod creation.
118178
type: boolean
119179
path:
180+
description: |-
181+
The path within the volume from which to select the file.
182+
Must be relative and may not contain the '..' path or start with '..'.
120183
type: string
121184
volumeName:
185+
description: The name of the volume mount containing
186+
the env file.
122187
type: string
123188
required:
124189
- key
@@ -127,29 +192,49 @@ spec:
127192
type: object
128193
x-kubernetes-map-type: atomic
129194
resourceFieldRef:
195+
description: |-
196+
Selects a resource of the container: only resources limits and requests
197+
(limits.cpu, limits.memory, limits.ephemeral-storage, requests.cpu, requests.memory and requests.ephemeral-storage) are currently supported.
130198
properties:
131199
containerName:
200+
description: 'Container name: required for volumes,
201+
optional for env vars'
132202
type: string
133203
divisor:
134204
anyOf:
135205
- type: integer
136206
- type: string
207+
description: Specifies the output format of the
208+
exposed resources, defaults to "1"
137209
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
138210
x-kubernetes-int-or-string: true
139211
resource:
212+
description: 'Required: resource to select'
140213
type: string
141214
required:
142215
- resource
143216
type: object
144217
x-kubernetes-map-type: atomic
145218
secretKeyRef:
219+
description: Selects a key of a secret in the pod's
220+
namespace
146221
properties:
147222
key:
223+
description: The key of the secret to select from. Must
224+
be a valid secret key.
148225
type: string
149226
name:
150227
default: ""
228+
description: |-
229+
Name of the referent.
230+
This field is effectively required, but due to backwards compatibility is
231+
allowed to be empty. Instances of this type with an empty value here are
232+
almost certainly wrong.
233+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
151234
type: string
152235
optional:
236+
description: Specify whether the Secret or its key
237+
must be defined
153238
type: boolean
154239
required:
155240
- key
@@ -195,29 +280,49 @@ spec:
195280
type: string
196281
conditions:
197282
items:
283+
description: Condition contains details for one aspect of the current
284+
state of this API Resource.
198285
properties:
199286
lastTransitionTime:
287+
description: |-
288+
lastTransitionTime is the last time the condition transitioned from one status to another.
289+
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
200290
format: date-time
201291
type: string
202292
message:
293+
description: |-
294+
message is a human readable message indicating details about the transition.
295+
This may be an empty string.
203296
maxLength: 32768
204297
type: string
205298
observedGeneration:
299+
description: |-
300+
observedGeneration represents the .metadata.generation that the condition was set based upon.
301+
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
302+
with respect to the current state of the instance.
206303
format: int64
207304
minimum: 0
208305
type: integer
209306
reason:
307+
description: |-
308+
reason contains a programmatic identifier indicating the reason for the condition's last transition.
309+
Producers of specific condition types may define expected values and meanings for this field,
310+
and whether the values are considered a guaranteed API.
311+
The value should be a CamelCase string.
312+
This field may not be empty.
210313
maxLength: 1024
211314
minLength: 1
212315
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
213316
type: string
214317
status:
318+
description: status of the condition, one of True, False, Unknown.
215319
enum:
216320
- "True"
217321
- "False"
218322
- Unknown
219323
type: string
220324
type:
325+
description: type of condition in CamelCase or in foo.example.com/CamelCase.
221326
maxLength: 316
222327
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
223328
type: string

0 commit comments

Comments
 (0)