Skip to content

Commit 1ee955b

Browse files
committed
Improve ipfailover configurability
START OF CHANGES DO NOT MERGE - MORE CHANGES COMING Add options to 'oadm ipfailover' to configure the check script and notify scripts and also control the period the check script runs. Keepalived periodically checks whether the application is running properly. In the default case the test is a simple verification that something is listening on the watch port. This PR permits the user to supply an additional check script that is run in the ipfailover container context to verify that the application is operating properly. For example, a web server can be tested by accessing the watch port and verifying the response. Whenever a node changes state to MASTER, BACKUP, or FAULT a notify script can be called. This script has 3 parameters filled in by keepalived: $1 - "GROUP"|"INSTANCE" $2 - name of group or instance $3 - target state of transition ("MASTER"|"BACKUP"|"FAULT") --check-script="check_script" The check script is a script in the keepalived container that verifies the service is running properly. These checks are in addition to verifying that the watch port is listening. --notify-script="notify_script" The notify script is a script in the keepalived container that is called whenever the keepalived state transitions to (MASTER|BACKUP|FAULT) --check-interval=<n> The check script is run every <n> seconds. Default is 2. Note: the scripts name is the full path to the script. Resolves 1362163 Signed-off-by: Phil Cameron <[email protected]>
1 parent 8b8e813 commit 1ee955b

File tree

18 files changed

+185
-14
lines changed

18 files changed

+185
-14
lines changed

contrib/completions/bash/oadm

+6
Original file line numberDiff line numberDiff line change
@@ -2321,6 +2321,10 @@ _oadm_ipfailover()
23212321
flags_with_completion=()
23222322
flags_completion=()
23232323

2324+
flags+=("--check-interval=")
2325+
local_nonpersistent_flags+=("--check-interval=")
2326+
flags+=("--check-script=")
2327+
local_nonpersistent_flags+=("--check-script=")
23242328
flags+=("--create")
23252329
local_nonpersistent_flags+=("--create")
23262330
flags+=("--dry-run")
@@ -2334,6 +2338,8 @@ _oadm_ipfailover()
23342338
local_nonpersistent_flags+=("--iptables-chain=")
23352339
flags+=("--latest-images")
23362340
local_nonpersistent_flags+=("--latest-images")
2341+
flags+=("--notify-script=")
2342+
local_nonpersistent_flags+=("--notify-script=")
23372343
flags+=("--output=")
23382344
two_word_flags+=("-o")
23392345
local_nonpersistent_flags+=("--output=")

contrib/completions/bash/oc

+6
Original file line numberDiff line numberDiff line change
@@ -2408,6 +2408,10 @@ _oc_adm_ipfailover()
24082408
flags_with_completion=()
24092409
flags_completion=()
24102410

2411+
flags+=("--check-interval=")
2412+
local_nonpersistent_flags+=("--check-interval=")
2413+
flags+=("--check-script=")
2414+
local_nonpersistent_flags+=("--check-script=")
24112415
flags+=("--create")
24122416
local_nonpersistent_flags+=("--create")
24132417
flags+=("--dry-run")
@@ -2421,6 +2425,8 @@ _oc_adm_ipfailover()
24212425
local_nonpersistent_flags+=("--iptables-chain=")
24222426
flags+=("--latest-images")
24232427
local_nonpersistent_flags+=("--latest-images")
2428+
flags+=("--notify-script=")
2429+
local_nonpersistent_flags+=("--notify-script=")
24242430
flags+=("--output=")
24252431
two_word_flags+=("-o")
24262432
local_nonpersistent_flags+=("--output=")

contrib/completions/bash/openshift

+18
Original file line numberDiff line numberDiff line change
@@ -2321,6 +2321,10 @@ _openshift_admin_ipfailover()
23212321
flags_with_completion=()
23222322
flags_completion=()
23232323

2324+
flags+=("--check-interval=")
2325+
local_nonpersistent_flags+=("--check-interval=")
2326+
flags+=("--check-script=")
2327+
local_nonpersistent_flags+=("--check-script=")
23242328
flags+=("--create")
23252329
local_nonpersistent_flags+=("--create")
23262330
flags+=("--dry-run")
@@ -2334,6 +2338,8 @@ _openshift_admin_ipfailover()
23342338
local_nonpersistent_flags+=("--iptables-chain=")
23352339
flags+=("--latest-images")
23362340
local_nonpersistent_flags+=("--latest-images")
2341+
flags+=("--notify-script=")
2342+
local_nonpersistent_flags+=("--notify-script=")
23372343
flags+=("--output=")
23382344
two_word_flags+=("-o")
23392345
local_nonpersistent_flags+=("--output=")
@@ -6918,6 +6924,10 @@ _openshift_cli_adm_ipfailover()
69186924
flags_with_completion=()
69196925
flags_completion=()
69206926

6927+
flags+=("--check-interval=")
6928+
local_nonpersistent_flags+=("--check-interval=")
6929+
flags+=("--check-script=")
6930+
local_nonpersistent_flags+=("--check-script=")
69216931
flags+=("--create")
69226932
local_nonpersistent_flags+=("--create")
69236933
flags+=("--dry-run")
@@ -6931,6 +6941,8 @@ _openshift_cli_adm_ipfailover()
69316941
local_nonpersistent_flags+=("--iptables-chain=")
69326942
flags+=("--latest-images")
69336943
local_nonpersistent_flags+=("--latest-images")
6944+
flags+=("--notify-script=")
6945+
local_nonpersistent_flags+=("--notify-script=")
69346946
flags+=("--output=")
69356947
two_word_flags+=("-o")
69366948
local_nonpersistent_flags+=("--output=")
@@ -19412,6 +19424,10 @@ _openshift_ex_ipfailover()
1941219424
flags_with_completion=()
1941319425
flags_completion=()
1941419426

19427+
flags+=("--check-interval=")
19428+
local_nonpersistent_flags+=("--check-interval=")
19429+
flags+=("--check-script=")
19430+
local_nonpersistent_flags+=("--check-script=")
1941519431
flags+=("--create")
1941619432
local_nonpersistent_flags+=("--create")
1941719433
flags+=("--dry-run")
@@ -19425,6 +19441,8 @@ _openshift_ex_ipfailover()
1942519441
local_nonpersistent_flags+=("--iptables-chain=")
1942619442
flags+=("--latest-images")
1942719443
local_nonpersistent_flags+=("--latest-images")
19444+
flags+=("--notify-script=")
19445+
local_nonpersistent_flags+=("--notify-script=")
1942819446
flags+=("--output=")
1942919447
two_word_flags+=("-o")
1943019448
local_nonpersistent_flags+=("--output=")

contrib/completions/zsh/oadm

+6
Original file line numberDiff line numberDiff line change
@@ -2482,6 +2482,10 @@ _oadm_ipfailover()
24822482
flags_with_completion=()
24832483
flags_completion=()
24842484

2485+
flags+=("--check-interval=")
2486+
local_nonpersistent_flags+=("--check-interval=")
2487+
flags+=("--check-script=")
2488+
local_nonpersistent_flags+=("--check-script=")
24852489
flags+=("--create")
24862490
local_nonpersistent_flags+=("--create")
24872491
flags+=("--dry-run")
@@ -2495,6 +2499,8 @@ _oadm_ipfailover()
24952499
local_nonpersistent_flags+=("--iptables-chain=")
24962500
flags+=("--latest-images")
24972501
local_nonpersistent_flags+=("--latest-images")
2502+
flags+=("--notify-script=")
2503+
local_nonpersistent_flags+=("--notify-script=")
24982504
flags+=("--output=")
24992505
two_word_flags+=("-o")
25002506
local_nonpersistent_flags+=("--output=")

contrib/completions/zsh/oc

+6
Original file line numberDiff line numberDiff line change
@@ -2569,6 +2569,10 @@ _oc_adm_ipfailover()
25692569
flags_with_completion=()
25702570
flags_completion=()
25712571

2572+
flags+=("--check-interval=")
2573+
local_nonpersistent_flags+=("--check-interval=")
2574+
flags+=("--check-script=")
2575+
local_nonpersistent_flags+=("--check-script=")
25722576
flags+=("--create")
25732577
local_nonpersistent_flags+=("--create")
25742578
flags+=("--dry-run")
@@ -2582,6 +2586,8 @@ _oc_adm_ipfailover()
25822586
local_nonpersistent_flags+=("--iptables-chain=")
25832587
flags+=("--latest-images")
25842588
local_nonpersistent_flags+=("--latest-images")
2589+
flags+=("--notify-script=")
2590+
local_nonpersistent_flags+=("--notify-script=")
25852591
flags+=("--output=")
25862592
two_word_flags+=("-o")
25872593
local_nonpersistent_flags+=("--output=")

contrib/completions/zsh/openshift

+18
Original file line numberDiff line numberDiff line change
@@ -2482,6 +2482,10 @@ _openshift_admin_ipfailover()
24822482
flags_with_completion=()
24832483
flags_completion=()
24842484

2485+
flags+=("--check-interval=")
2486+
local_nonpersistent_flags+=("--check-interval=")
2487+
flags+=("--check-script=")
2488+
local_nonpersistent_flags+=("--check-script=")
24852489
flags+=("--create")
24862490
local_nonpersistent_flags+=("--create")
24872491
flags+=("--dry-run")
@@ -2495,6 +2499,8 @@ _openshift_admin_ipfailover()
24952499
local_nonpersistent_flags+=("--iptables-chain=")
24962500
flags+=("--latest-images")
24972501
local_nonpersistent_flags+=("--latest-images")
2502+
flags+=("--notify-script=")
2503+
local_nonpersistent_flags+=("--notify-script=")
24982504
flags+=("--output=")
24992505
two_word_flags+=("-o")
25002506
local_nonpersistent_flags+=("--output=")
@@ -7079,6 +7085,10 @@ _openshift_cli_adm_ipfailover()
70797085
flags_with_completion=()
70807086
flags_completion=()
70817087

7088+
flags+=("--check-interval=")
7089+
local_nonpersistent_flags+=("--check-interval=")
7090+
flags+=("--check-script=")
7091+
local_nonpersistent_flags+=("--check-script=")
70827092
flags+=("--create")
70837093
local_nonpersistent_flags+=("--create")
70847094
flags+=("--dry-run")
@@ -7092,6 +7102,8 @@ _openshift_cli_adm_ipfailover()
70927102
local_nonpersistent_flags+=("--iptables-chain=")
70937103
flags+=("--latest-images")
70947104
local_nonpersistent_flags+=("--latest-images")
7105+
flags+=("--notify-script=")
7106+
local_nonpersistent_flags+=("--notify-script=")
70957107
flags+=("--output=")
70967108
two_word_flags+=("-o")
70977109
local_nonpersistent_flags+=("--output=")
@@ -19573,6 +19585,10 @@ _openshift_ex_ipfailover()
1957319585
flags_with_completion=()
1957419586
flags_completion=()
1957519587

19588+
flags+=("--check-interval=")
19589+
local_nonpersistent_flags+=("--check-interval=")
19590+
flags+=("--check-script=")
19591+
local_nonpersistent_flags+=("--check-script=")
1957619592
flags+=("--create")
1957719593
local_nonpersistent_flags+=("--create")
1957819594
flags+=("--dry-run")
@@ -19586,6 +19602,8 @@ _openshift_ex_ipfailover()
1958619602
local_nonpersistent_flags+=("--iptables-chain=")
1958719603
flags+=("--latest-images")
1958819604
local_nonpersistent_flags+=("--latest-images")
19605+
flags+=("--notify-script=")
19606+
local_nonpersistent_flags+=("--notify-script=")
1958919607
flags+=("--output=")
1959019608
two_word_flags+=("-o")
1959119609
local_nonpersistent_flags+=("--output=")

docs/man/man1/oadm-ipfailover.1

+12
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ If an IP failover configuration does not exist with the given name, the \-\-crea
2323

2424

2525
.SH OPTIONS
26+
.PP
27+
\fB\-\-check\-interval\fP=2
28+
Run the check\-script at this interval (seconds)
29+
30+
.PP
31+
\fB\-\-check\-script\fP=""
32+
Run this script at the check\-interval to verify service is OK
33+
2634
.PP
2735
\fB\-\-create\fP=false
2836
Create the configuration if it does not exist.
@@ -51,6 +59,10 @@ If an IP failover configuration does not exist with the given name, the \-\-crea
5159
\fB\-\-latest\-images\fP=false
5260
If true, attempt to use the latest images instead of the current release
5361

62+
.PP
63+
\fB\-\-notify\-script\fP=""
64+
Run this script when state changes.
65+
5466
.PP
5567
\fB\-o\fP, \fB\-\-output\fP=""
5668
Output results as yaml or json instead of executing, or use name for succint output (resource/name).

docs/man/man1/oc-adm-ipfailover.1

+12
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ If an IP failover configuration does not exist with the given name, the \-\-crea
2323

2424

2525
.SH OPTIONS
26+
.PP
27+
\fB\-\-check\-interval\fP=2
28+
Run the check\-script at this interval (seconds)
29+
30+
.PP
31+
\fB\-\-check\-script\fP=""
32+
Run this script at the check\-interval to verify service is OK
33+
2634
.PP
2735
\fB\-\-create\fP=false
2836
Create the configuration if it does not exist.
@@ -51,6 +59,10 @@ If an IP failover configuration does not exist with the given name, the \-\-crea
5159
\fB\-\-latest\-images\fP=false
5260
If true, attempt to use the latest images instead of the current release
5361

62+
.PP
63+
\fB\-\-notify\-script\fP=""
64+
Run this script when state changes.
65+
5466
.PP
5567
\fB\-o\fP, \fB\-\-output\fP=""
5668
Output results as yaml or json instead of executing, or use name for succint output (resource/name).

docs/man/man1/openshift-admin-ipfailover.1

+12
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ If an IP failover configuration does not exist with the given name, the \-\-crea
2323

2424

2525
.SH OPTIONS
26+
.PP
27+
\fB\-\-check\-interval\fP=2
28+
Run the check\-script at this interval (seconds)
29+
30+
.PP
31+
\fB\-\-check\-script\fP=""
32+
Run this script at the check\-interval to verify service is OK
33+
2634
.PP
2735
\fB\-\-create\fP=false
2836
Create the configuration if it does not exist.
@@ -51,6 +59,10 @@ If an IP failover configuration does not exist with the given name, the \-\-crea
5159
\fB\-\-latest\-images\fP=false
5260
If true, attempt to use the latest images instead of the current release
5361

62+
.PP
63+
\fB\-\-notify\-script\fP=""
64+
Run this script when state changes.
65+
5466
.PP
5567
\fB\-o\fP, \fB\-\-output\fP=""
5668
Output results as yaml or json instead of executing, or use name for succint output (resource/name).

docs/man/man1/openshift-cli-adm-ipfailover.1

+12
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ If an IP failover configuration does not exist with the given name, the \-\-crea
2323

2424

2525
.SH OPTIONS
26+
.PP
27+
\fB\-\-check\-interval\fP=2
28+
Run the check\-script at this interval (seconds)
29+
30+
.PP
31+
\fB\-\-check\-script\fP=""
32+
Run this script at the check\-interval to verify service is OK
33+
2634
.PP
2735
\fB\-\-create\fP=false
2836
Create the configuration if it does not exist.
@@ -51,6 +59,10 @@ If an IP failover configuration does not exist with the given name, the \-\-crea
5159
\fB\-\-latest\-images\fP=false
5260
If true, attempt to use the latest images instead of the current release
5361

62+
.PP
63+
\fB\-\-notify\-script\fP=""
64+
Run this script when state changes.
65+
5466
.PP
5567
\fB\-o\fP, \fB\-\-output\fP=""
5668
Output results as yaml or json instead of executing, or use name for succint output (resource/name).

docs/man/man1/openshift-ex-ipfailover.1

+12
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ If an IP failover configuration does not exist with the given name, the \-\-crea
2323

2424

2525
.SH OPTIONS
26+
.PP
27+
\fB\-\-check\-interval\fP=2
28+
Run the check\-script at this interval (seconds)
29+
30+
.PP
31+
\fB\-\-check\-script\fP=""
32+
Run this script at the check\-interval to verify service is OK
33+
2634
.PP
2735
\fB\-\-create\fP=false
2836
Create the configuration if it does not exist.
@@ -51,6 +59,10 @@ If an IP failover configuration does not exist with the given name, the \-\-crea
5159
\fB\-\-latest\-images\fP=false
5260
If true, attempt to use the latest images instead of the current release
5361

62+
.PP
63+
\fB\-\-notify\-script\fP=""
64+
Run this script when state changes.
65+
5466
.PP
5567
\fB\-o\fP, \fB\-\-output\fP=""
5668
Output results as yaml or json instead of executing, or use name for succint output (resource/name).

0 commit comments

Comments
 (0)