mirror of https://github.com/k3s-io/k3s
Merge branch 'master' into fix-shellcheck-20190418
commit
b4bc5cb4fe
|
@ -359,10 +359,11 @@ aliases:
|
|||
# -
|
||||
# -
|
||||
|
||||
# sig-cli-api-reviewers:
|
||||
# -
|
||||
# -
|
||||
|
||||
sig-cli-api-reviewers:
|
||||
- pwittrock
|
||||
- soltysh
|
||||
|
||||
sig-cloud-provider-api-reviewers:
|
||||
- andrewsykim
|
||||
- cheftako
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
# This file creates a standard build environment for building cross
|
||||
# platform go binary for the architecture kubernetes cares about.
|
||||
|
||||
FROM golang:1.12.1
|
||||
FROM golang:1.12.4
|
||||
|
||||
ENV GOARM 7
|
||||
ENV KUBE_DYNAMIC_CROSSPLATFORMS \
|
||||
|
|
|
@ -1 +1 @@
|
|||
v1.12.1-2
|
||||
v1.12.4-1
|
||||
|
|
|
@ -21,8 +21,8 @@ http_archive(
|
|||
|
||||
http_archive(
|
||||
name = "io_bazel_rules_go",
|
||||
sha256 = "6433336b4c5feb54e2f45df4c1c84ea4385b2dc0b6f274ec2cd5d745045eae1f",
|
||||
urls = mirror("https://github.com/bazelbuild/rules_go/releases/download/0.17.2/rules_go-0.17.2.tar.gz"),
|
||||
sha256 = "91b79f4758fd16f2c6426279ce00c1d2d8577d61c519db39675ed84657e1a95e",
|
||||
urls = mirror("https://github.com/bazelbuild/rules_go/releases/download/0.17.4/rules_go-0.17.4.tar.gz"),
|
||||
)
|
||||
|
||||
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
|
||||
|
@ -30,7 +30,7 @@ load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_depe
|
|||
go_rules_dependencies()
|
||||
|
||||
go_register_toolchains(
|
||||
go_version = "1.12.1",
|
||||
go_version = "1.12.4",
|
||||
)
|
||||
|
||||
http_archive(
|
||||
|
|
|
@ -18,7 +18,7 @@ set -o errexit
|
|||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=${KUBE_ROOT:-$(dirname "${BASH_SOURCE}")/..}
|
||||
KUBE_ROOT=${KUBE_ROOT:-$(dirname "${BASH_SOURCE[0]}")/..}
|
||||
|
||||
# Detect the OS name/arch so that we can find our binary
|
||||
case "$(uname -s)" in
|
||||
|
|
|
@ -20,7 +20,7 @@ set -o errexit
|
|||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(cd $(dirname "${BASH_SOURCE}")/.. && pwd)
|
||||
KUBE_ROOT=$(cd $(dirname "${BASH_SOURCE[0]}")/.. && pwd)
|
||||
|
||||
DEFAULT_KUBECONFIG="${HOME:-.}/.kube/config"
|
||||
|
||||
|
|
|
@ -39,29 +39,30 @@ ACI_DIR=${STAGING_DIR}/gci-mounter
|
|||
CWD=${PWD}
|
||||
|
||||
# Cleanup the temporary directories
|
||||
function cleanup {
|
||||
rm -rf ${DOWNLOAD_DIR}
|
||||
rm -rf ${STAGING_DIR}
|
||||
cd ${CWD}
|
||||
cleanup() {
|
||||
rm -rf "${DOWNLOAD_DIR}"
|
||||
rm -rf "${STAGING_DIR}"
|
||||
cd "${CWD}"
|
||||
}
|
||||
|
||||
# Delete temporary directories on exit
|
||||
trap cleanup EXIT
|
||||
|
||||
mkdir ${ACI_DIR}
|
||||
mkdir "${ACI_DIR}"
|
||||
|
||||
# Convert docker image to aci and stage it
|
||||
echo "Downloading docker2aci ${DOCKER2ACI_VERSION}"
|
||||
wget "https://github.com/appc/docker2aci/releases/download/${DOCKER2ACI_VERSION}/docker2aci-${DOCKER2ACI_VERSION}.tar.gz" &> /dev/null
|
||||
wget "https://github.com/appc/docker2aci/releases/download/${DOCKER2ACI_VERSION}/docker2aci-${DOCKER2ACI_VERSION}.tar.gz" >/dev/null 2>&1
|
||||
echo "Extracting docker2aci ${DOCKER2ACI_VERSION}"
|
||||
tar xzf docker2aci-${DOCKER2ACI_VERSION}.tar.gz
|
||||
ACI_IMAGE=$(${DOWNLOAD_DIR}/docker2aci-${DOCKER2ACI_VERSION}/docker2aci ${DOCKER_IMAGE} 2>/dev/null | tail -n 1)
|
||||
cp ${ACI_IMAGE} ${ACI_DIR}/${MOUNTER_ACI_IMAGE}
|
||||
ACI_IMAGE=$("${DOWNLOAD_DIR}/docker2aci-${DOCKER2ACI_VERSION}/docker2aci" "${DOCKER_IMAGE}" 2>/dev/null | tail -n 1)
|
||||
cp "${ACI_IMAGE}" "${ACI_DIR}/${MOUNTER_ACI_IMAGE}"
|
||||
|
||||
# Upload the contents to gcs
|
||||
echo "Uploading gci mounter ACI in ${ACI_DIR} to ${MOUNTER_GCS_DIR}"
|
||||
gsutil cp ${ACI_DIR}/${MOUNTER_ACI_IMAGE} ${MOUNTER_GCS_DIR}
|
||||
gsutil cp "${ACI_DIR}/${MOUNTER_ACI_IMAGE}" "${MOUNTER_GCS_DIR}"
|
||||
|
||||
echo "Upload completed"
|
||||
echo "Updated gci-mounter ACI version and SHA1 in cluster/gce/gci/configure.sh"
|
||||
echo "${MOUNTER_ACI_IMAGE} hash: $(sha1sum ${ACI_DIR}/${MOUNTER_ACI_IMAGE})"
|
||||
ACI_HASH=$(sha1sum "${ACI_DIR}/${MOUNTER_ACI_IMAGE}")
|
||||
echo "${MOUNTER_ACI_IMAGE} hash: ${ACI_HASH}"
|
||||
|
|
|
@ -63,7 +63,7 @@ readonly max_dump_processes=25
|
|||
|
||||
# TODO: Get rid of all the sourcing of bash dependencies eventually.
|
||||
function setup() {
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/../..
|
||||
if [[ -z "${use_custom_instance_list}" ]]; then
|
||||
: ${KUBE_CONFIG_FILE:="config-test.sh"}
|
||||
echo "Sourcing kube-util.sh"
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# pre-existing Kubernetes master. See test/kubemark/pre-existing/README.md
|
||||
# for me details on using a pre-existing provider.
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/../..
|
||||
|
||||
source "${KUBE_ROOT}/cluster/common.sh"
|
||||
source "${KUBE_ROOT}/hack/lib/util.sh"
|
||||
|
|
|
@ -21,7 +21,7 @@ set -o errexit
|
|||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
source "${KUBE_ROOT}/cluster/kube-util.sh"
|
||||
|
||||
echo "Testing cluster with provider: ${KUBERNETES_PROVIDER}" 1>&2
|
||||
|
|
|
@ -24,7 +24,6 @@ set -o errexit
|
|||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
KUBE_CONFIG_FILE="config-default.sh"
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
|
||||
${KUBE_ROOT}/hack/ginkgo-e2e.sh --ginkgo.focus=Networking
|
||||
"${KUBE_ROOT}/hack/ginkgo-e2e.sh" --ginkgo.focus=Networking
|
||||
|
|
|
@ -23,10 +23,8 @@ set -o errexit
|
|||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
|
||||
TEST_ARGS="$@"
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
|
||||
SMOKE_TEST_FOCUS_REGEX="Guestbook.application"
|
||||
|
||||
exec "${KUBE_ROOT}/cluster/test-e2e.sh" -ginkgo.focus="${SMOKE_TEST_FOCUS_REGEX}" ${TEST_ARGS}
|
||||
exec "${KUBE_ROOT}/cluster/test-e2e.sh" -ginkgo.focus="${SMOKE_TEST_FOCUS_REGEX}" "$@"
|
||||
|
|
|
@ -24,7 +24,7 @@ set -o errexit
|
|||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
|
||||
if [ -f "${KUBE_ROOT}/cluster/env.sh" ]; then
|
||||
source "${KUBE_ROOT}/cluster/env.sh"
|
||||
|
|
|
@ -24,6 +24,7 @@ import (
|
|||
kubeadmapiv1beta1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta1"
|
||||
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/options"
|
||||
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
|
||||
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
||||
certsphase "k8s.io/kubernetes/cmd/kubeadm/app/phases/certs"
|
||||
"k8s.io/kubernetes/cmd/kubeadm/app/phases/certs/renewal"
|
||||
kubeadmutil "k8s.io/kubernetes/cmd/kubeadm/app/util"
|
||||
|
@ -145,11 +146,30 @@ func generateRenewalFunction(cert *certsphase.KubeadmCert, caCert *certsphase.Ku
|
|||
return
|
||||
}
|
||||
|
||||
renewer, err := getRenewer(cfg, caCert.BaseName)
|
||||
kubeadmutil.CheckErr(err)
|
||||
var externalCA bool
|
||||
switch caCert.BaseName {
|
||||
case kubeadmconstants.CACertAndKeyBaseName:
|
||||
// Check if an external CA is provided by the user (when the CA Cert is present but the CA Key is not)
|
||||
externalCA, _ = certsphase.UsingExternalCA(&internalcfg.ClusterConfiguration)
|
||||
case kubeadmconstants.FrontProxyCACertAndKeyBaseName:
|
||||
// Check if an external Front-Proxy CA is provided by the user (when the Front-Proxy CA Cert is present but the Front-Proxy CA Key is not)
|
||||
externalCA, _ = certsphase.UsingExternalFrontProxyCA(&internalcfg.ClusterConfiguration)
|
||||
default:
|
||||
externalCA = false
|
||||
}
|
||||
|
||||
err = renewal.RenewExistingCert(internalcfg.CertificatesDir, cert.BaseName, renewer)
|
||||
kubeadmutil.CheckErr(err)
|
||||
if !externalCA {
|
||||
renewer, err := getRenewer(cfg, caCert.BaseName)
|
||||
kubeadmutil.CheckErr(err)
|
||||
|
||||
err = renewal.RenewExistingCert(internalcfg.CertificatesDir, cert.BaseName, renewer)
|
||||
kubeadmutil.CheckErr(err)
|
||||
|
||||
fmt.Printf("Certificate %s renewed\n", cert.Name)
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Printf("Detected external %s, certificate %s can't be renewed\n", cert.CAName, cert.Name)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,5 +45,8 @@ go_test(
|
|||
name = "go_default_test",
|
||||
srcs = ["token_test.go"],
|
||||
embed = [":go_default_library"],
|
||||
deps = ["//staging/src/k8s.io/client-go/tools/clientcmd/api:go_default_library"],
|
||||
deps = [
|
||||
"//staging/src/k8s.io/client-go/tools/clientcmd/api:go_default_library",
|
||||
"//vendor/github.com/pkg/errors:go_default_library",
|
||||
],
|
||||
)
|
||||
|
|
|
@ -17,10 +17,11 @@ limitations under the License.
|
|||
package token
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
|
||||
)
|
||||
|
||||
|
@ -71,7 +72,7 @@ func TestFetchKubeConfigWithTimeout(t *testing.T) {
|
|||
t.Run(test.name, func(t *testing.T) {
|
||||
cfg, err := fetchKubeConfigWithTimeout(testAPIEndpoint, test.discoveryTimeout, func(apiEndpoint string) (*clientcmdapi.Config, error) {
|
||||
if apiEndpoint != testAPIEndpoint {
|
||||
return nil, fmt.Errorf("unexpected API server endpoint:\n\texpected: %q\n\tgot: %q", testAPIEndpoint, apiEndpoint)
|
||||
return nil, errors.Errorf("unexpected API server endpoint:\n\texpected: %q\n\tgot: %q", testAPIEndpoint, apiEndpoint)
|
||||
}
|
||||
|
||||
time.Sleep(3 * time.Second)
|
||||
|
|
|
@ -59,21 +59,6 @@ type kubeConfigSpec struct {
|
|||
ClientCertAuth *clientCertAuth
|
||||
}
|
||||
|
||||
// CreateInitKubeConfigFiles will create and write to disk all kubeconfig files necessary in the kubeadm init phase
|
||||
// to establish the control plane, including also the admin kubeconfig file.
|
||||
// If kubeconfig files already exists, they are used only if evaluated equal; otherwise an error is returned.
|
||||
func CreateInitKubeConfigFiles(outDir string, cfg *kubeadmapi.InitConfiguration) error {
|
||||
klog.V(1).Infoln("creating all kubeconfig files")
|
||||
return createKubeConfigFiles(
|
||||
outDir,
|
||||
cfg,
|
||||
kubeadmconstants.AdminKubeConfigFileName,
|
||||
kubeadmconstants.KubeletKubeConfigFileName,
|
||||
kubeadmconstants.ControllerManagerKubeConfigFileName,
|
||||
kubeadmconstants.SchedulerKubeConfigFileName,
|
||||
)
|
||||
}
|
||||
|
||||
// CreateJoinControlPlaneKubeConfigFiles will create and write to disk the kubeconfig files required by kubeadm
|
||||
// join --control-plane workflow, plus the admin kubeconfig file used by the administrator and kubeadm itself; the
|
||||
// kubelet.conf file must not be created because it will be created and signed by the kubelet TLS bootstrap process.
|
||||
|
|
|
@ -289,16 +289,6 @@ func TestCreateKubeconfigFilesAndWrappers(t *testing.T) {
|
|||
},
|
||||
expectedError: true,
|
||||
},
|
||||
{ // Test CreateInitKubeConfigFiles (wrapper to createKubeConfigFile)
|
||||
name: "CreateInitKubeConfigFiles",
|
||||
createKubeConfigFunction: CreateInitKubeConfigFiles,
|
||||
expectedFiles: []string{
|
||||
kubeadmconstants.AdminKubeConfigFileName,
|
||||
kubeadmconstants.KubeletKubeConfigFileName,
|
||||
kubeadmconstants.ControllerManagerKubeConfigFileName,
|
||||
kubeadmconstants.SchedulerKubeConfigFileName,
|
||||
},
|
||||
},
|
||||
{ // Test CreateJoinControlPlaneKubeConfigFiles (wrapper to createKubeConfigFile)
|
||||
name: "CreateJoinControlPlaneKubeConfigFiles",
|
||||
createKubeConfigFunction: CreateJoinControlPlaneKubeConfigFiles,
|
||||
|
|
|
@ -1088,10 +1088,6 @@ func RunPullImagesCheck(execer utilsexec.Interface, cfg *kubeadmapi.InitConfigur
|
|||
// RunChecks runs each check, displays it's warnings/errors, and once all
|
||||
// are processed will exit if any errors occurred.
|
||||
func RunChecks(checks []Checker, ww io.Writer, ignorePreflightErrors sets.String) error {
|
||||
type checkErrors struct {
|
||||
Name string
|
||||
Errors []error
|
||||
}
|
||||
var errsBuffer bytes.Buffer
|
||||
|
||||
for _, c := range checks {
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
./cluster/gce/gci/flexvolume_node_setup.sh
|
||||
./cluster/gce/gci/health-monitor.sh
|
||||
./cluster/gce/gci/master-helper.sh
|
||||
./cluster/gce/gci/mounter/stage-upload.sh
|
||||
./cluster/gce/gci/shutdown.sh
|
||||
./cluster/gce/list-resources.sh
|
||||
./cluster/gce/upgrade-aliases.sh
|
||||
|
@ -21,10 +20,7 @@
|
|||
./cluster/pre-existing/util.sh
|
||||
./cluster/restore-from-backup.sh
|
||||
./cluster/test-e2e.sh
|
||||
./cluster/test-network.sh
|
||||
./cluster/test-smoke.sh
|
||||
./cluster/validate-cluster.sh
|
||||
./hack/cherry_pick_pull.sh
|
||||
./hack/ginkgo-e2e.sh
|
||||
./hack/grab-profiles.sh
|
||||
./hack/lib/init.sh
|
||||
|
@ -47,7 +43,6 @@
|
|||
./hack/verify-codegen.sh
|
||||
./hack/verify-golint.sh
|
||||
./hack/verify-no-vendor-cycles.sh
|
||||
./hack/verify-readonly-packages.sh
|
||||
./hack/verify-test-featuregates.sh
|
||||
./test/cmd/apply.sh
|
||||
./test/cmd/apps.sh
|
||||
|
|
|
@ -84,8 +84,10 @@ shift 1
|
|||
declare -r PULLS=( "$@" )
|
||||
|
||||
function join { local IFS="$1"; shift; echo "$*"; }
|
||||
declare -r PULLDASH=$(join - "${PULLS[@]/#/#}") # Generates something like "#12345-#56789"
|
||||
declare -r PULLSUBJ=$(join " " "${PULLS[@]/#/#}") # Generates something like "#12345 #56789"
|
||||
PULLDASH=$(join - "${PULLS[@]/#/#}") # Generates something like "#12345-#56789"
|
||||
declare -r PULLDASH
|
||||
PULLSUBJ=$(join " " "${PULLS[@]/#/#}") # Generates something like "#12345 #56789"
|
||||
declare -r PULLSUBJ
|
||||
|
||||
echo "+++ Updating remotes..."
|
||||
git remote update "${UPSTREAM_REMOTE}" "${FORK_REMOTE}"
|
||||
|
@ -96,9 +98,12 @@ if ! git log -n1 --format=%H "${BRANCH}" >/dev/null 2>&1; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
declare -r NEWBRANCHREQ="automated-cherry-pick-of-${PULLDASH}" # "Required" portion for tools.
|
||||
declare -r NEWBRANCH="$(echo "${NEWBRANCHREQ}-${BRANCH}" | sed 's/\//-/g')"
|
||||
declare -r NEWBRANCHUNIQ="${NEWBRANCH}-$(date +%s)"
|
||||
NEWBRANCHREQ="automated-cherry-pick-of-${PULLDASH}" # "Required" portion for tools.
|
||||
declare -r NEWBRANCHREQ
|
||||
NEWBRANCH="$(echo "${NEWBRANCHREQ}-${BRANCH}" | sed 's/\//-/g')"
|
||||
declare -r NEWBRANCH
|
||||
NEWBRANCHUNIQ="${NEWBRANCH}-$(date +%s)"
|
||||
declare -r NEWBRANCHUNIQ
|
||||
echo "+++ Creating local branch ${NEWBRANCHUNIQ}"
|
||||
|
||||
cleanbranch=""
|
||||
|
@ -128,7 +133,8 @@ trap return_to_kansas EXIT
|
|||
|
||||
SUBJECTS=()
|
||||
function make-a-pr() {
|
||||
local rel="$(basename "${BRANCH}")"
|
||||
local rel
|
||||
rel="$(basename "${BRANCH}")"
|
||||
echo
|
||||
echo "+++ Creating a pull request on GitHub at ${GITHUB_USER}:${NEWBRANCH}"
|
||||
|
||||
|
@ -137,7 +143,8 @@ function make-a-pr() {
|
|||
# when we shove the heredoc at hub directly, tickling the ioctl
|
||||
# crash.
|
||||
prtext="$(mktemp -t prtext.XXXX)" # cleaned in return_to_kansas
|
||||
local numandtitle=$(printf '%s\n' "${SUBJECTS[@]}")
|
||||
local numandtitle
|
||||
numandtitle=$(printf '%s\n' "${SUBJECTS[@]}")
|
||||
cat >"${prtext}" <<EOF
|
||||
Automated cherry pick of ${numandtitle}
|
||||
|
||||
|
@ -218,7 +225,7 @@ if [[ -n "${DRY_RUN}" ]]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
if git remote -v | grep ^${FORK_REMOTE} | grep ${MAIN_REPO_ORG}/${MAIN_REPO_NAME}.git; then
|
||||
if git remote -v | grep ^"${FORK_REMOTE}" | grep "${MAIN_REPO_ORG}/${MAIN_REPO_NAME}.git"; then
|
||||
echo "!!! You have ${FORK_REMOTE} configured as your ${MAIN_REPO_ORG}/${MAIN_REPO_NAME}.git"
|
||||
echo "This isn't normal. Leaving you with push instructions:"
|
||||
echo
|
||||
|
|
|
@ -112,9 +112,9 @@ kube::etcd::install() {
|
|||
|
||||
cd "${KUBE_ROOT}/third_party" || return 1
|
||||
if [[ $(readlink etcd) == etcd-v${ETCD_VERSION}-${os}-* ]]; then
|
||||
kube::log::info "etcd v${ETCD_VERSION} already installed at path:"
|
||||
kube::log::info "$(pwd)/$(readlink etcd)"
|
||||
return # already installed
|
||||
kube::log::info "etcd v${ETCD_VERSION} already installed. To use:"
|
||||
kube::log::info "export PATH=\"$(pwd)/etcd:\${PATH}\""
|
||||
return #already installed
|
||||
fi
|
||||
|
||||
if [[ ${os} == "darwin" ]]; then
|
||||
|
@ -133,6 +133,6 @@ kube::etcd::install() {
|
|||
rm "${download_file}"
|
||||
fi
|
||||
kube::log::info "etcd v${ETCD_VERSION} installed. To use:"
|
||||
kube::log::info "export PATH=$(pwd)/etcd:\${PATH}"
|
||||
kube::log::info "export PATH=\"$(pwd)/etcd:\${PATH}\""
|
||||
)
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ set -o errexit
|
|||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
|
||||
readonly branch=${1:-${KUBE_VERIFY_GIT_BRANCH:-master}}
|
||||
|
@ -43,14 +43,13 @@ find_files() {
|
|||
\) -name '.readonly'
|
||||
}
|
||||
|
||||
IFS=$'\n'
|
||||
conflicts=($(find_files | sed 's|/.readonly||' | while read dir; do
|
||||
conflicts=()
|
||||
while IFS=$'\n' read -r dir; do
|
||||
dir=${dir#./}
|
||||
if kube::util::has_changes "${branch}" "^${dir}/[^/]*\$" '/\.readonly$|/BUILD$|/zz_generated|/\.generated\.|\.proto$|\.pb\.go$' >/dev/null; then
|
||||
echo "${dir}"
|
||||
conflicts+=("${dir}")
|
||||
fi
|
||||
done))
|
||||
unset IFS
|
||||
done < <(find_files | sed 's|/.readonly||')
|
||||
|
||||
if [ ${#conflicts[@]} -gt 0 ]; then
|
||||
exec 1>&2
|
||||
|
|
|
@ -268,9 +268,3 @@ func collectSecretPaths(t *testing.T, path *field.Path, name string, tp reflect.
|
|||
|
||||
return secretPaths
|
||||
}
|
||||
|
||||
func newHostPathType(pathType string) *corev1.HostPathType {
|
||||
hostPathType := new(corev1.HostPathType)
|
||||
*hostPathType = corev1.HostPathType(pathType)
|
||||
return hostPathType
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@ limitations under the License.
|
|||
package validation
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
|
@ -68,12 +67,6 @@ func getValidPodTemplateSpecForGenerated(selector *metav1.LabelSelector) api.Pod
|
|||
}
|
||||
}
|
||||
|
||||
func featureToggle(feature utilfeature.Feature) []string {
|
||||
enabled := fmt.Sprintf("%s=%t", feature, true)
|
||||
disabled := fmt.Sprintf("%s=%t", feature, false)
|
||||
return []string{enabled, disabled}
|
||||
}
|
||||
|
||||
func TestValidateJob(t *testing.T) {
|
||||
validManualSelector := getValidManualSelector()
|
||||
validPodTemplateSpecForManual := getValidPodTemplateSpecForManual(validManualSelector)
|
||||
|
|
|
@ -18,13 +18,8 @@ package v1beta1
|
|||
|
||||
import (
|
||||
policyv1beta1 "k8s.io/api/policy/v1beta1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
func addDefaultingFuncs(scheme *runtime.Scheme) error {
|
||||
return RegisterDefaults(scheme)
|
||||
}
|
||||
|
||||
func SetDefaults_PodSecurityPolicySpec(obj *policyv1beta1.PodSecurityPolicySpec) {
|
||||
// This field was added after PodSecurityPolicy was released.
|
||||
// Policies that do not include this field must remain as permissive as they were prior to the introduction of this field.
|
||||
|
|
|
@ -568,16 +568,6 @@ func extractResourceGroupByNicID(nicID string) (string, error) {
|
|||
return matches[1], nil
|
||||
}
|
||||
|
||||
// extractResourceGroupByPipID extracts the resource group name by publicIP ID.
|
||||
func extractResourceGroupByPipID(pipID string) (string, error) {
|
||||
matches := publicIPResourceGroupRE.FindStringSubmatch(pipID)
|
||||
if len(matches) != 2 {
|
||||
return "", fmt.Errorf("error of extracting resourceGroup from pipID %q", pipID)
|
||||
}
|
||||
|
||||
return matches[1], nil
|
||||
}
|
||||
|
||||
// getPrimaryInterfaceWithVMSet gets machine primary network interface by node name and vmSet.
|
||||
func (as *availabilitySet) getPrimaryInterfaceWithVMSet(nodeName, vmSetName string) (network.Interface, error) {
|
||||
var machine compute.VirtualMachine
|
||||
|
|
|
@ -81,11 +81,6 @@ const (
|
|||
gceComputeAPIEndpointBeta = "https://www.googleapis.com/compute/beta/"
|
||||
)
|
||||
|
||||
// gceObject is an abstraction of all GCE API object in go client
|
||||
type gceObject interface {
|
||||
MarshalJSON() ([]byte, error)
|
||||
}
|
||||
|
||||
var _ cloudprovider.Interface = (*Cloud)(nil)
|
||||
var _ cloudprovider.Instances = (*Cloud)(nil)
|
||||
var _ cloudprovider.LoadBalancer = (*Cloud)(nil)
|
||||
|
|
|
@ -244,10 +244,6 @@ func makeGoogleAPINotFoundError(message string) error {
|
|||
return &googleapi.Error{Code: http.StatusNotFound, Message: message}
|
||||
}
|
||||
|
||||
func makeGoogleAPIError(code int, message string) error {
|
||||
return &googleapi.Error{Code: code, Message: message}
|
||||
}
|
||||
|
||||
// TODO(#51665): Remove this once Network Tiers becomes Beta in GCP.
|
||||
func handleAlphaNetworkTierGetError(err error) (string, error) {
|
||||
if isForbidden(err) {
|
||||
|
|
|
@ -85,8 +85,6 @@ type LbaasV2 struct {
|
|||
LoadBalancer
|
||||
}
|
||||
|
||||
type empty struct{}
|
||||
|
||||
func networkExtensions(client *gophercloud.ServiceClient) (map[string]bool, error) {
|
||||
seen := make(map[string]bool)
|
||||
|
||||
|
|
|
@ -389,22 +389,6 @@ func TestCPUEmptyMetricsForOnePod(t *testing.T) {
|
|||
tc.runTest(t)
|
||||
}
|
||||
|
||||
func testCollapseTimeSamples(t *testing.T) {
|
||||
now := time.Now()
|
||||
metrics := heapster.MetricResult{
|
||||
Metrics: []heapster.MetricPoint{
|
||||
{Timestamp: now, Value: 50, FloatValue: nil},
|
||||
{Timestamp: now.Add(-15 * time.Second), Value: 100, FloatValue: nil},
|
||||
{Timestamp: now.Add(-60 * time.Second), Value: 100000, FloatValue: nil}},
|
||||
LatestTimestamp: now,
|
||||
}
|
||||
|
||||
val, timestamp, hadMetrics := collapseTimeSamples(metrics, time.Minute)
|
||||
assert.True(t, hadMetrics, "should report that it received a populated list of metrics")
|
||||
assert.InEpsilon(t, float64(75), val, 0.1, "collapsed sample value should be as expected")
|
||||
assert.True(t, timestamp.Equal(now), "timestamp should be the current time (the newest)")
|
||||
}
|
||||
|
||||
func offsetTimestampBy(t int) time.Time {
|
||||
return fixedTimestamp.Add(time.Duration(t) * time.Minute)
|
||||
}
|
||||
|
|
|
@ -702,16 +702,6 @@ func (e *TokensController) listTokenSecrets(serviceAccount *v1.ServiceAccount) (
|
|||
return items, nil
|
||||
}
|
||||
|
||||
// serviceAccountNameAndUID is a helper method to get the ServiceAccount Name and UID from the given secret
|
||||
// Returns "","" if the secret is not a ServiceAccountToken secret
|
||||
// If the name or uid annotation is missing, "" is returned instead
|
||||
func serviceAccountNameAndUID(secret *v1.Secret) (string, string) {
|
||||
if secret.Type != v1.SecretTypeServiceAccountToken {
|
||||
return "", ""
|
||||
}
|
||||
return secret.Annotations[v1.ServiceAccountNameKey], secret.Annotations[v1.ServiceAccountUIDKey]
|
||||
}
|
||||
|
||||
func getSecretReferences(serviceAccount *v1.ServiceAccount) sets.String {
|
||||
references := sets.NewString()
|
||||
for _, secret := range serviceAccount.Secrets {
|
||||
|
|
|
@ -234,14 +234,6 @@ func TestControllerCacheParsingError(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func addVolumeAnnotation(volume *v1.PersistentVolume, annName, annValue string) *v1.PersistentVolume {
|
||||
if volume.Annotations == nil {
|
||||
volume.Annotations = make(map[string]string)
|
||||
}
|
||||
volume.Annotations[annName] = annValue
|
||||
return volume
|
||||
}
|
||||
|
||||
func makePVCClass(scName *string, hasSelectNodeAnno bool) *v1.PersistentVolumeClaim {
|
||||
claim := &v1.PersistentVolumeClaim{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
|
|
|
@ -160,26 +160,26 @@ func (b *volumeBinder) FindPodVolumes(pod *v1.Pod, node *v1.Node) (unboundVolume
|
|||
}()
|
||||
|
||||
var (
|
||||
matchedClaims []*bindingInfo
|
||||
matchedBindings []*bindingInfo
|
||||
provisionedClaims []*v1.PersistentVolumeClaim
|
||||
)
|
||||
defer func() {
|
||||
// We recreate bindings for each new schedule loop.
|
||||
if len(matchedClaims) == 0 && len(provisionedClaims) == 0 {
|
||||
if len(matchedBindings) == 0 && len(provisionedClaims) == 0 {
|
||||
// Clear cache if no claims to bind or provision for this node.
|
||||
b.podBindingCache.ClearBindings(pod, node.Name)
|
||||
return
|
||||
}
|
||||
// Although we do not distinguish nil from empty in this function, for
|
||||
// easier testing, we normalize empty to nil.
|
||||
if len(matchedClaims) == 0 {
|
||||
matchedClaims = nil
|
||||
if len(matchedBindings) == 0 {
|
||||
matchedBindings = nil
|
||||
}
|
||||
if len(provisionedClaims) == 0 {
|
||||
provisionedClaims = nil
|
||||
}
|
||||
// Mark cache with all matched and provisioned claims for this node
|
||||
b.podBindingCache.UpdateBindings(pod, node.Name, matchedClaims, provisionedClaims)
|
||||
b.podBindingCache.UpdateBindings(pod, node.Name, matchedBindings, provisionedClaims)
|
||||
}()
|
||||
|
||||
// The pod's volumes need to be processed in one call to avoid the race condition where
|
||||
|
@ -225,7 +225,7 @@ func (b *volumeBinder) FindPodVolumes(pod *v1.Pod, node *v1.Node) (unboundVolume
|
|||
// Find matching volumes
|
||||
if len(claimsToFindMatching) > 0 {
|
||||
var unboundClaims []*v1.PersistentVolumeClaim
|
||||
unboundVolumesSatisfied, matchedClaims, unboundClaims, err = b.findMatchingVolumes(pod, claimsToFindMatching, node)
|
||||
unboundVolumesSatisfied, matchedBindings, unboundClaims, err = b.findMatchingVolumes(pod, claimsToFindMatching, node)
|
||||
if err != nil {
|
||||
return false, false, err
|
||||
}
|
||||
|
@ -598,10 +598,10 @@ func (b *volumeBinder) arePodVolumesBound(pod *v1.Pod) bool {
|
|||
|
||||
// getPodVolumes returns a pod's PVCs separated into bound, unbound with delayed binding (including provisioning)
|
||||
// and unbound with immediate binding (including prebound)
|
||||
func (b *volumeBinder) getPodVolumes(pod *v1.Pod) (boundClaims []*v1.PersistentVolumeClaim, unboundClaims []*v1.PersistentVolumeClaim, unboundClaimsImmediate []*v1.PersistentVolumeClaim, err error) {
|
||||
func (b *volumeBinder) getPodVolumes(pod *v1.Pod) (boundClaims []*v1.PersistentVolumeClaim, unboundClaimsDelayBinding []*v1.PersistentVolumeClaim, unboundClaimsImmediate []*v1.PersistentVolumeClaim, err error) {
|
||||
boundClaims = []*v1.PersistentVolumeClaim{}
|
||||
unboundClaimsImmediate = []*v1.PersistentVolumeClaim{}
|
||||
unboundClaims = []*v1.PersistentVolumeClaim{}
|
||||
unboundClaimsDelayBinding = []*v1.PersistentVolumeClaim{}
|
||||
|
||||
for _, vol := range pod.Spec.Volumes {
|
||||
volumeBound, pvc, err := b.isVolumeBound(pod.Namespace, &vol)
|
||||
|
@ -621,7 +621,7 @@ func (b *volumeBinder) getPodVolumes(pod *v1.Pod) (boundClaims []*v1.PersistentV
|
|||
// Prebound PVCs are treated as unbound immediate binding
|
||||
if delayBindingMode && pvc.Spec.VolumeName == "" {
|
||||
// Scheduler path
|
||||
unboundClaims = append(unboundClaims, pvc)
|
||||
unboundClaimsDelayBinding = append(unboundClaimsDelayBinding, pvc)
|
||||
} else {
|
||||
// !delayBindingMode || pvc.Spec.VolumeName != ""
|
||||
// Immediate binding should have already been bound
|
||||
|
@ -629,7 +629,7 @@ func (b *volumeBinder) getPodVolumes(pod *v1.Pod) (boundClaims []*v1.PersistentV
|
|||
}
|
||||
}
|
||||
}
|
||||
return boundClaims, unboundClaims, unboundClaimsImmediate, nil
|
||||
return boundClaims, unboundClaimsDelayBinding, unboundClaimsImmediate, nil
|
||||
}
|
||||
|
||||
func (b *volumeBinder) checkBoundClaims(claims []*v1.PersistentVolumeClaim, node *v1.Node, podName string) (bool, error) {
|
||||
|
@ -654,7 +654,7 @@ func (b *volumeBinder) checkBoundClaims(claims []*v1.PersistentVolumeClaim, node
|
|||
|
||||
// findMatchingVolumes tries to find matching volumes for given claims,
|
||||
// and return unbound claims for further provision.
|
||||
func (b *volumeBinder) findMatchingVolumes(pod *v1.Pod, claimsToBind []*v1.PersistentVolumeClaim, node *v1.Node) (foundMatches bool, matchedClaims []*bindingInfo, unboundClaims []*v1.PersistentVolumeClaim, err error) {
|
||||
func (b *volumeBinder) findMatchingVolumes(pod *v1.Pod, claimsToBind []*v1.PersistentVolumeClaim, node *v1.Node) (foundMatches bool, bindings []*bindingInfo, unboundClaims []*v1.PersistentVolumeClaim, err error) {
|
||||
podName := getPodName(pod)
|
||||
// Sort all the claims by increasing size request to get the smallest fits
|
||||
sort.Sort(byPVCSize(claimsToBind))
|
||||
|
@ -662,7 +662,6 @@ func (b *volumeBinder) findMatchingVolumes(pod *v1.Pod, claimsToBind []*v1.Persi
|
|||
chosenPVs := map[string]*v1.PersistentVolume{}
|
||||
|
||||
foundMatches = true
|
||||
matchedClaims = []*bindingInfo{}
|
||||
|
||||
for _, pvc := range claimsToBind {
|
||||
// Get storage class name from each PVC
|
||||
|
@ -688,7 +687,7 @@ func (b *volumeBinder) findMatchingVolumes(pod *v1.Pod, claimsToBind []*v1.Persi
|
|||
|
||||
// matching PV needs to be excluded so we don't select it again
|
||||
chosenPVs[pv.Name] = pv
|
||||
matchedClaims = append(matchedClaims, &bindingInfo{pv: pv, pvc: pvc})
|
||||
bindings = append(bindings, &bindingInfo{pv: pv, pvc: pvc})
|
||||
klog.V(5).Infof("Found matching PV %q for PVC %q on node %q for pod %q", pv.Name, pvcName, node.Name, podName)
|
||||
}
|
||||
|
||||
|
|
|
@ -63,16 +63,6 @@ type authDirective struct {
|
|||
realm string
|
||||
}
|
||||
|
||||
type accessTokenPayload struct {
|
||||
TenantID string `json:"tid"`
|
||||
}
|
||||
|
||||
type acrTokenPayload struct {
|
||||
Expiration int64 `json:"exp"`
|
||||
TenantID string `json:"tenant"`
|
||||
Credential string `json:"credential"`
|
||||
}
|
||||
|
||||
type acrAuthResponse struct {
|
||||
RefreshToken string `json:"refresh_token"`
|
||||
}
|
||||
|
|
|
@ -151,8 +151,6 @@ func (mk MergeKeys) GetMergeKeyValue(i interface{}) (MergeKeyValue, error) {
|
|||
return result, nil
|
||||
}
|
||||
|
||||
type source int
|
||||
|
||||
// CombinedPrimitiveSlice implements a slice of primitives
|
||||
type CombinedPrimitiveSlice struct {
|
||||
Items []*PrimitiveListItem
|
||||
|
|
|
@ -28,7 +28,6 @@ go_library(
|
|||
"//pkg/kubectl/util/templates:go_default_library",
|
||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||
"//staging/src/k8s.io/api/rbac/v1:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/api/meta:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||
|
|
|
@ -17,17 +17,13 @@ limitations under the License.
|
|||
package set
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
|
||||
"k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
"k8s.io/apimachinery/pkg/util/strategicpatch"
|
||||
"k8s.io/cli-runtime/pkg/resource"
|
||||
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
|
||||
)
|
||||
|
||||
// selectContainers allows one or more containers to be matched against a string or wildcard
|
||||
|
@ -44,33 +40,6 @@ func selectContainers(containers []v1.Container, spec string) ([]*v1.Container,
|
|||
return out, skipped
|
||||
}
|
||||
|
||||
// handlePodUpdateError prints a more useful error to the end user when mutating a pod.
|
||||
func handlePodUpdateError(out io.Writer, err error, resource string) {
|
||||
if statusError, ok := err.(*errors.StatusError); ok && errors.IsInvalid(err) {
|
||||
errorDetails := statusError.Status().Details
|
||||
if errorDetails.Kind == "Pod" {
|
||||
all, match := true, false
|
||||
for _, cause := range errorDetails.Causes {
|
||||
if cause.Field == "spec" && strings.Contains(cause.Message, "may not update fields other than") {
|
||||
fmt.Fprintf(out, "error: may not update %s in pod %q directly\n", resource, errorDetails.Name)
|
||||
match = true
|
||||
} else {
|
||||
all = false
|
||||
}
|
||||
}
|
||||
if all && match {
|
||||
return
|
||||
}
|
||||
} else {
|
||||
if ok := cmdutil.PrintErrorWithCauses(err, out); ok {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Fprintf(out, "error: %v\n", err)
|
||||
}
|
||||
|
||||
// selectString returns true if the provided string matches spec, where spec is a string with
|
||||
// a non-greedy '*' wildcard operator.
|
||||
// TODO: turn into a regex and handle greedy matches and backtracking.
|
||||
|
|
|
@ -212,13 +212,6 @@ func NewInternalNamespacedType(kind, apiversion, name, namespace string) *Intern
|
|||
|
||||
var errInvalidVersion = errors.New("not a version")
|
||||
|
||||
func versionErrIfFalse(b bool) error {
|
||||
if b {
|
||||
return nil
|
||||
}
|
||||
return errInvalidVersion
|
||||
}
|
||||
|
||||
// ValidVersion of API
|
||||
var ValidVersion = "v1"
|
||||
|
||||
|
|
|
@ -88,6 +88,9 @@ func NewCmdVersion(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *co
|
|||
// Complete completes all the required options
|
||||
func (o *Options) Complete(f cmdutil.Factory, cmd *cobra.Command) error {
|
||||
var err error
|
||||
if o.ClientOnly {
|
||||
return nil
|
||||
}
|
||||
o.discoveryClient, err = f.ToDiscoveryClient()
|
||||
// if we had an empty rest.Config, continue and just print out client information.
|
||||
// if we had an error other than being unable to build a rest.Config, fail.
|
||||
|
|
|
@ -735,6 +735,9 @@ func describePod(pod *corev1.Pod, events *corev1.EventList) (string, error) {
|
|||
} else {
|
||||
w.Write(LEVEL_0, "QoS Class:\t%s\n", qos.GetPodQOS(pod))
|
||||
}
|
||||
if len(pod.Spec.PriorityClassName) > 0 {
|
||||
w.Write(LEVEL_0, "Priority Class Name:\t%s\n", pod.Spec.PriorityClassName)
|
||||
}
|
||||
printLabelsMultiline(w, "Node-Selectors", pod.Spec.NodeSelector)
|
||||
printPodTolerationsMultiline(w, "Tolerations", pod.Spec.Tolerations)
|
||||
if events != nil {
|
||||
|
@ -1964,6 +1967,9 @@ func DescribePodTemplate(template *corev1.PodTemplateSpec, w PrefixWriter) {
|
|||
}
|
||||
describeContainers("Containers", template.Spec.Containers, nil, nil, w, " ")
|
||||
describeVolumes(template.Spec.Volumes, w, " ")
|
||||
if len(template.Spec.PriorityClassName) > 0 {
|
||||
w.Write(LEVEL_1, "Priority Class Name:\t%s\n", template.Spec.PriorityClassName)
|
||||
}
|
||||
}
|
||||
|
||||
// ReplicaSetDescriber generates information about a ReplicaSet and the pods it has created.
|
||||
|
@ -4393,16 +4399,6 @@ func shorten(s string, maxLength int) string {
|
|||
return s
|
||||
}
|
||||
|
||||
// translateTimestampUntil returns the elapsed time until timestamp in
|
||||
// human-readable approximation.
|
||||
func translateTimestampUntil(timestamp metav1.Time) string {
|
||||
if timestamp.IsZero() {
|
||||
return "<unknown>"
|
||||
}
|
||||
|
||||
return duration.HumanDuration(time.Until(timestamp.Time))
|
||||
}
|
||||
|
||||
// translateTimestampSince returns the elapsed time since timestamp in
|
||||
// human-readable approximation.
|
||||
func translateTimestampSince(timestamp metav1.Time) string {
|
||||
|
|
|
@ -109,7 +109,6 @@ func rsListFromClient(c appsclient.AppsV1Interface) rsListFunc {
|
|||
|
||||
// TODO: switch this to full namespacers
|
||||
type rsListFunc func(string, metav1.ListOptions) ([]*appsv1.ReplicaSet, error)
|
||||
type podListFunc func(string, metav1.ListOptions) (*corev1.PodList, error)
|
||||
|
||||
// listReplicaSets returns a slice of RSes the given deployment targets.
|
||||
// Note that this does NOT attempt to reconcile ControllerRef (adopt/orphan),
|
||||
|
|
|
@ -18,9 +18,6 @@ package dockershim
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
dockertypes "github.com/docker/docker/api/types"
|
||||
|
@ -128,20 +125,6 @@ func TestParsingCreationConflictError(t *testing.T) {
|
|||
require.Equal(t, matches[1], "24666ab8c814d16f986449e504ea0159468ddf8da01897144a770f66dce0e14e")
|
||||
}
|
||||
|
||||
// writeDockerConfig will write a config file into a temporary dir, and return that dir.
|
||||
// Caller is responsible for deleting the dir and its contents.
|
||||
func writeDockerConfig(cfg string) (string, error) {
|
||||
tmpdir, err := ioutil.TempDir("", "dockershim=helpers_test.go=")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
dir := filepath.Join(tmpdir, ".docker")
|
||||
if err := os.Mkdir(dir, 0755); err != nil {
|
||||
return "", err
|
||||
}
|
||||
return tmpdir, ioutil.WriteFile(filepath.Join(dir, "config.json"), []byte(cfg), 0644)
|
||||
}
|
||||
|
||||
func TestEnsureSandboxImageExists(t *testing.T) {
|
||||
sandboxImage := "gcr.io/test/image"
|
||||
authConfig := dockertypes.AuthConfig{Username: "user", Password: "pass"}
|
||||
|
|
|
@ -434,14 +434,6 @@ func formatThreshold(threshold evictionapi.Threshold) string {
|
|||
return fmt.Sprintf("threshold(signal=%v, operator=%v, value=%v, gracePeriod=%v)", threshold.Signal, threshold.Operator, evictionapi.ThresholdValue(threshold.Value), threshold.GracePeriod)
|
||||
}
|
||||
|
||||
// formatevictionapi.ThresholdValue formats a thresholdValue for logging.
|
||||
func formatThresholdValue(value evictionapi.ThresholdValue) string {
|
||||
if value.Quantity != nil {
|
||||
return value.Quantity.String()
|
||||
}
|
||||
return fmt.Sprintf("%f%%", value.Percentage*float32(100))
|
||||
}
|
||||
|
||||
// cachedStatsFunc returns a statsFunc based on the provided pod stats.
|
||||
func cachedStatsFunc(podStats []statsapi.PodStats) statsFunc {
|
||||
uid2PodStats := map[string]statsapi.PodStats{}
|
||||
|
|
|
@ -167,10 +167,6 @@ func (s sortableNodeAddress) Less(i, j int) bool {
|
|||
}
|
||||
func (s sortableNodeAddress) Swap(i, j int) { s[j], s[i] = s[i], s[j] }
|
||||
|
||||
func sortNodeAddresses(addrs sortableNodeAddress) {
|
||||
sort.Sort(addrs)
|
||||
}
|
||||
|
||||
func TestUpdateNewNodeStatus(t *testing.T) {
|
||||
cases := []struct {
|
||||
desc string
|
||||
|
|
|
@ -2018,20 +2018,6 @@ func TestPodPhaseWithRestartOnFailure(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
type fakeReadWriteCloser struct{}
|
||||
|
||||
func (f *fakeReadWriteCloser) Write(data []byte) (int, error) {
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
func (f *fakeReadWriteCloser) Read(data []byte) (int, error) {
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
func (f *fakeReadWriteCloser) Close() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func TestGetExec(t *testing.T) {
|
||||
const (
|
||||
podName = "podFoo"
|
||||
|
|
|
@ -136,22 +136,6 @@ func newTestKubelet(t *testing.T, controllerAttachDetachEnabled bool) *TestKubel
|
|||
return newTestKubeletWithImageList(t, imageList, controllerAttachDetachEnabled, true /*initFakeVolumePlugin*/)
|
||||
}
|
||||
|
||||
func newTestKubeletWithoutFakeVolumePlugin(t *testing.T, controllerAttachDetachEnabled bool) *TestKubelet {
|
||||
imageList := []kubecontainer.Image{
|
||||
{
|
||||
ID: "abc",
|
||||
RepoTags: []string{"k8s.gcr.io:v1", "k8s.gcr.io:v2"},
|
||||
Size: 123,
|
||||
},
|
||||
{
|
||||
ID: "efg",
|
||||
RepoTags: []string{"k8s.gcr.io:v3", "k8s.gcr.io:v4"},
|
||||
Size: 456,
|
||||
},
|
||||
}
|
||||
return newTestKubeletWithImageList(t, imageList, controllerAttachDetachEnabled, false /*initFakeVolumePlugin*/)
|
||||
}
|
||||
|
||||
func newTestKubeletWithImageList(
|
||||
t *testing.T,
|
||||
imageList []kubecontainer.Image,
|
||||
|
|
|
@ -257,19 +257,6 @@ func (kl *simpleFakeKubelet) syncPodWithWaitGroup(options syncPodOptions) error
|
|||
return nil
|
||||
}
|
||||
|
||||
// byContainerName sort the containers in a running pod by their names.
|
||||
type byContainerName kubecontainer.Pod
|
||||
|
||||
func (b byContainerName) Len() int { return len(b.Containers) }
|
||||
|
||||
func (b byContainerName) Swap(i, j int) {
|
||||
b.Containers[i], b.Containers[j] = b.Containers[j], b.Containers[i]
|
||||
}
|
||||
|
||||
func (b byContainerName) Less(i, j int) bool {
|
||||
return b.Containers[i].Name < b.Containers[j].Name
|
||||
}
|
||||
|
||||
// TestFakePodWorkers verifies that the fakePodWorkers behaves the same way as the real podWorkers
|
||||
// for their invocation of the syncPodFn.
|
||||
func TestFakePodWorkers(t *testing.T) {
|
||||
|
|
|
@ -883,10 +883,6 @@ func getAction() core.GetAction {
|
|||
return core.GetActionImpl{ActionImpl: core.ActionImpl{Verb: "get", Resource: schema.GroupVersionResource{Resource: "pods"}}}
|
||||
}
|
||||
|
||||
func updateAction() core.UpdateAction {
|
||||
return core.UpdateActionImpl{ActionImpl: core.ActionImpl{Verb: "update", Resource: schema.GroupVersionResource{Resource: "pods"}, Subresource: "status"}}
|
||||
}
|
||||
|
||||
func patchAction() core.PatchAction {
|
||||
return core.PatchActionImpl{ActionImpl: core.ActionImpl{Verb: "patch", Resource: schema.GroupVersionResource{Resource: "pods"}, Subresource: "status"}}
|
||||
}
|
||||
|
|
|
@ -142,7 +142,6 @@ go_test(
|
|||
"//pkg/api/legacyscheme:go_default_library",
|
||||
"//pkg/api/testapi:go_default_library",
|
||||
"//pkg/apis/batch:go_default_library",
|
||||
"//pkg/apis/core:go_default_library",
|
||||
"//pkg/apis/storage:go_default_library",
|
||||
"//pkg/generated/openapi:go_default_library",
|
||||
"//pkg/kubelet/client:go_default_library",
|
||||
|
|
|
@ -52,7 +52,6 @@ import (
|
|||
"k8s.io/kubernetes/pkg/api/legacyscheme"
|
||||
"k8s.io/kubernetes/pkg/api/testapi"
|
||||
"k8s.io/kubernetes/pkg/apis/batch"
|
||||
api "k8s.io/kubernetes/pkg/apis/core"
|
||||
apisstorage "k8s.io/kubernetes/pkg/apis/storage"
|
||||
kubeletclient "k8s.io/kubernetes/pkg/kubelet/client"
|
||||
"k8s.io/kubernetes/pkg/master/reconcilers"
|
||||
|
@ -233,12 +232,6 @@ func TestVersion(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
type fakeEndpointReconciler struct{}
|
||||
|
||||
func (*fakeEndpointReconciler) ReconcileEndpoints(serviceName string, ip net.IP, endpointPorts []api.EndpointPort, reconcilePorts bool) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func makeNodeList(nodes []string, nodeResources apiv1.NodeResources) *apiv1.NodeList {
|
||||
list := apiv1.NodeList{
|
||||
Items: make([]apiv1.Node, len(nodes)),
|
||||
|
|
|
@ -1010,14 +1010,6 @@ func printServiceList(list *api.ServiceList, options printers.PrintOptions) ([]m
|
|||
return rows, nil
|
||||
}
|
||||
|
||||
// backendStringer behaves just like a string interface and converts the given backend to a string.
|
||||
func backendStringer(backend *networking.IngressBackend) string {
|
||||
if backend == nil {
|
||||
return ""
|
||||
}
|
||||
return fmt.Sprintf("%v:%v", backend.ServiceName, backend.ServicePort.String())
|
||||
}
|
||||
|
||||
func formatHosts(rules []networking.IngressRule) string {
|
||||
list := []string{}
|
||||
max := 3
|
||||
|
|
|
@ -327,15 +327,6 @@ func TestDeleteEndpointConnections(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
type fakeClosable struct {
|
||||
closed bool
|
||||
}
|
||||
|
||||
func (c *fakeClosable) Close() error {
|
||||
c.closed = true
|
||||
return nil
|
||||
}
|
||||
|
||||
// fakePortOpener implements portOpener.
|
||||
type fakePortOpener struct {
|
||||
openPorts []*utilproxy.LocalPort
|
||||
|
|
|
@ -18,7 +18,6 @@ package componentstatus
|
|||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"net/http"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
|
@ -31,11 +30,6 @@ const (
|
|||
probeTimeOut = 20 * time.Second
|
||||
)
|
||||
|
||||
// TODO: this basic interface is duplicated in N places. consolidate?
|
||||
type httpGet interface {
|
||||
Get(url string) (*http.Response, error)
|
||||
}
|
||||
|
||||
type ValidatorFn func([]byte) error
|
||||
|
||||
type Server struct {
|
||||
|
|
|
@ -9,7 +9,6 @@ go_library(
|
|||
importpath = "k8s.io/kubernetes/pkg/scheduler/internal/queue",
|
||||
visibility = ["//pkg/scheduler:__subpackages__"],
|
||||
deps = [
|
||||
"//pkg/api/v1/pod:go_default_library",
|
||||
"//pkg/scheduler/algorithm/predicates:go_default_library",
|
||||
"//pkg/scheduler/algorithm/priorities/util:go_default_library",
|
||||
"//pkg/scheduler/metrics:go_default_library",
|
||||
|
|
|
@ -39,7 +39,6 @@ import (
|
|||
ktypes "k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
podutil "k8s.io/kubernetes/pkg/api/v1/pod"
|
||||
"k8s.io/kubernetes/pkg/scheduler/algorithm/predicates"
|
||||
priorityutil "k8s.io/kubernetes/pkg/scheduler/algorithm/priorities/util"
|
||||
"k8s.io/kubernetes/pkg/scheduler/metrics"
|
||||
|
@ -353,11 +352,6 @@ func (p *PriorityQueue) AddIfNotPresent(pod *v1.Pod) error {
|
|||
return err
|
||||
}
|
||||
|
||||
func isPodUnschedulable(pod *v1.Pod) bool {
|
||||
_, cond := podutil.GetPodCondition(&pod.Status, v1.PodScheduled)
|
||||
return cond != nil && cond.Status == v1.ConditionFalse && cond.Reason == v1.PodReasonUnschedulable
|
||||
}
|
||||
|
||||
// nsNameForPod returns a namespacedname for a pod
|
||||
func nsNameForPod(pod *v1.Pod) ktypes.NamespacedName {
|
||||
return ktypes.NamespacedName{
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
# See the OWNERS docs at https://go.k8s.io/owners
|
||||
|
||||
approvers:
|
||||
- piosz
|
||||
- brancz
|
||||
reviewers:
|
||||
- sig-instrumentation-pr-reviews
|
||||
labels:
|
||||
- sig/instrumentation
|
|
@ -113,18 +113,6 @@ func TestDoCleanupMountPoint(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func validateDirEmpty(dir string) error {
|
||||
files, err := ioutil.ReadDir(dir)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(files) != 0 {
|
||||
return fmt.Errorf("Directory %q is not empty", dir)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func validateDirExists(dir string) error {
|
||||
_, err := ioutil.ReadDir(dir)
|
||||
if err != nil {
|
||||
|
@ -143,10 +131,3 @@ func validateDirNotExists(dir string) error {
|
|||
}
|
||||
return fmt.Errorf("dir %q still exists", dir)
|
||||
}
|
||||
|
||||
func validateFileExists(file string) error {
|
||||
if _, err := os.Stat(file); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -205,13 +205,6 @@ type detachCall struct {
|
|||
ret error
|
||||
}
|
||||
|
||||
type diskIsAttachedCall struct {
|
||||
diskName aws.KubernetesVolumeID
|
||||
nodeName types.NodeName
|
||||
isAttached bool
|
||||
ret error
|
||||
}
|
||||
|
||||
func (testcase *testcase) AttachDisk(diskName aws.KubernetesVolumeID, nodeName types.NodeName) (string, error) {
|
||||
expected := &testcase.attach
|
||||
|
||||
|
|
|
@ -454,27 +454,6 @@ func makeGlobalPDPath(host volume.VolumeHost, volumeID aws.KubernetesVolumeID) s
|
|||
return filepath.Join(host.GetPluginDir(awsElasticBlockStorePluginName), mount.MountsInGlobalPDPath, name)
|
||||
}
|
||||
|
||||
// Reverses the mapping done in makeGlobalPDPath
|
||||
func getVolumeIDFromGlobalMount(host volume.VolumeHost, globalPath string) (string, error) {
|
||||
basePath := filepath.Join(host.GetPluginDir(awsElasticBlockStorePluginName), mount.MountsInGlobalPDPath)
|
||||
rel, err := filepath.Rel(basePath, globalPath)
|
||||
if err != nil {
|
||||
klog.Errorf("Failed to get volume id from global mount %s - %v", globalPath, err)
|
||||
return "", err
|
||||
}
|
||||
if strings.Contains(rel, "../") {
|
||||
klog.Errorf("Unexpected mount path: %s", globalPath)
|
||||
return "", fmt.Errorf("unexpected mount path: " + globalPath)
|
||||
}
|
||||
// Reverse the :// replacement done in makeGlobalPDPath
|
||||
volumeID := rel
|
||||
if strings.HasPrefix(volumeID, "aws/") {
|
||||
volumeID = strings.Replace(volumeID, "aws/", "aws://", 1)
|
||||
}
|
||||
klog.V(2).Info("Mapping mount dir ", globalPath, " to volumeID ", volumeID)
|
||||
return volumeID, nil
|
||||
}
|
||||
|
||||
func (ebs *awsElasticBlockStore) GetPath() string {
|
||||
return getPath(ebs.podUID, ebs.volName, ebs.plugin.host)
|
||||
}
|
||||
|
|
|
@ -201,20 +201,6 @@ func verifyDevicePath(devicePaths []string) (string, error) {
|
|||
return "", nil
|
||||
}
|
||||
|
||||
// Returns the first path that exists, or empty string if none exist.
|
||||
func verifyAllPathsRemoved(devicePaths []string) (bool, error) {
|
||||
allPathsRemoved := true
|
||||
for _, path := range devicePaths {
|
||||
exists, err := mount.PathExists(path)
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("Error checking if path exists: %v", err)
|
||||
}
|
||||
allPathsRemoved = allPathsRemoved && !exists
|
||||
}
|
||||
|
||||
return allPathsRemoved, nil
|
||||
}
|
||||
|
||||
// Returns list of all paths for given EBS mount
|
||||
// This is more interesting on GCE (where we are able to identify volumes under /dev/disk-by-id)
|
||||
// Here it is mostly about applying the partition path
|
||||
|
|
|
@ -904,12 +904,3 @@ func isV0Version(version string) bool {
|
|||
|
||||
return parsedVersion.Major() == 0
|
||||
}
|
||||
|
||||
func isV1Version(version string) bool {
|
||||
parsedVersion, err := utilversion.ParseGeneric(version)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return parsedVersion.Major() == 1
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ import (
|
|||
"encoding/json"
|
||||
|
||||
"k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/kubernetes/pkg/volume"
|
||||
volumetesting "k8s.io/kubernetes/pkg/volume/testing"
|
||||
"k8s.io/kubernetes/test/utils/harness"
|
||||
|
@ -108,23 +107,6 @@ func fakeVolumeSpec() *volume.Spec {
|
|||
return volume.NewSpecFromVolume(vol)
|
||||
}
|
||||
|
||||
func fakePersistentVolumeSpec() *volume.Spec {
|
||||
vol := &v1.PersistentVolume{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "vol1",
|
||||
},
|
||||
Spec: v1.PersistentVolumeSpec{
|
||||
PersistentVolumeSource: v1.PersistentVolumeSource{
|
||||
FlexVolume: &v1.FlexPersistentVolumeSource{
|
||||
Driver: "kubernetes.io/fakeAttacher",
|
||||
ReadOnly: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
return volume.NewSpecFromPersistentVolume(vol, false)
|
||||
}
|
||||
|
||||
func specJSON(plugin *flexVolumeAttachablePlugin, spec *volume.Spec, extraOptions map[string]string) string {
|
||||
o, err := NewOptionsForDriver(spec, plugin.host, extraOptions)
|
||||
if err != nil {
|
||||
|
|
|
@ -302,62 +302,3 @@ func TestIsReadOnly(t *testing.T) {
|
|||
b := &flockerVolumeMounter{readOnly: true}
|
||||
assert.True(t, b.GetAttributes().ReadOnly)
|
||||
}
|
||||
|
||||
type mockFlockerClient struct {
|
||||
datasetID, primaryUUID, path string
|
||||
datasetState *flockerapi.DatasetState
|
||||
}
|
||||
|
||||
func newMockFlockerClient(mockDatasetID, mockPrimaryUUID, mockPath string) *mockFlockerClient {
|
||||
return &mockFlockerClient{
|
||||
datasetID: mockDatasetID,
|
||||
primaryUUID: mockPrimaryUUID,
|
||||
path: mockPath,
|
||||
datasetState: &flockerapi.DatasetState{
|
||||
Path: mockPath,
|
||||
DatasetID: mockDatasetID,
|
||||
Primary: mockPrimaryUUID,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (m mockFlockerClient) CreateDataset(metaName string) (*flockerapi.DatasetState, error) {
|
||||
return m.datasetState, nil
|
||||
}
|
||||
func (m mockFlockerClient) GetDatasetState(datasetID string) (*flockerapi.DatasetState, error) {
|
||||
return m.datasetState, nil
|
||||
}
|
||||
func (m mockFlockerClient) GetDatasetID(metaName string) (string, error) {
|
||||
return m.datasetID, nil
|
||||
}
|
||||
func (m mockFlockerClient) GetPrimaryUUID() (string, error) {
|
||||
return m.primaryUUID, nil
|
||||
}
|
||||
func (m mockFlockerClient) UpdatePrimaryForDataset(primaryUUID, datasetID string) (*flockerapi.DatasetState, error) {
|
||||
return m.datasetState, nil
|
||||
}
|
||||
|
||||
/*
|
||||
TODO: re-enable after refactor
|
||||
func TestSetUpAtInternal(t *testing.T) {
|
||||
const dir = "dir"
|
||||
mockPath := "expected-to-be-set-properly" // package var
|
||||
expectedPath := mockPath
|
||||
|
||||
assert := assert.New(t)
|
||||
|
||||
plugMgr, rootDir := newInitializedVolumePlugMgr(t)
|
||||
if rootDir != "" {
|
||||
defer os.RemoveAll(rootDir)
|
||||
}
|
||||
plug, err := plugMgr.FindPluginByName(flockerPluginName)
|
||||
assert.NoError(err)
|
||||
|
||||
pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: types.UID("poduid")}}
|
||||
b := flockerVolumeMounter{flockerVolume: &flockerVolume{pod: pod, plugin: plug.(*flockerPlugin)}}
|
||||
b.client = newMockFlockerClient("dataset-id", "primary-uid", mockPath)
|
||||
|
||||
assert.NoError(b.SetUpAt(dir, nil))
|
||||
assert.Equal(expectedPath, b.flocker.path)
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -594,15 +594,6 @@ func createSecretMap(spec *volume.Spec, plugin *iscsiPlugin, namespace string) (
|
|||
return secret, err
|
||||
}
|
||||
|
||||
func createVolumeFromISCSIVolumeSource(volumeName string, iscsi v1.ISCSIVolumeSource) *v1.Volume {
|
||||
return &v1.Volume{
|
||||
Name: volumeName,
|
||||
VolumeSource: v1.VolumeSource{
|
||||
ISCSI: &iscsi,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func createPersistentVolumeFromISCSIPVSource(volumeName string, iscsi v1.ISCSIPersistentVolumeSource) *v1.PersistentVolume {
|
||||
block := v1.PersistentVolumeBlock
|
||||
return &v1.PersistentVolume{
|
||||
|
|
|
@ -1193,20 +1193,6 @@ func makeSecret(namespace, name string) v1.Secret {
|
|||
}
|
||||
}
|
||||
|
||||
func configMap(namespace, name string) v1.ConfigMap {
|
||||
return v1.ConfigMap{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Namespace: namespace,
|
||||
Name: name,
|
||||
},
|
||||
Data: map[string]string{
|
||||
"data-1": "value-1",
|
||||
"data-2": "value-2",
|
||||
"data-3": "value-3",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func makeProjection(name string, defaultMode int32, kind string) *v1.ProjectedVolumeSource {
|
||||
var item v1.VolumeProjection
|
||||
|
||||
|
|
|
@ -1081,15 +1081,6 @@ func getVolumeAccessModes(spec *volume.Spec) ([]v1.PersistentVolumeAccessMode, e
|
|||
return nil, nil
|
||||
}
|
||||
|
||||
func parsePodSecret(pod *v1.Pod, secretName string, kubeClient clientset.Interface) (string, error) {
|
||||
secret, err := volutil.GetSecretForPod(pod, secretName, kubeClient)
|
||||
if err != nil {
|
||||
klog.Errorf("failed to get secret from [%q/%q]: %+v", pod.Namespace, secretName, err)
|
||||
return "", fmt.Errorf("failed to get secret from [%q/%q]: %+v", pod.Namespace, secretName, err)
|
||||
}
|
||||
return parseSecretMap(secret)
|
||||
}
|
||||
|
||||
func parsePVSecret(namespace, secretName string, kubeClient clientset.Interface) (string, error) {
|
||||
secret, err := volutil.GetSecretForPV(namespace, secretName, rbdPluginName, kubeClient)
|
||||
if err != nil {
|
||||
|
|
|
@ -27,14 +27,6 @@ import (
|
|||
siotypes "github.com/codedellemc/goscaleio/types/v1"
|
||||
)
|
||||
|
||||
type storageInterface interface {
|
||||
CreateVolume(string, int64) (*siotypes.Volume, error)
|
||||
AttachVolume(string, bool) (string, error)
|
||||
IsAttached(string) (bool, error)
|
||||
DetachVolume(string) error
|
||||
DeleteVolume(string) error
|
||||
}
|
||||
|
||||
type sioMgr struct {
|
||||
client sioInterface
|
||||
configData map[string]string
|
||||
|
|
|
@ -62,10 +62,6 @@ func TestCanSupport(t *testing.T) {
|
|||
type fakePDManager struct {
|
||||
}
|
||||
|
||||
func getFakeDeviceName(host volume.VolumeHost, volPath string) string {
|
||||
return path.Join(host.GetPluginDir(vsphereVolumePluginName), "device", volPath)
|
||||
}
|
||||
|
||||
func (fake *fakePDManager) CreateVolume(v *vsphereVolumeProvisioner, selectedZone []string) (volSpec *VolumeSpec, err error) {
|
||||
volSpec = &VolumeSpec{
|
||||
Path: "[local] test-volume-name.vmdk",
|
||||
|
|
|
@ -80,13 +80,3 @@ func SetDefaults_ServiceReference(obj *ServiceReference) {
|
|||
obj.Port = utilpointer.Int32Ptr(443)
|
||||
}
|
||||
}
|
||||
|
||||
// hasPerVersionColumns returns true if a CRD uses per-version columns.
|
||||
func hasPerVersionColumns(versions []CustomResourceDefinitionVersion) bool {
|
||||
for _, v := range versions {
|
||||
if len(v.AdditionalPrinterColumns) > 0 {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
|
@ -54,10 +54,6 @@ func jsonTag(field reflect.StructField) (string, bool) {
|
|||
return tag, omitempty
|
||||
}
|
||||
|
||||
func formatValue(value interface{}) string {
|
||||
return fmt.Sprintf("%v", value)
|
||||
}
|
||||
|
||||
func isPointerKind(kind reflect.Kind) bool {
|
||||
return kind == reflect.Ptr
|
||||
}
|
||||
|
|
|
@ -211,10 +211,6 @@ func ResourceFinderForResult(result resource.Visitor) ResourceFinder {
|
|||
})
|
||||
}
|
||||
|
||||
func strPtr(val string) *string {
|
||||
return &val
|
||||
}
|
||||
|
||||
func boolPtr(val bool) *bool {
|
||||
return &val
|
||||
}
|
||||
|
|
|
@ -30,10 +30,6 @@ import (
|
|||
var scaleConverter = NewScaleConverter()
|
||||
var codecs = serializer.NewCodecFactory(scaleConverter.Scheme())
|
||||
|
||||
// restInterfaceProvider turns a restclient.Config into a restclient.Interface.
|
||||
// It's overridable for the purposes of testing.
|
||||
type restInterfaceProvider func(*restclient.Config) (restclient.Interface, error)
|
||||
|
||||
// scaleClient is an implementation of ScalesGetter
|
||||
// which makes use of a RESTMapper and a generic REST
|
||||
// client to support an discoverable resource.
|
||||
|
|
|
@ -25,7 +25,6 @@ import (
|
|||
"net"
|
||||
"net/url"
|
||||
"reflect"
|
||||
"strings"
|
||||
"sync"
|
||||
"syscall"
|
||||
"time"
|
||||
|
@ -113,11 +112,6 @@ func NewNamedReflector(name string, lw ListerWatcher, expectedType interface{},
|
|||
return r
|
||||
}
|
||||
|
||||
func makeValidPrometheusMetricLabel(in string) string {
|
||||
// this isn't perfect, but it removes our common characters
|
||||
return strings.NewReplacer("/", "_", ".", "_", "-", "_", ":", "_").Replace(in)
|
||||
}
|
||||
|
||||
// internalPackages are packages that ignored when creating a default reflector name. These packages are in the common
|
||||
// call chains to NewReflector, so they'd be low entropy names for reflectors
|
||||
var internalPackages = []string{"client-go/tools/cache/"}
|
||||
|
|
|
@ -94,23 +94,6 @@ var metricsFactory = struct {
|
|||
metricsProvider: noopMetricsProvider{},
|
||||
}
|
||||
|
||||
func newReflectorMetrics(name string) *reflectorMetrics {
|
||||
var ret *reflectorMetrics
|
||||
if len(name) == 0 {
|
||||
return ret
|
||||
}
|
||||
return &reflectorMetrics{
|
||||
numberOfLists: metricsFactory.metricsProvider.NewListsMetric(name),
|
||||
listDuration: metricsFactory.metricsProvider.NewListDurationMetric(name),
|
||||
numberOfItemsInList: metricsFactory.metricsProvider.NewItemsInListMetric(name),
|
||||
numberOfWatches: metricsFactory.metricsProvider.NewWatchesMetric(name),
|
||||
numberOfShortWatches: metricsFactory.metricsProvider.NewShortWatchesMetric(name),
|
||||
watchDuration: metricsFactory.metricsProvider.NewWatchDurationMetric(name),
|
||||
numberOfItemsInWatch: metricsFactory.metricsProvider.NewItemsInWatchMetric(name),
|
||||
lastResourceVersion: metricsFactory.metricsProvider.NewLastResourceVersionMetric(name),
|
||||
}
|
||||
}
|
||||
|
||||
// SetReflectorMetricsProvider sets the metrics provider
|
||||
func SetReflectorMetricsProvider(metricsProvider MetricsProvider) {
|
||||
metricsFactory.setProviders.Do(func() {
|
||||
|
|
|
@ -296,16 +296,6 @@ func makeUserIdentificationConfig(info clientauth.Info) *restclient.Config {
|
|||
return config
|
||||
}
|
||||
|
||||
// makeUserIdentificationFieldsConfig returns a client.Config capable of being merged using mergo for only server identification information
|
||||
func makeServerIdentificationConfig(info clientauth.Info) restclient.Config {
|
||||
config := restclient.Config{}
|
||||
config.CAFile = info.CAFile
|
||||
if info.Insecure != nil {
|
||||
config.Insecure = *info.Insecure
|
||||
}
|
||||
return config
|
||||
}
|
||||
|
||||
func canIdentifyUser(config restclient.Config) bool {
|
||||
return len(config.Username) > 0 ||
|
||||
(len(config.CertFile) > 0 || len(config.CertData) > 0) ||
|
||||
|
|
|
@ -23,7 +23,6 @@ import (
|
|||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"k8s.io/klog"
|
||||
|
@ -289,12 +288,6 @@ func (s *fileStore) filename(qualifier string) string {
|
|||
return s.pairNamePrefix + "-" + qualifier + pemExtension
|
||||
}
|
||||
|
||||
// withoutExt returns the given filename after removing the extension. The
|
||||
// extension to remove will be the result of filepath.Ext().
|
||||
func withoutExt(filename string) string {
|
||||
return strings.TrimSuffix(filename, filepath.Ext(filename))
|
||||
}
|
||||
|
||||
func loadX509KeyPair(certFile, keyFile string) (*tls.Certificate, error) {
|
||||
cert, err := tls.LoadX509KeyPair(certFile, keyFile)
|
||||
if err != nil {
|
||||
|
|
|
@ -14,7 +14,6 @@ go_library(
|
|||
"groupinterface.go",
|
||||
"informer.go",
|
||||
"packages.go",
|
||||
"tags.go",
|
||||
"types.go",
|
||||
"versioninterface.go",
|
||||
],
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
/*
|
||||
Copyright 2016 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package generators
|
||||
|
||||
import (
|
||||
"k8s.io/gengo/types"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
// extractBoolTagOrDie gets the comment-tags for the key and asserts that, if
|
||||
// it exists, the value is boolean. If the tag did not exist, it returns
|
||||
// false.
|
||||
func extractBoolTagOrDie(key string, lines []string) bool {
|
||||
val, err := types.ExtractSingleBoolCommentTag("+", key, false, lines)
|
||||
if err != nil {
|
||||
klog.Fatal(err)
|
||||
}
|
||||
return val
|
||||
}
|
|
@ -10,7 +10,6 @@ go_library(
|
|||
srcs = [
|
||||
"expansion.go",
|
||||
"lister.go",
|
||||
"tags.go",
|
||||
],
|
||||
importmap = "k8s.io/kubernetes/vendor/k8s.io/code-generator/cmd/lister-gen/generators",
|
||||
importpath = "k8s.io/code-generator/cmd/lister-gen/generators",
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
/*
|
||||
Copyright 2016 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package generators
|
||||
|
||||
import (
|
||||
"k8s.io/gengo/types"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
// extractBoolTagOrDie gets the comment-tags for the key and asserts that, if
|
||||
// it exists, the value is boolean. If the tag did not exist, it returns
|
||||
// false.
|
||||
func extractBoolTagOrDie(key string, lines []string) bool {
|
||||
val, err := types.ExtractSingleBoolCommentTag("+", key, false, lines)
|
||||
if err != nil {
|
||||
klog.Fatal(err)
|
||||
}
|
||||
return val
|
||||
}
|
|
@ -300,18 +300,6 @@ func (v *visitor) Visit(node ast.Node) (w ast.Visitor) {
|
|||
return v
|
||||
}
|
||||
|
||||
func scandir(dir string) {
|
||||
v := newVisitor()
|
||||
pkg, err := parser.ParseDir(v.FileSet, dir, nil, parser.ParseComments)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
for _, p := range pkg {
|
||||
ast.Walk(v, p)
|
||||
}
|
||||
}
|
||||
|
||||
func scanfile(path string, src interface{}) []conformanceData {
|
||||
v := newVisitor()
|
||||
file, err := parser.ParseFile(v.FileSet, path, src, parser.ParseComments)
|
||||
|
|
|
@ -36,27 +36,6 @@ import (
|
|||
imageutils "k8s.io/kubernetes/test/utils/image"
|
||||
)
|
||||
|
||||
func stagingClientPod(name, value string) v1.Pod {
|
||||
return v1.Pod{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: name,
|
||||
Labels: map[string]string{
|
||||
"name": "foo",
|
||||
"time": value,
|
||||
},
|
||||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
{
|
||||
Name: "nginx",
|
||||
Image: imageutils.GetE2EImage(imageutils.Nginx),
|
||||
Ports: []v1.ContainerPort{{ContainerPort: 80}},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func testingPod(name, value string) v1.Pod {
|
||||
return v1.Pod{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
|
@ -98,34 +77,6 @@ func observeCreation(w watch.Interface) {
|
|||
}
|
||||
}
|
||||
|
||||
func observeObjectDeletion(w watch.Interface) (obj runtime.Object) {
|
||||
// output to give us a duration to failure. Maybe we aren't getting the
|
||||
// full timeout for some reason. My guess would be watch failure
|
||||
framework.Logf("Starting to observe pod deletion")
|
||||
deleted := false
|
||||
timeout := false
|
||||
timer := time.After(framework.DefaultPodDeletionTimeout)
|
||||
for !deleted && !timeout {
|
||||
select {
|
||||
case event, normal := <-w.ResultChan():
|
||||
if !normal {
|
||||
framework.Failf("The channel was closed unexpectedly")
|
||||
return
|
||||
}
|
||||
if event.Type == watch.Deleted {
|
||||
obj = event.Object
|
||||
deleted = true
|
||||
}
|
||||
case <-timer:
|
||||
timeout = true
|
||||
}
|
||||
}
|
||||
if !deleted {
|
||||
framework.Failf("Failed to observe pod deletion")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func observerUpdate(w watch.Interface, expectedUpdate func(runtime.Object) bool) {
|
||||
timer := time.After(30 * time.Second)
|
||||
updated := false
|
||||
|
|
|
@ -27,7 +27,6 @@ import (
|
|||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
clientset "k8s.io/client-go/kubernetes"
|
||||
"k8s.io/kubernetes/test/e2e/framework"
|
||||
imageutils "k8s.io/kubernetes/test/utils/image"
|
||||
|
||||
|
@ -82,23 +81,6 @@ func extinguish(f *framework.Framework, totalNS int, maxAllowedAfterDel int, max
|
|||
}))
|
||||
}
|
||||
|
||||
func waitForPodInNamespace(c clientset.Interface, ns, podName string) *v1.Pod {
|
||||
var pod *v1.Pod
|
||||
var err error
|
||||
err = wait.PollImmediate(2*time.Second, 15*time.Second, func() (bool, error) {
|
||||
pod, err = c.CoreV1().Pods(ns).Get(podName, metav1.GetOptions{})
|
||||
if errors.IsNotFound(err) {
|
||||
return false, nil
|
||||
}
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return true, nil
|
||||
})
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred(), "failed to get pod %s in namespace: %s", podName, ns)
|
||||
return pod
|
||||
}
|
||||
|
||||
func ensurePodsAreRemovedWhenNamespaceIsDeleted(f *framework.Framework) {
|
||||
ginkgo.By("Creating a test namespace")
|
||||
namespaceName := "nsdeletetest"
|
||||
|
|
|
@ -1362,17 +1362,6 @@ func newTestResourceQuotaWithScopeForPriorityClass(name string, hard v1.Resource
|
|||
}
|
||||
}
|
||||
|
||||
// newTestResourceQuotaForEphemeralStorage returns a quota that enforces default constraints for testing feature LocalStorageCapacityIsolation
|
||||
func newTestResourceQuotaForEphemeralStorage(name string) *v1.ResourceQuota {
|
||||
hard := v1.ResourceList{}
|
||||
hard[v1.ResourceEphemeralStorage] = resource.MustParse("500Mi")
|
||||
hard[v1.ResourceQuotas] = resource.MustParse("1")
|
||||
return &v1.ResourceQuota{
|
||||
ObjectMeta: metav1.ObjectMeta{Name: name},
|
||||
Spec: v1.ResourceQuotaSpec{Hard: hard},
|
||||
}
|
||||
}
|
||||
|
||||
// newTestResourceQuota returns a quota that enforces default constraints for testing
|
||||
func newTestResourceQuota(name string) *v1.ResourceQuota {
|
||||
hard := v1.ResourceList{}
|
||||
|
|
|
@ -17,7 +17,6 @@ limitations under the License.
|
|||
package autoscaling
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"math"
|
||||
|
@ -1187,30 +1186,6 @@ func disableAutoscaler(nodePool string, minCount, maxCount int) error {
|
|||
return fmt.Errorf("autoscaler still enabled, last error: %v", finalErr)
|
||||
}
|
||||
|
||||
func executeHTTPRequest(method string, url string, body string) (string, error) {
|
||||
client := &http.Client{}
|
||||
req, err := http.NewRequest(method, url, strings.NewReader(body))
|
||||
if err != nil {
|
||||
By(fmt.Sprintf("Can't create request: %s", err.Error()))
|
||||
return "", err
|
||||
}
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
respBody, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return "", fmt.Errorf("error: %s %s", resp.Status, string(respBody))
|
||||
}
|
||||
|
||||
return string(respBody), nil
|
||||
}
|
||||
|
||||
func addNodePool(name string, machineType string, numNodes int) {
|
||||
args := []string{"container", "node-pools", "create", name, "--quiet",
|
||||
"--machine-type=" + machineType,
|
||||
|
@ -1297,26 +1272,6 @@ func getPoolSize(f *framework.Framework, poolName string) int {
|
|||
return size
|
||||
}
|
||||
|
||||
func doPut(url, content string) (string, error) {
|
||||
req, err := http.NewRequest("PUT", url, bytes.NewBuffer([]byte(content)))
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
client := &http.Client{}
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
strBody := string(body)
|
||||
return strBody, nil
|
||||
}
|
||||
|
||||
func reserveMemory(f *framework.Framework, id string, replicas, megabytes int, expectRunning bool, timeout time.Duration, selector map[string]string, tolerations []v1.Toleration, priorityClassName string) func() error {
|
||||
By(fmt.Sprintf("Running RC which reserves %v MB of memory", megabytes))
|
||||
request := int64(1024 * 1024 * megabytes / replicas)
|
||||
|
@ -1750,14 +1705,6 @@ func runReplicatedPodOnEachNode(f *framework.Framework, nodes []v1.Node, namespa
|
|||
return nil
|
||||
}
|
||||
|
||||
// wrap runReplicatedPodOnEachNode to return cleanup
|
||||
func runReplicatedPodOnEachNodeWithCleanup(f *framework.Framework, nodes []v1.Node, namespace string, podsPerNode int, id string, labels map[string]string, memRequest int64) (func(), error) {
|
||||
err := runReplicatedPodOnEachNode(f, nodes, namespace, podsPerNode, id, labels, memRequest)
|
||||
return func() {
|
||||
framework.DeleteRCAndWaitForGC(f.ClientSet, namespace, id)
|
||||
}, err
|
||||
}
|
||||
|
||||
// Increase cluster size by newNodesForScaledownTests to create some unused nodes
|
||||
// that can be later removed by cluster autoscaler.
|
||||
func manuallyIncreaseClusterSize(f *framework.Framework, originalSizes map[string]int) int {
|
||||
|
|
|
@ -39,14 +39,6 @@ func nodeNames(nodes []v1.Node) []string {
|
|||
return result
|
||||
}
|
||||
|
||||
func podNames(pods []v1.Pod) []string {
|
||||
result := make([]string, 0, len(pods))
|
||||
for i := range pods {
|
||||
result = append(result, pods[i].Name)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
var _ = Describe("Recreate [Feature:Recreate]", func() {
|
||||
f := framework.NewDefaultFramework("recreate")
|
||||
var originalNodes []v1.Node
|
||||
|
|
|
@ -3683,6 +3683,7 @@ func ParseKVLines(output, key string) string {
|
|||
return ""
|
||||
}
|
||||
|
||||
// RestartKubeProxy restarts kube-proxy on the given host.
|
||||
func RestartKubeProxy(host string) error {
|
||||
// TODO: Make it work for all providers.
|
||||
if !ProviderIs("gce", "gke", "aws") {
|
||||
|
@ -3719,6 +3720,7 @@ func RestartKubeProxy(host string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// RestartKubelet restarts kubelet on the given host.
|
||||
func RestartKubelet(host string) error {
|
||||
// TODO: Make it work for all providers and distros.
|
||||
supportedProviders := []string{"gce", "aws", "vsphere"}
|
||||
|
@ -3762,6 +3764,7 @@ func RestartKubelet(host string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// WaitForKubeletUp waits for the kubelet on the given host to be up.
|
||||
func WaitForKubeletUp(host string) error {
|
||||
cmd := "curl http://localhost:" + strconv.Itoa(ports.KubeletReadOnlyPort) + "/healthz"
|
||||
for start := time.Now(); time.Since(start) < time.Minute; time.Sleep(5 * time.Second) {
|
||||
|
@ -3776,6 +3779,7 @@ func WaitForKubeletUp(host string) error {
|
|||
return fmt.Errorf("waiting for kubelet timed out")
|
||||
}
|
||||
|
||||
// RestartApiserver restarts the kube-apiserver.
|
||||
func RestartApiserver(cs clientset.Interface) error {
|
||||
// TODO: Make it work for all providers.
|
||||
if !ProviderIs("gce", "gke", "aws") {
|
||||
|
@ -3819,6 +3823,7 @@ func sshRestartMaster() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// WaitForApiserverUp waits for the kube-apiserver to be up.
|
||||
func WaitForApiserverUp(c clientset.Interface) error {
|
||||
for start := time.Now(); time.Since(start) < time.Minute; time.Sleep(5 * time.Second) {
|
||||
body, err := c.CoreV1().RESTClient().Get().AbsPath("/healthz").Do().Raw()
|
||||
|
@ -3865,6 +3870,7 @@ func getApiserverRestartCount(c clientset.Interface) (int32, error) {
|
|||
return -1, fmt.Errorf("Failed to find kube-apiserver container in pod")
|
||||
}
|
||||
|
||||
// RestartControllerManager restarts the kube-controller-manager.
|
||||
func RestartControllerManager() error {
|
||||
// TODO: Make it work for all providers and distros.
|
||||
if !ProviderIs("gce", "aws") {
|
||||
|
@ -3883,6 +3889,7 @@ func RestartControllerManager() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// WaitForControllerManagerUp waits for the kube-controller-manager to be up.
|
||||
func WaitForControllerManagerUp() error {
|
||||
cmd := "curl http://localhost:" + strconv.Itoa(ports.InsecureKubeControllerManagerPort) + "/healthz"
|
||||
for start := time.Now(); time.Since(start) < time.Minute; time.Sleep(5 * time.Second) {
|
||||
|
@ -3986,11 +3993,12 @@ func WaitForReadyNodes(c clientset.Interface, size int, timeout time.Duration) e
|
|||
return err
|
||||
}
|
||||
|
||||
// GenerateMasterRegexp returns a regex for matching master node name.
|
||||
func GenerateMasterRegexp(prefix string) string {
|
||||
return prefix + "(-...)?"
|
||||
}
|
||||
|
||||
// waitForMasters waits until the cluster has the desired number of ready masters in it.
|
||||
// WaitForMasters waits until the cluster has the desired number of ready masters in it.
|
||||
func WaitForMasters(masterPrefix string, c clientset.Interface, size int, timeout time.Duration) error {
|
||||
for start := time.Now(); time.Since(start) < timeout; time.Sleep(20 * time.Second) {
|
||||
nodes, err := c.CoreV1().Nodes().List(metav1.ListOptions{})
|
||||
|
@ -4099,21 +4107,21 @@ func OpenWebSocketForURL(url *url.URL, config *restclient.Config, protocols []st
|
|||
return websocket.DialConfig(cfg)
|
||||
}
|
||||
|
||||
// Looks for the given string in the log of a specific pod container
|
||||
// LookForStringInLog looks for the given string in the log of a specific pod container
|
||||
func LookForStringInLog(ns, podName, container, expectedString string, timeout time.Duration) (result string, err error) {
|
||||
return LookForString(expectedString, timeout, func() string {
|
||||
return RunKubectlOrDie("logs", podName, container, fmt.Sprintf("--namespace=%v", ns))
|
||||
})
|
||||
}
|
||||
|
||||
// Looks for the given string in a file in a specific pod container
|
||||
// LookForStringInFile looks for the given string in a file in a specific pod container
|
||||
func LookForStringInFile(ns, podName, container, file, expectedString string, timeout time.Duration) (result string, err error) {
|
||||
return LookForString(expectedString, timeout, func() string {
|
||||
return RunKubectlOrDie("exec", podName, "-c", container, fmt.Sprintf("--namespace=%v", ns), "--", "cat", file)
|
||||
})
|
||||
}
|
||||
|
||||
// Looks for the given string in the output of a command executed in a specific pod container
|
||||
// LookForStringInPodExec looks for the given string in the output of a command executed in a specific pod container
|
||||
func LookForStringInPodExec(ns, podName string, command []string, expectedString string, timeout time.Duration) (result string, err error) {
|
||||
return LookForString(expectedString, timeout, func() string {
|
||||
// use the first container
|
||||
|
@ -4123,7 +4131,7 @@ func LookForStringInPodExec(ns, podName string, command []string, expectedString
|
|||
})
|
||||
}
|
||||
|
||||
// Looks for the given string in the output of fn, repeatedly calling fn until
|
||||
// LookForString looks for the given string in the output of fn, repeatedly calling fn until
|
||||
// the timeout is reached or the string is found. Returns last log and possibly
|
||||
// error if the string was not found.
|
||||
func LookForString(expectedString string, timeout time.Duration, fn func() string) (result string, err error) {
|
||||
|
@ -4179,7 +4187,7 @@ func GetNodePortURL(client clientset.Interface, ns, name string, svcPort int) (s
|
|||
return "", err
|
||||
}
|
||||
if len(nodes.Items) == 0 {
|
||||
return "", fmt.Errorf("Unable to list nodes in cluster.")
|
||||
return "", fmt.Errorf("Unable to list nodes in cluster")
|
||||
}
|
||||
for _, node := range nodes.Items {
|
||||
for _, address := range node.Status.Addresses {
|
||||
|
@ -4193,6 +4201,7 @@ func GetNodePortURL(client clientset.Interface, ns, name string, svcPort int) (s
|
|||
return "", fmt.Errorf("Failed to find external address for service %v", name)
|
||||
}
|
||||
|
||||
// GetPodLogs returns the logs of the specified container (namespace/pod/container).
|
||||
// TODO(random-liu): Change this to be a member function of the framework.
|
||||
func GetPodLogs(c clientset.Interface, namespace, podName, containerName string) (string, error) {
|
||||
return getPodLogsInternal(c, namespace, podName, containerName, false)
|
||||
|
@ -4216,7 +4225,7 @@ func getPodLogsInternal(c clientset.Interface, namespace, podName, containerName
|
|||
return "", err
|
||||
}
|
||||
if err == nil && strings.Contains(string(logs), "Internal Error") {
|
||||
return "", fmt.Errorf("Fetched log contains \"Internal Error\": %q.", string(logs))
|
||||
return "", fmt.Errorf("Fetched log contains \"Internal Error\": %q", string(logs))
|
||||
}
|
||||
return string(logs), err
|
||||
}
|
||||
|
@ -4227,6 +4236,7 @@ func EnsureLoadBalancerResourcesDeleted(ip, portRange string) error {
|
|||
return TestContext.CloudConfig.Provider.EnsureLoadBalancerResourcesDeleted(ip, portRange)
|
||||
}
|
||||
|
||||
// BlockNetwork blocks network between the given from value and the given to value.
|
||||
// The following helper functions can block/unblock network from source
|
||||
// host to destination host by manipulating iptable rules.
|
||||
// This function assumes it can ssh to the source host.
|
||||
|
@ -4254,6 +4264,7 @@ func BlockNetwork(from string, to string) {
|
|||
}
|
||||
}
|
||||
|
||||
// UnblockNetwork unblocks network between the given from value and the given to value.
|
||||
func UnblockNetwork(from string, to string) {
|
||||
Logf("Unblock network traffic from %s to %s", from, to)
|
||||
iptablesRule := fmt.Sprintf("OUTPUT --destination %s --jump REJECT", to)
|
||||
|
@ -4341,10 +4352,13 @@ func getKubeletPods(c clientset.Interface, node, resource string) (*v1.PodList,
|
|||
return result, nil
|
||||
}
|
||||
|
||||
// PingCommand is the type to hold ping command.
|
||||
type PingCommand string
|
||||
|
||||
const (
|
||||
// IPv4PingCommand is a ping command for IPv4.
|
||||
IPv4PingCommand PingCommand = "ping"
|
||||
// IPv6PingCommand is a ping command for IPv6.
|
||||
IPv6PingCommand PingCommand = "ping6"
|
||||
)
|
||||
|
||||
|
@ -4428,6 +4442,7 @@ func parseSystemdServices(services string) string {
|
|||
return strings.TrimSpace(strings.Replace(services, ",", " ", -1))
|
||||
}
|
||||
|
||||
// GetPodsInNamespace returns the pods in the given namespace.
|
||||
func GetPodsInNamespace(c clientset.Interface, ns string, ignoreLabels map[string]string) ([]*v1.Pod, error) {
|
||||
pods, err := c.CoreV1().Pods(ns).List(metav1.ListOptions{})
|
||||
if err != nil {
|
||||
|
@ -4561,6 +4576,7 @@ func GetMasterAndWorkerNodesOrDie(c clientset.Interface) (sets.String, *v1.NodeL
|
|||
return masters, nodes
|
||||
}
|
||||
|
||||
// ListNamespaceEvents lists the events in the given namespace.
|
||||
func ListNamespaceEvents(c clientset.Interface, ns string) error {
|
||||
ls, err := c.CoreV1().Events(ns).List(metav1.ListOptions{})
|
||||
if err != nil {
|
||||
|
@ -4583,6 +4599,7 @@ type E2ETestNodePreparer struct {
|
|||
nodeToAppliedStrategy map[string]testutils.PrepareNodeStrategy
|
||||
}
|
||||
|
||||
// NewE2ETestNodePreparer returns a new instance of E2ETestNodePreparer.
|
||||
func NewE2ETestNodePreparer(client clientset.Interface, countToStrategy []testutils.CountToStrategy) testutils.TestNodePreparer {
|
||||
return &E2ETestNodePreparer{
|
||||
client: client,
|
||||
|
@ -4591,6 +4608,7 @@ func NewE2ETestNodePreparer(client clientset.Interface, countToStrategy []testut
|
|||
}
|
||||
}
|
||||
|
||||
// PrepareNodes prepares nodes in the cluster.
|
||||
func (p *E2ETestNodePreparer) PrepareNodes() error {
|
||||
nodes := GetReadySchedulableNodesOrDie(p.client)
|
||||
numTemplates := 0
|
||||
|
@ -4598,7 +4616,7 @@ func (p *E2ETestNodePreparer) PrepareNodes() error {
|
|||
numTemplates += v.Count
|
||||
}
|
||||
if numTemplates > len(nodes.Items) {
|
||||
return fmt.Errorf("Can't prepare Nodes. Got more templates than existing Nodes.")
|
||||
return fmt.Errorf("Can't prepare Nodes. Got more templates than existing Nodes")
|
||||
}
|
||||
index := 0
|
||||
sum := 0
|
||||
|
@ -4615,6 +4633,7 @@ func (p *E2ETestNodePreparer) PrepareNodes() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// CleanupNodes cleanups nodes in the cluster.
|
||||
func (p *E2ETestNodePreparer) CleanupNodes() error {
|
||||
var encounteredError error
|
||||
nodes := GetReadySchedulableNodesOrDie(p.client)
|
||||
|
@ -4758,12 +4777,13 @@ func PollURL(route, host string, timeout time.Duration, interval time.Duration,
|
|||
return !expectUnreachable, nil
|
||||
})
|
||||
if pollErr != nil {
|
||||
return fmt.Errorf("Failed to execute a successful GET within %v, Last response body for %v, host %v:\n%v\n\n%v\n",
|
||||
return fmt.Errorf("Failed to execute a successful GET within %v, Last response body for %v, host %v:\n%v\n\n%v",
|
||||
timeout, route, host, lastBody, pollErr)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DescribeIng describes information of ingress by running kubectl describe ing.
|
||||
func DescribeIng(ns string) {
|
||||
Logf("\nOutput of kubectl describe ing:\n")
|
||||
desc, _ := RunKubectl(
|
||||
|
@ -4792,12 +4812,13 @@ func (f *Framework) NewTestPod(name string, requests v1.ResourceList, limits v1.
|
|||
}
|
||||
}
|
||||
|
||||
// create empty file at given path on the pod.
|
||||
// CreateEmptyFileOnPod creates empty file at given path on the pod.
|
||||
func CreateEmptyFileOnPod(namespace string, podName string, filePath string) error {
|
||||
_, err := RunKubectl("exec", fmt.Sprintf("--namespace=%s", namespace), podName, "--", "/bin/sh", "-c", fmt.Sprintf("touch %s", filePath))
|
||||
return err
|
||||
}
|
||||
|
||||
// PrintSummaries prints summaries of tests.
|
||||
func PrintSummaries(summaries []TestDataSummary, testBaseName string) {
|
||||
now := time.Now()
|
||||
for i := range summaries {
|
||||
|
@ -4834,6 +4855,7 @@ func PrintSummaries(summaries []TestDataSummary, testBaseName string) {
|
|||
}
|
||||
}
|
||||
|
||||
// DumpDebugInfo dumps debug info of tests.
|
||||
func DumpDebugInfo(c clientset.Interface, ns string) {
|
||||
sl, _ := c.CoreV1().Pods(ns).List(metav1.ListOptions{LabelSelector: labels.Everything().String()})
|
||||
for _, s := range sl.Items {
|
||||
|
@ -4924,6 +4946,7 @@ func WaitForPersistentVolumeClaimDeleted(c clientset.Interface, ns string, pvcNa
|
|||
return fmt.Errorf("PersistentVolumeClaim %s is not removed from the system within %v", pvcName, timeout)
|
||||
}
|
||||
|
||||
// GetClusterZones returns the values of zone label collected from all nodes.
|
||||
func GetClusterZones(c clientset.Interface) (sets.String, error) {
|
||||
nodes, err := c.CoreV1().Nodes().List(metav1.ListOptions{})
|
||||
if err != nil {
|
||||
|
|
|
@ -860,29 +860,6 @@ func executeBacksideBacksideHTTPSTest(f *framework.Framework, jig *ingress.TestJ
|
|||
Expect(err).NotTo(HaveOccurred(), "Failed to verify backside re-encryption ingress")
|
||||
}
|
||||
|
||||
func detectHTTPVersionAndSchemeTest(f *framework.Framework, jig *ingress.TestJig, address, version, scheme string) {
|
||||
timeoutClient := &http.Client{Timeout: ingress.IngressReqTimeout}
|
||||
resp := ""
|
||||
err := wait.PollImmediate(framework.LoadBalancerPollInterval, framework.LoadBalancerPollTimeout, func() (bool, error) {
|
||||
var err error
|
||||
resp, err = framework.SimpleGET(timeoutClient, fmt.Sprintf("http://%s", address), "")
|
||||
if err != nil {
|
||||
framework.Logf("SimpleGET failed: %v", err)
|
||||
return false, nil
|
||||
}
|
||||
if !strings.Contains(resp, version) {
|
||||
framework.Logf("Waiting for transition to HTTP/2")
|
||||
return false, nil
|
||||
}
|
||||
if !strings.Contains(resp, scheme) {
|
||||
return false, nil
|
||||
}
|
||||
framework.Logf("Poll succeeded, request was served by HTTP2")
|
||||
return true, nil
|
||||
})
|
||||
Expect(err).NotTo(HaveOccurred(), fmt.Sprintf("Failed to get %s or %s, response body: %s", version, scheme, resp))
|
||||
}
|
||||
|
||||
func detectNegAnnotation(f *framework.Framework, jig *ingress.TestJig, gceController *gce.IngressController, ns, name string, negs int) {
|
||||
if err := wait.Poll(5*time.Second, negUpdateTimeout, func() (bool, error) {
|
||||
svc, err := f.ClientSet.CoreV1().Services(ns).Get(name, metav1.GetOptions{})
|
||||
|
|
|
@ -287,18 +287,6 @@ var _ = SIGDescribe("[Feature:PodPreset] PodPreset", func() {
|
|||
})
|
||||
})
|
||||
|
||||
func getPodPreset(c clientset.Interface, ns, name string) (*settings.PodPreset, error) {
|
||||
return c.SettingsV1alpha1().PodPresets(ns).Get(name, metav1.GetOptions{})
|
||||
}
|
||||
|
||||
func createPodPreset(c clientset.Interface, ns string, job *settings.PodPreset) (*settings.PodPreset, error) {
|
||||
return c.SettingsV1alpha1().PodPresets(ns).Create(job)
|
||||
}
|
||||
|
||||
func updatePodPreset(c clientset.Interface, ns string, job *settings.PodPreset) (*settings.PodPreset, error) {
|
||||
return c.SettingsV1alpha1().PodPresets(ns).Update(job)
|
||||
}
|
||||
|
||||
func deletePodPreset(c clientset.Interface, ns, name string) error {
|
||||
return c.SettingsV1alpha1().PodPresets(ns).Delete(name, nil)
|
||||
}
|
||||
|
|
|
@ -57,9 +57,7 @@ go_library(
|
|||
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/util/strategicpatch:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/util/uuid:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/util/version:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/util/wait:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/version:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/watch:go_default_library",
|
||||
"//staging/src/k8s.io/apiserver/pkg/authentication/serviceaccount:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
||||
|
|
|
@ -47,17 +47,6 @@ var (
|
|||
}
|
||||
)
|
||||
|
||||
func csiContainerImage(image string) string {
|
||||
var fullName string
|
||||
fullName += *csiImageRegistry + "/" + image + ":"
|
||||
if *csiImageVersion != "" {
|
||||
fullName += *csiImageVersion
|
||||
} else {
|
||||
fullName += csiImageVersions[image]
|
||||
}
|
||||
return fullName
|
||||
}
|
||||
|
||||
func shredFile(filePath string) {
|
||||
if _, err := os.Stat(filePath); os.IsNotExist(err) {
|
||||
framework.Logf("File %v was not found, skipping shredding", filePath)
|
||||
|
|
|
@ -27,9 +27,6 @@ import (
|
|||
. "github.com/onsi/ginkgo"
|
||||
"k8s.io/api/core/v1"
|
||||
apierrs "k8s.io/apimachinery/pkg/api/errors"
|
||||
versionutil "k8s.io/apimachinery/pkg/util/version"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
"k8s.io/apimachinery/pkg/version"
|
||||
clientset "k8s.io/client-go/kubernetes"
|
||||
"k8s.io/kubernetes/test/e2e/framework"
|
||||
"k8s.io/kubernetes/test/e2e/framework/testfiles"
|
||||
|
@ -144,24 +141,6 @@ func sshAndLog(cmd, host string, failOnError bool) {
|
|||
}
|
||||
}
|
||||
|
||||
func getMasterVersion(c clientset.Interface) (*versionutil.Version, error) {
|
||||
var err error
|
||||
var v *version.Info
|
||||
waitErr := wait.PollImmediate(5*time.Second, 2*time.Minute, func() (bool, error) {
|
||||
v, err = c.Discovery().ServerVersion()
|
||||
return err == nil, nil
|
||||
})
|
||||
if waitErr != nil {
|
||||
return nil, fmt.Errorf("Could not get the master version: %v", waitErr)
|
||||
}
|
||||
|
||||
return versionutil.MustParseSemantic(v.GitVersion), nil
|
||||
}
|
||||
|
||||
func getNodeVersion(node *v1.Node) *versionutil.Version {
|
||||
return versionutil.MustParseSemantic(node.Status.NodeInfo.KubeletVersion)
|
||||
}
|
||||
|
||||
func getHostFromHostPort(hostPort string) string {
|
||||
// try to split host and port
|
||||
var host string
|
||||
|
|
|
@ -542,30 +542,6 @@ func getTwoRandomZones(c clientset.Interface) []string {
|
|||
return []string{zone1, zone2}
|
||||
}
|
||||
|
||||
// Waits for at least 1 replica of a StatefulSet to become not ready or until timeout occurs, whichever comes first.
|
||||
func waitForStatefulSetReplicasNotReady(statefulSetName, ns string, c clientset.Interface) error {
|
||||
const poll = 3 * time.Second
|
||||
const timeout = statefulSetReadyTimeout
|
||||
|
||||
framework.Logf("Waiting up to %v for StatefulSet %s to have at least 1 replica to become not ready", timeout, statefulSetName)
|
||||
for start := time.Now(); time.Since(start) < timeout; time.Sleep(poll) {
|
||||
sts, err := c.AppsV1().StatefulSets(ns).Get(statefulSetName, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
framework.Logf("Get StatefulSet %s failed, ignoring for %v: %v", statefulSetName, poll, err)
|
||||
continue
|
||||
} else {
|
||||
if sts.Status.ReadyReplicas < *sts.Spec.Replicas {
|
||||
framework.Logf("%d replicas are ready out of a total of %d replicas in StatefulSet %s. (%v)",
|
||||
sts.Status.ReadyReplicas, *sts.Spec.Replicas, statefulSetName, time.Since(start))
|
||||
return nil
|
||||
} else {
|
||||
framework.Logf("StatefulSet %s found but there are %d ready replicas and %d total replicas.", statefulSetName, sts.Status.ReadyReplicas, *sts.Spec.Replicas)
|
||||
}
|
||||
}
|
||||
}
|
||||
return fmt.Errorf("All replicas in StatefulSet %s are still ready within %v", statefulSetName, timeout)
|
||||
}
|
||||
|
||||
// If match is true, check if zones in PV exactly match zones given.
|
||||
// Otherwise, check whether zones in PV is superset of zones given.
|
||||
func verifyZonesInPV(volume *v1.PersistentVolume, zones sets.String, match bool) error {
|
||||
|
|
|
@ -641,14 +641,6 @@ func volumeFormatPod(f *framework.Framework, volumeSource *v1.VolumeSource) *v1.
|
|||
}
|
||||
}
|
||||
|
||||
func clearSubpathPodCommands(pod *v1.Pod) {
|
||||
pod.Spec.InitContainers[0].Command = nil
|
||||
pod.Spec.InitContainers[1].Args = nil
|
||||
pod.Spec.InitContainers[2].Args = nil
|
||||
pod.Spec.Containers[0].Args = nil
|
||||
pod.Spec.Containers[1].Args = nil
|
||||
}
|
||||
|
||||
func setInitCommand(pod *v1.Pod, command string) {
|
||||
pod.Spec.InitContainers[0].Command = []string{"/bin/sh", "-ec", command}
|
||||
}
|
||||
|
|
|
@ -53,16 +53,6 @@ func isSharedPIDNamespaceSupported() (bool, error) {
|
|||
return version.GTE(semver.MustParse("1.26.0")), nil
|
||||
}
|
||||
|
||||
// isDockerNoNewPrivilegesSupported returns true if Docker version is 1.11+
|
||||
// (API version 1.23+), and false otherwise.
|
||||
func isDockerNoNewPrivilegesSupported() (bool, error) {
|
||||
version, err := getDockerAPIVersion()
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return version.GTE(semver.MustParse("1.23.0")), nil
|
||||
}
|
||||
|
||||
// isDockerLiveRestoreSupported returns true if live-restore is supported in
|
||||
// the current Docker version.
|
||||
func isDockerLiveRestoreSupported() (bool, error) {
|
||||
|
|
|
@ -85,23 +85,6 @@ func (n *NodeE2ERemote) SetupTestPackage(tardir, systemSpecName string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// dest is relative to the root of the tar
|
||||
func tarAddFile(tar, source, dest string) error {
|
||||
dir := filepath.Dir(dest)
|
||||
tardir := filepath.Join(tar, dir)
|
||||
tardest := filepath.Join(tar, dest)
|
||||
|
||||
out, err := exec.Command("mkdir", "-p", tardir).CombinedOutput()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create archive bin subdir %q, was dest for file %q. Err: %v. Output:\n%s", tardir, source, err, out)
|
||||
}
|
||||
out, err = exec.Command("cp", source, tardest).CombinedOutput()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to copy file %q to the archive bin subdir %q. Err: %v. Output:\n%s", source, tardir, err, out)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// prependCOSMounterFlag prepends the flag for setting the GCI mounter path to
|
||||
// args and returns the result.
|
||||
func prependCOSMounterFlag(args, host, workspace string) (string, error) {
|
||||
|
|
|
@ -17,7 +17,7 @@ include ../../hack/make-rules/Makefile.manifest
|
|||
REGISTRY ?= gcr.io/kubernetes-e2e-test-images
|
||||
GOARM=7
|
||||
QEMUVERSION=v2.9.1
|
||||
GOLANG_VERSION=1.12.1
|
||||
GOLANG_VERSION=1.12.4
|
||||
export
|
||||
|
||||
ifndef WHAT
|
||||
|
|
|
@ -33,11 +33,6 @@ import (
|
|||
|
||||
type runnerMap map[string]common.Runner
|
||||
|
||||
type runRequestJSON struct {
|
||||
runner string
|
||||
options interface{}
|
||||
}
|
||||
|
||||
var (
|
||||
// flags for the command line. See usage args below for
|
||||
// descriptions.
|
||||
|
@ -157,6 +152,3 @@ func handleRunRequest(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
fmt.Fprintf(w, "ok\noutput:\n\n"+output.b.String())
|
||||
}
|
||||
|
||||
func setupLogger() {
|
||||
}
|
||||
|
|
|
@ -62,11 +62,6 @@ func (a *atomicBool) get() bool {
|
|||
return atomic.LoadInt32(&a.v) == 1
|
||||
}
|
||||
|
||||
type output struct {
|
||||
responses []string
|
||||
errors []string
|
||||
}
|
||||
|
||||
func init() {
|
||||
flag.IntVar(&httpPort, "http-port", 8080, "HTTP Listen Port")
|
||||
flag.IntVar(&udpPort, "udp-port", 8081, "UDP Listen Port")
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue