Merge pull request #52630 from shashidharatd/fed-deployment

Automatic merge from submit-queue (batch tested with PRs 52630, 53110, 53136, 53075). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Simplify deployment in federation CI jobs

**What this PR does / why we need it**:
Introduce a new variable `USE_PV_FOR_ETCD` to control whether to use PV for federation etcd. `USE_PV_FOR_ETCD` is set to false by default and can be overridden in CI jobs where we want to test with PV. For most of the federation CI jobs, it does not matter whether we use PV for etcd or not. We can overcome some issues by not depending on PV's in federation setup like failure to bind to PV and leaking PD's. etc...
#50543 is one such issue associated with PV.

This PR also contain a commit to fix couple of minor issues and removing unnecessary include of cluster/common script.

**Release note**:
```release-note
NONE
```

/assign @madhusudancs 
/cc @kubernetes/sig-federation-pr-reviews
This commit is contained in:
Kubernetes Submit Queue 2017-09-27 12:58:16 -07:00 committed by GitHub
commit 655f443786
4 changed files with 12 additions and 16 deletions

View File

@ -17,14 +17,17 @@
: "${KUBE_ROOT?Must set KUBE_ROOT env var}" : "${KUBE_ROOT?Must set KUBE_ROOT env var}"
# Provides the $KUBERNETES_PROVIDER, kubeconfig-federation-context() # Provides the kubeconfig-federation-context() function
# and detect-project function
source "${KUBE_ROOT}/cluster/kube-util.sh" source "${KUBE_ROOT}/cluster/kube-util.sh"
# For `kube::log::status` function
source "${KUBE_ROOT}/cluster/lib/logging.sh"
# kubefed configuration # kubefed configuration
FEDERATION_NAME="${FEDERATION_NAME:-e2e-federation}" FEDERATION_NAME="${FEDERATION_NAME:-e2e-federation}"
FEDERATION_NAMESPACE=${FEDERATION_NAMESPACE:-federation-system} FEDERATION_NAMESPACE=${FEDERATION_NAMESPACE:-federation-system}
FEDERATION_KUBE_CONTEXT="${FEDERATION_KUBE_CONTEXT:-${FEDERATION_NAME}}" FEDERATION_KUBE_CONTEXT="${FEDERATION_KUBE_CONTEXT:-${FEDERATION_NAME}}"
FEDERATION_USE_PV_FOR_ETCD=${FEDERATION_USE_PV_FOR_ETCD:-false}
HOST_CLUSTER_ZONE="${FEDERATION_HOST_CLUSTER_ZONE:-}" HOST_CLUSTER_ZONE="${FEDERATION_HOST_CLUSTER_ZONE:-}"
# If $HOST_CLUSTER_ZONE isn't specified, arbitrarily choose # If $HOST_CLUSTER_ZONE isn't specified, arbitrarily choose
# last zone as the host cluster zone. # last zone as the host cluster zone.
@ -51,7 +54,7 @@ function federation_cluster_contexts() {
federation_contexts=() federation_contexts=()
for context in ${contexts}; do for context in ${contexts}; do
# Skip federation context # Skip federation context
if [[ "${context}" == "${FEDERATION_NAME}" ]]; then if [[ "${context}" == "${FEDERATION_KUBE_CONTEXT}" ]]; then
continue continue
fi fi
# Skip contexts not beginning with "federation" # Skip contexts not beginning with "federation"
@ -60,12 +63,10 @@ function federation_cluster_contexts() {
fi fi
federation_contexts+=("${context}") federation_contexts+=("${context}")
done done
echo ${federation_contexts[@]} echo ${federation_contexts[@]:-}
} }
source "${KUBE_ROOT}/cluster/common.sh"
host_kubectl="${KUBE_ROOT}/cluster/kubectl.sh --namespace=${FEDERATION_NAMESPACE}" host_kubectl="${KUBE_ROOT}/cluster/kubectl.sh --namespace=${FEDERATION_NAMESPACE}"
function cleanup-federation-api-objects { function cleanup-federation-api-objects {

View File

@ -26,11 +26,8 @@ set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../.. KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
# For `kube::log::status` function since it already sources
# "${KUBE_ROOT}/cluster/lib/logging.sh" and DEFAULT_KUBECONFIG
source "${KUBE_ROOT}/cluster/common.sh"
# For $FEDERATION_NAME, $FEDERATION_NAMESPACE, $FEDERATION_KUBE_CONTEXT, # For $FEDERATION_NAME, $FEDERATION_NAMESPACE, $FEDERATION_KUBE_CONTEXT,
# and $HOST_CLUSTER_CONTEXT. # $HOST_CLUSTER_CONTEXT and $FEDERATION_USE_PV_FOR_ETCD.
source "${KUBE_ROOT}/federation/cluster/common.sh" source "${KUBE_ROOT}/federation/cluster/common.sh"
DNS_ZONE_NAME="${FEDERATION_DNS_ZONE_NAME:-}" DNS_ZONE_NAME="${FEDERATION_DNS_ZONE_NAME:-}"
@ -118,6 +115,7 @@ function init() {
--apiserver-enable-token-auth=true \ --apiserver-enable-token-auth=true \
--apiserver-arg-overrides="--runtime-config=api/all=true,--v=4" \ --apiserver-arg-overrides="--runtime-config=api/all=true,--v=4" \
--controllermanager-arg-overrides="--v=4" \ --controllermanager-arg-overrides="--v=4" \
--etcd-persistent-storage=${FEDERATION_USE_PV_FOR_ETCD} \
--v=4 --v=4
} }

View File

@ -19,9 +19,6 @@ set -o nounset
set -o pipefail set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../.. KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
# For `kube::log::status` function since it already sources
# "${KUBE_ROOT}/cluster/lib/logging.sh"
source "${KUBE_ROOT}/cluster/common.sh"
# For $FEDERATION_NAME, $FEDERATION_NAMESPACE, $HOST_CLUSTER_CONTEXT, # For $FEDERATION_NAME, $FEDERATION_NAMESPACE, $HOST_CLUSTER_CONTEXT,
source "${KUBE_ROOT}/federation/cluster/common.sh" source "${KUBE_ROOT}/federation/cluster/common.sh"

View File

@ -340,16 +340,16 @@ func (i *initFederation) Run(cmdOut io.Writer, config util.AdminConfig) error {
} }
glog.V(4).Info("Credentials secret successfully created") glog.V(4).Info("Credentials secret successfully created")
glog.V(4).Info("Creating a persistent volume and a claim to store the federation API server's state, including etcd data")
var pvc *api.PersistentVolumeClaim var pvc *api.PersistentVolumeClaim
if i.options.etcdPersistentStorage { if i.options.etcdPersistentStorage {
glog.V(4).Info("Creating a persistent volume and a claim to store the federation API server's state, including etcd data")
pvc, err = createPVC(hostClientset, i.commonOptions.FederationSystemNamespace, svc.Name, i.commonOptions.Name, i.options.etcdPVCapacity, i.options.etcdPVStorageClass, i.options.dryRun) pvc, err = createPVC(hostClientset, i.commonOptions.FederationSystemNamespace, svc.Name, i.commonOptions.Name, i.options.etcdPVCapacity, i.options.etcdPVStorageClass, i.options.dryRun)
if err != nil { if err != nil {
return err return err
} }
}
glog.V(4).Info("Persistent volume and claim created") glog.V(4).Info("Persistent volume and claim created")
fmt.Fprintln(cmdOut, " done") fmt.Fprintln(cmdOut, " done")
}
// Since only one IP address can be specified as advertise address, // Since only one IP address can be specified as advertise address,
// we arbitrarily pick the first available IP address // we arbitrarily pick the first available IP address