Skip to content

Commit 83e2ef6

Browse files
author
OpenShift Bot
authored
Merge pull request #12472 from pecameron/bz1411501
Merged by openshift-bot
2 parents 6ee94d0 + 959a4bf commit 83e2ef6

File tree

5 files changed

+18
-6
lines changed

5 files changed

+18
-6
lines changed

Diff for: images/ipfailover/keepalived/lib/config-generators.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ function generate_vip_section() {
178178
#
179179
function generate_vrrpd_instance_config() {
180180
local servicename=$1
181-
local iid=${2:-"0"}
181+
local iid=${2:-"1"}
182182
local vips=$3
183183
local interface=$4
184184
local priority=${5:-"10"}

Diff for: pkg/cmd/experimental/ipfailover/ipfailover.go

+10-2
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,18 @@ func Run(f *clientcmd.Factory, options *ipfailover.IPFailoverConfigCmdOptions, c
150150
return err
151151
}
152152

153-
if len(options.ServiceAccount) == 0 {
154-
return fmt.Errorf("you must specify a service account for the ipfailover pod with --service-account, it cannot be blank")
153+
if options.VRRPIDOffset < 0 || options.VRRPIDOffset > 254 {
154+
return fmt.Errorf("The vrrp-id-offset must be in the range 0..254")
155155
}
156156

157+
// The ipfailover pods for a given configuration must run on different nodes.
158+
// We are using the ServicePort as a mechanism to prevent multiple pods for
159+
// same configuration starting on the same node. Since pods for different
160+
// configurations can run on the same node a different ServicePort is used
161+
// for each configuration.
162+
// In the future, this may be changed to pod anti-affinity.
163+
options.ServicePort = options.ServicePort + options.VRRPIDOffset
164+
157165
options.Action.Bulk.Mapper = clientcmd.ResourceMapper(f)
158166
options.Action.Bulk.Op = configcmd.Create
159167

Diff for: pkg/ipfailover/keepalived/plugin.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ func (p *KeepalivedPlugin) Generate() (*kapi.List, error) {
116116
}
117117

118118
if len(p.Options.VirtualIPs) == 0 {
119-
return nil, fmt.Errorf("you must specify at least one virtual IP address for keepalived to expose")
119+
return nil, fmt.Errorf("you must specify at least one virtual IP address (--virtual-ips=) for keepalived to expose")
120120
}
121121

122122
dc, err := GenerateDeploymentConfig(p.Name, p.Options, selector)

Diff for: pkg/ipfailover/types.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ const (
1212
// DefaultType is the default IP Failover type.
1313
DefaultType = "keepalived"
1414

15-
// DefaultServicePort is the default service port.
16-
DefaultServicePort = 1985
15+
// DefaultServicePort is the port associated with the ipfailover config.
16+
// Each ipfailover config has a different ServicePort.
17+
DefaultServicePort = 63000
1718

1819
// DefaultWatchPort is the default IP Failover watched port number.
1920
DefaultWatchPort = 80

Diff for: test/cmd/router.sh

+3
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,10 @@ os::cmd::expect_success_and_text 'oadm ipfailover --virtual-ips="1.2.3.4" --ipta
7878
os::cmd::expect_success_and_text 'oadm ipfailover --virtual-ips="1.2.3.4" --check-interval=1177 --dry-run -o yaml' 'value: "1177"'
7979
os::cmd::expect_success_and_text 'oadm ipfailover --virtual-ips="1.2.3.4" --check-script="ChkScript.sh" --dry-run -o yaml' 'value: ChkScript.sh'
8080
os::cmd::expect_success_and_text 'oadm ipfailover --virtual-ips="1.2.3.4" --notify-script="NotScript.sh" --dry-run -o yaml' 'value: NotScript.sh'
81+
os::cmd::expect_success_and_text 'oadm ipfailover --virtual-ips="1.2.3.4" --dry-run -o yaml --vrrp-id-offset=56' 'hostPort: 63056'
82+
os::cmd::expect_failure_and_text 'oadm ipfailover --virtual-ips="1.2.3.4" --dry-run -o yaml --vrrp-id-offset=255' 'error: The vrrp-id-offset must be in the range 0..254'
8183
os::cmd::expect_success 'oadm policy remove-scc-from-user privileged -z ipfailover'
84+
8285
# TODO add tests for normal ipfailover creation
8386
# os::cmd::expect_success_and_text 'oadm ipfailover' 'deploymentconfig "ipfailover" created'
8487
# os::cmd::expect_failure_and_text 'oadm ipfailover' 'Error from server: deploymentconfig "ipfailover" already exists'

0 commit comments

Comments
 (0)