|
| 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 | + |
| 9 | +OS_FEDERATION_NAME="${OS_FEDERATION_NAME:-origin-federation}" |
| 10 | +OS_FEDERATION_NAMESPACE="${OS_FEDERATION_NAMESPACE:-federation-system}" |
| 11 | +SERVICE_ACCOUNT="system:serviceaccount:${OS_FEDERATION_NAMESPACE}:default" |
| 12 | + |
| 13 | +os::log::info "" |
| 14 | +os::log::info "Deploying federation control plane" |
| 15 | +kubefed init "${OS_FEDERATION_NAME}" --dns-provider=google-clouddns \ |
| 16 | + --federation-system-namespace="${OS_FEDERATION_NAMESPACE}" \ |
| 17 | + --etcd-persistent-storage=false |
| 18 | + |
| 19 | +# Ensure the controller manager will be able to access cluster configuration stored as |
| 20 | +# secrets in the federation namespace. |
| 21 | +os::log::info "" |
| 22 | +os::log::info "Granting the admin role to the service account of the federation namespace" |
| 23 | +oadm --namespace "${OS_FEDERATION_NAMESPACE}" policy add-role-to-user admin "${SERVICE_ACCOUNT}" |
| 24 | + |
| 25 | +# TODO enable coredns when documentation is available |
| 26 | +os::log::info "" |
| 27 | +os::log::info "Disabling the federation services controller to avoid having to configure dnsaas" |
| 28 | +kubectl --namespace="${OS_FEDERATION_NAMESPACE}" patch deploy "${OS_FEDERATION_NAME}-controller-manager" \ |
| 29 | + --type=json -p='[{"op": "add", "path": "/spec/template/spec/containers/0/command/-", "value": "--controllers=services=false"}]' |
| 30 | + |
| 31 | +os::log::info "" |
| 32 | +os::log::info "Waiting for federation api to become available" |
| 33 | +os::cmd::try_until_text "oc get --raw /healthz --config='${ADMIN_KUBECONFIG}' --context=${OS_FEDERATION_NAME}" 'ok' $(( 80 * second )) 0.25 |
| 34 | + |
| 35 | +os::log::info "" |
| 36 | +os::log::info "Joining the host cluster to the federation" |
| 37 | +HOST_CONTEXT="$(oc config current-context)" |
| 38 | +kubefed join openshift --context="${OS_FEDERATION_NAME}" --host-cluster-context="${HOST_CONTEXT}" --cluster-context="${HOST_CONTEXT}" |
| 39 | + |
| 40 | +os::log::info "" |
| 41 | +os::log::info "Running federation tests" |
| 42 | +os::test::extended::focus "$@" |
0 commit comments