Skip to content

Commit aef3156

Browse files
committed
ci: refactoring
1 parent 71d372b commit aef3156

File tree

9 files changed

+27
-16
lines changed

9 files changed

+27
-16
lines changed

test/e2e/cruise/network/network_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ var _ = BeforeSuite(func() {
105105
}
106106

107107
switch testContext.Infrastructure {
108-
case "cluster-api":
108+
case "kubeadm":
109109
overrideArgsClusterAPI(&defaultArgs)
110110
case "k3s":
111111
overrideArgsK3s(&defaultArgs)

test/e2e/pipeline/infra/cluster-api/pre-requirements.sh test/e2e/pipeline/infra/kubeadm/pre-requirements.sh

+2
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,5 @@ setup_arch_and_os
4141
install_kubectl "${OS}" "${ARCH}" "${K8S_VERSION}"
4242

4343
install_helm "${OS}" "${ARCH}"
44+
45+
install_clusterctl "${OS}" "${ARCH}"

test/e2e/pipeline/installer/liqoctl/peer.sh test/e2e/pipeline/installer/liqo/peer.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ do
3333

3434
ARGS=(--kubeconfig "${KUBECONFIG}" --remote-kubeconfig "${PROVIDER_KUBECONFIG}")
3535

36-
if [[ "${INFRA}" == "cluster-api" ]]; then
36+
if [[ "${INFRA}" == "kubeadm" ]]; then
3737
ARGS=("${ARGS[@]}" --server-service-type NodePort)
3838
elif [[ "${INFRA}" == "kind" ]]; then
3939
ARGS=("${ARGS[@]}" --server-service-type NodePort)

test/e2e/pipeline/installer/liqoctl/setup.sh test/e2e/pipeline/installer/liqo/setup.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ do
108108
COMMON_ARGS=("${COMMON_ARGS[@]}" --project-id "${GCLOUD_PROJECT_ID}" --zone "${GKE_ZONES[$i-1]}" --credentials-path "${GCLOUD_KEY_FILE}")
109109
fi
110110

111-
if [[ "${INFRA}" == "cluster-api" ]]; then
111+
if [[ "${INFRA}" == "kubeadm" ]]; then
112112
LIQO_PROVIDER="kubeadm"
113113
COMMON_ARGS=("${COMMON_ARGS[@]}" --set "networking.gatewayTemplates.replicas=$HA_REPLICAS" )
114114
COMMON_ARGS=("${COMMON_ARGS[@]}" --set "ipam.internal.replicas=$HA_REPLICAS" )

test/e2e/pipeline/utils.sh

+22-13
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function setup_arch_and_os(){
5252

5353
OS=$(uname |tr '[:upper:]' '[:lower:]')
5454
case "$OS" in
55-
# Minimalist GNU for Windows
55+
# Minimalist GNU for Windows
5656
"mingw"*) OS='windows'; return ;;
5757
esac
5858
}
@@ -89,11 +89,11 @@ function install_kubectl() {
8989

9090
if ! command -v "${KUBECTL}" &> /dev/null
9191
then
92-
echo "WARNING: kubectl could not be found. Downloading and installing it locally..."
93-
if ! curl --fail -Lo "${KUBECTL}" "https://dl.k8s.io/release/${version}/bin/${os}/${arch}/kubectl"; then
94-
echo "Error: Unable to download kubectl for '${os}-${arch}'"
95-
return 1
96-
fi
92+
echo "WARNING: kubectl could not be found. Downloading and installing it locally..."
93+
if ! curl --fail -Lo "${KUBECTL}" "https://dl.k8s.io/release/${version}/bin/${os}/${arch}/kubectl"; then
94+
echo "Error: Unable to download kubectl for '${os}-${arch}'"
95+
return 1
96+
fi
9797
fi
9898

9999
chmod +x "${KUBECTL}"
@@ -106,7 +106,7 @@ function install_helm() {
106106
local arch=$2
107107

108108
# list of helm supported architectures
109-
local supported="darwin-amd64\ndarwin-arm64\nlinux-386\nlinux-amd64\nlinux-arm\nlinux-arm64\nlinux-ppc64le\nlinux-s390x\nwindows-amd64"
109+
local supported="darwin-amd64\ndarwin-arm64\nlinux-386\nlinux-amd64\nlinux-arm\nlinux-arm64\nlinux-ppc64le\nlinux-s390x\nwindows-amd64"
110110
check_supported_arch_and_os "${supported}" "${os}" "${arch}" helm
111111

112112
HELM_VERSION="v3.15.3"
@@ -115,8 +115,8 @@ function install_helm() {
115115
then
116116
echo "WARNING: helm could not be found. Downloading and installing it locally..."
117117
if ! curl --fail -Lo "./helm-${HELM_VERSION}-${os}-${arch}.tar.gz" "https://get.helm.sh/helm-${HELM_VERSION}-${os}-${arch}.tar.gz"; then
118-
echo "Error: Unable to download helm for '${os}-${arch}'"
119-
return 1
118+
echo "Error: Unable to download helm for '${os}-${arch}'"
119+
return 1
120120
fi
121121
tar -zxvf "helm-${HELM_VERSION}-${os}-${arch}.tar.gz"
122122
mv "${os}-${arch}/helm" "${HELM}"
@@ -142,8 +142,8 @@ function install_metrics_server() {
142142
"${HELM}" repo add metrics-server https://kubernetes-sigs.github.io/metrics-server/
143143
"${HELM}" repo update
144144
"${HELM}" upgrade --install metrics-server metrics-server/metrics-server \
145-
--set 'args={"--kubelet-insecure-tls=true"}' \
146-
--namespace kube-system --kubeconfig "${kubeconfig}"
145+
--set 'args={"--kubelet-insecure-tls=true"}' \
146+
--namespace kube-system --kubeconfig "${kubeconfig}"
147147
"${KUBECTL}" -n kube-system rollout status deployment metrics-server --kubeconfig "${kubeconfig}"
148148
}
149149

@@ -157,7 +157,7 @@ function install_gcloud() {
157157

158158
#Login to gcloud
159159
echo "${GCLOUD_KEY}" | base64 -d > "${GCLOUD_KEY_FILE}"
160-
"${GCLOUD}" auth activate-service-account --key-file="${BINDIR}/gke_key_file.json"
160+
"${GCLOUD}" auth activate-service-account --key-file="${BINDIR}/gke_key_file.json"
161161
"${GCLOUD}" config set project "${GCLOUD_PROJECT_ID}" -q
162162
}
163163

@@ -178,4 +178,13 @@ function wait_kyverno() {
178178
echo "Failed to wait for kyverno deployments to be ready"
179179
exit 1
180180
fi
181-
}
181+
}
182+
183+
function install_clusterctl() {
184+
local os=$1
185+
local arch=$2
186+
187+
curl -L "https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.3.5/clusterctl-${os}-${arch}" -o clusterctl
188+
sudo install -o root -g root -m 0755 clusterctl /usr/local/bin/clusterctl
189+
clusterctl version
190+
}

0 commit comments

Comments
 (0)