Skip to content

Commit bce0038

Browse files
committed
Improve ipfailover configurability
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 34b4f58 commit bce0038

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=")
@@ -6938,6 +6944,10 @@ _openshift_cli_adm_ipfailover()
69386944
flags_with_completion=()
69396945
flags_completion=()
69406946

6947+
flags+=("--check-interval=")
6948+
local_nonpersistent_flags+=("--check-interval=")
6949+
flags+=("--check-script=")
6950+
local_nonpersistent_flags+=("--check-script=")
69416951
flags+=("--create")
69426952
local_nonpersistent_flags+=("--create")
69436953
flags+=("--dry-run")
@@ -6951,6 +6961,8 @@ _openshift_cli_adm_ipfailover()
69516961
local_nonpersistent_flags+=("--iptables-chain=")
69526962
flags+=("--latest-images")
69536963
local_nonpersistent_flags+=("--latest-images")
6964+
flags+=("--notify-script=")
6965+
local_nonpersistent_flags+=("--notify-script=")
69546966
flags+=("--output=")
69556967
two_word_flags+=("-o")
69566968
local_nonpersistent_flags+=("--output=")
@@ -19661,6 +19673,10 @@ _openshift_ex_ipfailover()
1966119673
flags_with_completion=()
1966219674
flags_completion=()
1966319675

19676+
flags+=("--check-interval=")
19677+
local_nonpersistent_flags+=("--check-interval=")
19678+
flags+=("--check-script=")
19679+
local_nonpersistent_flags+=("--check-script=")
1966419680
flags+=("--create")
1966519681
local_nonpersistent_flags+=("--create")
1966619682
flags+=("--dry-run")
@@ -19674,6 +19690,8 @@ _openshift_ex_ipfailover()
1967419690
local_nonpersistent_flags+=("--iptables-chain=")
1967519691
flags+=("--latest-images")
1967619692
local_nonpersistent_flags+=("--latest-images")
19693+
flags+=("--notify-script=")
19694+
local_nonpersistent_flags+=("--notify-script=")
1967719695
flags+=("--output=")
1967819696
two_word_flags+=("-o")
1967919697
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=")
@@ -7099,6 +7105,10 @@ _openshift_cli_adm_ipfailover()
70997105
flags_with_completion=()
71007106
flags_completion=()
71017107

7108+
flags+=("--check-interval=")
7109+
local_nonpersistent_flags+=("--check-interval=")
7110+
flags+=("--check-script=")
7111+
local_nonpersistent_flags+=("--check-script=")
71027112
flags+=("--create")
71037113
local_nonpersistent_flags+=("--create")
71047114
flags+=("--dry-run")
@@ -7112,6 +7122,8 @@ _openshift_cli_adm_ipfailover()
71127122
local_nonpersistent_flags+=("--iptables-chain=")
71137123
flags+=("--latest-images")
71147124
local_nonpersistent_flags+=("--latest-images")
7125+
flags+=("--notify-script=")
7126+
local_nonpersistent_flags+=("--notify-script=")
71157127
flags+=("--output=")
71167128
two_word_flags+=("-o")
71177129
local_nonpersistent_flags+=("--output=")
@@ -19822,6 +19834,10 @@ _openshift_ex_ipfailover()
1982219834
flags_with_completion=()
1982319835
flags_completion=()
1982419836

19837+
flags+=("--check-interval=")
19838+
local_nonpersistent_flags+=("--check-interval=")
19839+
flags+=("--check-script=")
19840+
local_nonpersistent_flags+=("--check-script=")
1982519841
flags+=("--create")
1982619842
local_nonpersistent_flags+=("--create")
1982719843
flags+=("--dry-run")
@@ -19835,6 +19851,8 @@ _openshift_ex_ipfailover()
1983519851
local_nonpersistent_flags+=("--iptables-chain=")
1983619852
flags+=("--latest-images")
1983719853
local_nonpersistent_flags+=("--latest-images")
19854+
flags+=("--notify-script=")
19855+
local_nonpersistent_flags+=("--notify-script=")
1983819856
flags+=("--output=")
1983919857
two_word_flags+=("-o")
1984019858
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)