Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ernest Wong
committed
Jun 1, 2020
1 parent
893ebbb
commit a2dfcf2
Showing
16 changed files
with
136 additions
and
399 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
117 changes: 117 additions & 0 deletions
117
templates/test/prow-machine-pool-ci-version/patches/machine-pool-ci-version.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3 | ||
kind: KubeadmConfig | ||
metadata: | ||
name: ${CLUSTER_NAME}-mp-0 | ||
spec: | ||
preKubeadmCommands: | ||
- bash -c /tmp/kubeadm-bootstrap.sh | ||
files: | ||
- path: /tmp/kubeadm-bootstrap.sh | ||
owner: "root:root" | ||
permissions: "0744" | ||
content: | | ||
#!/bin/bash | ||
set -o nounset | ||
set -o pipefail | ||
set -o errexit | ||
[[ $(id -u) != 0 ]] && SUDO="sudo" || SUDO="" | ||
GSUTIL=gsutil | ||
if ! command -v $${GSUTIL} > /dev/null; then | ||
curl -sSL https://sdk.cloud.google.com > /tmp/gcl && bash /tmp/gcl --install-dir=~/gcloud --disable-prompts > /dev/null 2>&1 | ||
GSUTIL=~/gcloud/google-cloud-sdk/bin/gsutil | ||
# For faster downloads | ||
pip install --no-cache-dir -U crcmod | ||
fi | ||
$${GSUTIL} version | ||
# This test installs release packages or binaries that are a result of the CI and release builds. | ||
# It runs '... --version' commands to verify that the binaries are correctly installed | ||
# and finally uninstalls the packages. | ||
# For the release packages it tests all versions in the support skew. | ||
LINE_SEPARATOR="*************************************************" | ||
echo "$$LINE_SEPARATOR" | ||
CI_VERSION=${CI_VERSION} | ||
if [[ "$${CI_VERSION}" != "" ]]; then | ||
CI_DIR=/tmp/k8s-ci | ||
mkdir -p $$CI_DIR | ||
declare -a PACKAGES_TO_TEST=("kubectl" "kubelet" "kubeadm") | ||
declare -a CONTAINERS_TO_TEST=("kube-apiserver" "kube-controller-manager" "kube-proxy" "kube-scheduler") | ||
CONTAINER_EXT="tar" | ||
echo "* testing CI version $$CI_VERSION" | ||
# Check for semver | ||
if [[ "$${CI_VERSION}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | ||
CI_URL="gs://kubernetes-release/release/$$CI_VERSION/bin/linux/amd64" | ||
VERSION_WITHOUT_PREFIX="${CI_VERSION#v}" | ||
DEBIAN_FRONTEND=noninteractive apt-get install -y apt-transport-https curl | ||
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - | ||
echo 'deb https://apt.kubernetes.io/ kubernetes-xenial main' > /etc/apt/sources.list.d/kubernetes.list | ||
apt-get update | ||
# replace . with \. | ||
VERSION_REGEX="${VERSION_WITHOUT_PREFIX//./\\.}" | ||
PACKAGE_VERSION="$(apt-cache madison kubelet|grep $${VERSION_REGEX}- | head -n1 | cut -d '|' -f 2 | tr -d '[:space:]')" | ||
for CI_PACKAGE in "$${PACKAGES_TO_TEST[@]}"; do | ||
echo "* installing package: $$CI_PACKAGE $${PACKAGE_VERSION}" | ||
DEBIAN_FRONTEND=noninteractive apt-get install -y $$CI_PACKAGE=$$PACKAGE_VERSION | ||
done | ||
else | ||
CI_URL="gs://kubernetes-release-dev/ci/$$CI_VERSION-bazel/bin/linux/amd64" | ||
for CI_PACKAGE in "$${PACKAGES_TO_TEST[@]}"; do | ||
echo "* downloading binary: $$CI_URL/$$CI_PACKAGE" | ||
$${GSUTIL} cp "$$CI_URL/$$CI_PACKAGE" "$$CI_DIR/$$CI_PACKAGE" | ||
chmod +x "$$CI_DIR/$$CI_PACKAGE" | ||
mv "$$CI_DIR/$$CI_PACKAGE" "/usr/bin/$$CI_PACKAGE" | ||
done | ||
systemctl restart kubelet | ||
fi | ||
for CI_CONTAINER in "$${CONTAINERS_TO_TEST[@]}"; do | ||
echo "* downloading package: $$CI_URL/$$CI_CONTAINER.$$CONTAINER_EXT" | ||
$${GSUTIL} cp "$$CI_URL/$$CI_CONTAINER.$$CONTAINER_EXT" "$$CI_DIR/$$CI_CONTAINER.$$CONTAINER_EXT" | ||
$${SUDO} ctr -n k8s.io images import "$$CI_DIR/$$CI_CONTAINER.$$CONTAINER_EXT" || echo "* ignoring expected 'ctr images import' result" | ||
$${SUDO} ctr -n k8s.io images tag k8s.gcr.io/$$CI_CONTAINER-amd64:"$${CI_VERSION//+/_}" k8s.gcr.io/$$CI_CONTAINER:"$${CI_VERSION//+/_}" | ||
$${SUDO} ctr -n k8s.io images tag k8s.gcr.io/$$CI_CONTAINER-amd64:"$${CI_VERSION//+/_}" gcr.io/kubernetes-ci-images/$$CI_CONTAINER:"$${CI_VERSION//+/_}" | ||
done | ||
fi | ||
echo "* checking binary versions" | ||
echo "ctr version: " $(ctr version) | ||
echo "kubeadm version: " $(kubeadm version -o=short) | ||
echo "kubectl version: " $(kubectl version --client=true --short=true) | ||
echo "kubelet version: " $(kubelet --version) | ||
echo "$$LINE_SEPARATOR" | ||
- path: /etc/kubernetes/azure.json | ||
owner: "root:root" | ||
permissions: "0644" | ||
content: | | ||
{ | ||
"cloud": "AzurePublicCloud", | ||
"tenantId": "${AZURE_TENANT_ID}", | ||
"subscriptionId": "${AZURE_SUBSCRIPTION_ID}", | ||
"aadClientId": "${AZURE_CLIENT_ID}", | ||
"aadClientSecret": "${AZURE_CLIENT_SECRET}", | ||
"resourceGroup": "${CLUSTER_NAME}", | ||
"securityGroupName": "${CLUSTER_NAME}-node-nsg", | ||
"location": "${AZURE_LOCATION}", | ||
"vmType": "vmss", | ||
"vnetName": "${CLUSTER_NAME}-vnet", | ||
"vnetResourceGroup": "${CLUSTER_NAME}", | ||
"subnetName": "${CLUSTER_NAME}-node-subnet", | ||
"routeTableName": "${CLUSTER_NAME}-node-routetable", | ||
"loadBalancerSku": "standard", | ||
"maximumLoadBalancerRuleCount": 250, | ||
"useManagedIdentityExtension": false, | ||
"useInstanceMetadata": true | ||
} | ||
--- | ||
apiVersion: exp.infrastructure.cluster.x-k8s.io/v1alpha3 | ||
kind: AzureMachinePool | ||
metadata: | ||
name: ${CLUSTER_NAME}-mp-0 | ||
spec: | ||
template: | ||
image: | ||
# we use the 1.18.2 image as a workaround there is no published marketplace image for k8s CI versions. | ||
# 1.18.2 binaries and images will get replaced to the desired version by the script above. | ||
marketplace: | ||
publisher: cncf-upstream | ||
offer: capi | ||
sku: k8s-1dot18dot2-ubuntu-1804 | ||
version: "2020.04.17" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.