Skip to content

Commit

Permalink
IPFailover was broken for alpha.1
Browse files Browse the repository at this point in the history
/var/lib/origin is now a docker volume, which results in the contents
being lost. Moved it to /var/lib/ipfailover, and added a slightly better
error message when no arguments are provided.
  • Loading branch information
smarterclayton committed Jun 1, 2016
1 parent 7afe72b commit 5c29554
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
5 changes: 3 additions & 2 deletions images/ipfailover/keepalived/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ RUN INSTALL_PKGS="kmod keepalived iproute psmisc nmap-ncat net-tools" && \
yum install -y $INSTALL_PKGS && \
rpm -V $INSTALL_PKGS && \
yum clean all
COPY . /var/lib/origin/ipfailover/keepalived/
COPY . /var/lib/ipfailover/keepalived/

LABEL io.k8s.display-name="OpenShift Origin IP Failover" \
io.k8s.description="This is a component of OpenShift Origin and runs a clustered keepalived instance across multiple hosts to allow highly available IP addresses."
EXPOSE 1985
ENTRYPOINT ["/var/lib/origin/ipfailover/keepalived/monitor.sh"]
WORKDIR /var/lib/ipfailover
ENTRYPOINT ["/var/lib/ipfailover/keepalived/monitor.sh"]
1 change: 1 addition & 0 deletions pkg/ipfailover/keepalived/generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ func TestGenerateDeploymentConfig(t *testing.T) {
dc, err := GenerateDeploymentConfig(tc.Name, options, selector)
if err != nil {
t.Errorf("Test case for %s got an error %v where none was expected", tc.Name, err)
continue
}
if tc.Name != dc.Name {
t.Errorf("Test case for %s got DeploymentConfig name %v where %v was expected", tc.Name, dc.Name, tc.Name)
Expand Down
4 changes: 4 additions & 0 deletions pkg/ipfailover/keepalived/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ func (p *KeepalivedPlugin) Generate() (*kapi.List, error) {
return nil, fmt.Errorf("error getting selector: %v", err)
}

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

dc, err := GenerateDeploymentConfig(p.Name, p.Options, selector)
if err != nil {
return nil, fmt.Errorf("error generating DeploymentConfig: %v", err)
Expand Down
10 changes: 6 additions & 4 deletions test/cmd/router.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,12 @@ os::cmd::expect_success_and_not_text "oadm router -o yaml --credentials=${KUBECO
echo "router: ok"

# test ipfailover
os::cmd::expect_success_and_text 'oadm ipfailover --dry-run' 'Creating IP failover'
os::cmd::expect_success_and_text 'oadm ipfailover --dry-run' 'Success \(DRY RUN\)'
os::cmd::expect_success_and_text 'oadm ipfailover --dry-run -o yaml' 'name: ipfailover'
os::cmd::expect_success_and_text 'oadm ipfailover --dry-run -o name' 'deploymentconfig/ipfailover'
os::cmd::expect_failure_and_text 'oadm ipfailover --dry-run' 'you must specify at least one virtual IP address'
os::cmd::expect_success_and_text 'oadm ipfailover --credentials=${KUBECONFIG} --virtual-ips="1.2.3.4" --dry-run' 'Creating IP failover'
os::cmd::expect_success_and_text 'oadm ipfailover --credentials=${KUBECONFIG} --virtual-ips="1.2.3.4" --dry-run' 'Success \(DRY RUN\)'
os::cmd::expect_success_and_text 'oadm ipfailover --credentials=${KUBECONFIG} --virtual-ips="1.2.3.4" --dry-run -o yaml' 'name: ipfailover'
os::cmd::expect_success_and_text 'oadm ipfailover --credentials=${KUBECONFIG} --virtual-ips="1.2.3.4" --dry-run -o name' 'deploymentconfig/ipfailover'
os::cmd::expect_success_and_text 'oadm ipfailover --credentials=${KUBECONFIG} --virtual-ips="1.2.3.4" --dry-run -o yaml' '1.2.3.4'
# TODO add tests for normal ipfailover creation
# os::cmd::expect_success_and_text 'oadm ipfailover' 'deploymentconfig "ipfailover" created'
# os::cmd::expect_failure_and_text 'oadm ipfailover' 'Error from server: deploymentconfig "ipfailover" already exists'
Expand Down

0 comments on commit 5c29554

Please sign in to comment.