|
| 1 | +#!/bin/bash |
| 2 | +# |
| 3 | +# Runs the federation tests against a standard started server. |
| 4 | +source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh" |
| 5 | +source "${OS_ROOT}/test/extended/setup.sh" |
| 6 | + |
| 7 | +os::test::extended::setup |
| 8 | +os::util::ensure::built_binary_exists kubefed |
| 9 | +os::test::extended::focus "$@" |
| 10 | + |
| 11 | +export OS_FEDERATION_NAME="${OS_FEDERATION_NAME:-origin-federation}" |
| 12 | +export OS_FEDERATION_NAMESPACE="${OS_FEDERATION_NAMESPACE:-federation-system}" |
| 13 | +export OS_FEDERATION_SERVICE_ACCOUNT="system:serviceaccount:${OS_FEDERATION_NAMESPACE}:default" |
| 14 | + |
| 15 | +os::test::junit::declare_suite_start "extended/federation" |
| 16 | + |
| 17 | +os::log::debug "Granting anyuid to the service account of the federation namespace to ensure /var/etcd is writeable in the etcd pod." |
| 18 | +os::cmd::expect_success "oadm policy add-scc-to-user anyuid '${OS_FEDERATION_SERVICE_ACCOUNT}'" |
| 19 | + |
| 20 | +os::log::info "Deploying federation control plane" |
| 21 | +os::cmd::expect_success "kubefed init '${OS_FEDERATION_NAME}' --dns-provider=google-clouddns \ |
| 22 | + --federation-system-namespace='${OS_FEDERATION_NAMESPACE}' \ |
| 23 | + --etcd-persistent-storage=false \ |
| 24 | + --image='openshift/origin-federation:v1.5.0-0.alpha.3.1554.a0c834a'" # TODO Remove |
| 25 | + |
| 26 | +# Ensure the controller manager will be able to access cluster configuration stored as |
| 27 | +# secrets in the federation namespace. |
| 28 | +os::log::debug "Granting the admin role to the service account of the federation namespace" |
| 29 | +os::cmd::expect_success "oadm --namespace '${OS_FEDERATION_NAMESPACE}' policy add-role-to-user admin '${OS_FEDERATION_SERVICE_ACCOUNT}'" |
| 30 | + |
| 31 | +# TODO enable coredns when documentation is available |
| 32 | +os::log::debug "Disabling the federation services controller to avoid having to configure dnsaas" |
| 33 | +os::cmd::expect_success "oc --namespace='${OS_FEDERATION_NAMESPACE}' patch deploy '${OS_FEDERATION_NAME}-controller-manager' \ |
| 34 | + --type=json -p='[{\"op\": \"add\", \"path\": \"/spec/template/spec/containers/0/command/-\", \"value\": \"--controllers=services=false\"}]'" |
| 35 | + |
| 36 | +os::log::debug "Waiting for federation api to become available" |
| 37 | +os::cmd::try_until_text "oc get --raw /healthz --config='${ADMIN_KUBECONFIG}' --context=${OS_FEDERATION_NAME}" 'ok' $(( 80 * second )) 0.25 |
| 38 | + |
| 39 | +os::log::info "Joining the host cluster to the federation" |
| 40 | +export OS_FEDERATION_HOST_CONTEXT="$(oc config current-context)" |
| 41 | +os::cmd::expect_success "kubefed join openshift --context='${OS_FEDERATION_NAME}' \ |
| 42 | + --host-cluster-context='${OS_FEDERATION_HOST_CONTEXT}' \ |
| 43 | + --cluster-context='${OS_FEDERATION_HOST_CONTEXT}'" |
| 44 | + |
| 45 | +os::test::junit::declare_suite_end |
| 46 | + |
| 47 | +os::log::info "Running federation tests" |
| 48 | +FOCUS="Federation secrets.*successfully" SKIP="${SKIP_TESTS:-}" TEST_REPORT_FILE_NAME=federation os::test::extended::run -- -test.timeout 2h |
0 commit comments