From 38199a465493f038ef349b5c2694c98da6d40ede Mon Sep 17 00:00:00 2001 From: Artem Glazychev Date: Wed, 23 Mar 2022 19:29:59 +0700 Subject: [PATCH] Semantic fix Signed-off-by: Artem Glazychev --- .github/workflows/ci.yaml | 12 ++++++------ scripts/create-kubernetes-cluster.sh | 8 ++++---- scripts/k8s/start-master.sh | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 80034573..c7a551c4 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -66,12 +66,12 @@ jobs: git diff --name-only --exit-code go.sum || ( echo "Run go tidy" && false ) packet: - name: packet (Calico ${{ matrix.calico }}) + name: packet (CNI ${{ matrix.CNI }}) runs-on: ubuntu-latest strategy: fail-fast: false matrix: - calico: ["off", "on"] + CNI: ["default", "calico"] steps: - name: Set up /bin permissions # 1. Set up /bin permissions run: | @@ -94,11 +94,11 @@ jobs: - name: Compute suffix # 5. Compute suffix for cloudtest input and output paths id: suffix run: | - if [[ "${CALICO}" == "on" ]]; then + if [[ "${CNI}" == "calico" ]]; then echo ::set-output name=val::_calico fi env: - CALICO: ${{ matrix.calico }} + CNI: ${{ matrix.CNI }} - name: Checkout files # 6. Checkout files uses: actions/checkout@v2 with: @@ -111,7 +111,7 @@ jobs: PACKET_AUTH_TOKEN: ${{ secrets.PACKET_AUTH_TOKEN }} PACKET_PROJECT_ID: 383890d0-f5d1-4de1-881a-4d1ede549d18 KUBERNETES_VERSION: ${{ secrets.NSM_KUBERNETES_VERSION }} - CALICO: ${{ matrix.calico }} + CNI: ${{ matrix.CNI }} suffix: ${{ steps.suffix.outputs.val }} - name: Publish test report # 8. Publish test report uses: mikepenz/action-junit-report@v2.1.0 @@ -120,7 +120,7 @@ jobs: report_paths: "**/cloud_test${{ steps.suffix.outputs.val }}/results/junit.xml" suite_regex: "Test*" github_token: ${{ secrets.GITHUB_TOKEN }} - check_name: "JUnit Test Report (Calico ${{ matrix.calico }})" + check_name: "JUnit Test Report (CNI ${{ matrix.CNI }})" - name: Upload logs # 9. Upload logs uses: actions/upload-artifact@v2 if: ${{ always() }} diff --git a/scripts/create-kubernetes-cluster.sh b/scripts/create-kubernetes-cluster.sh index cff6172b..a02bcc4b 100755 --- a/scripts/create-kubernetes-cluster.sh +++ b/scripts/create-kubernetes-cluster.sh @@ -8,7 +8,7 @@ sshkey=$3 SSH_CONFIG="ssh_config" SSH_OPTS="-F ${SSH_CONFIG} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o IdentitiesOnly=yes -i ${sshkey}" -if [[ "$CALICO" == "on" ]]; then # calico +if [[ "$CNI" == "calico" ]]; then # calico # Use a new 10.0.0.${base_ip}/30 subnet to prevent IP addresses collisions # ${base_ip} should be <= 248, because 10.0.0.252/30 subnet is reserved for manual testing base_ip=$(( GITHUB_RUN_NUMBER % 63 * 4 )) @@ -19,7 +19,7 @@ if [[ "$CALICO" == "on" ]]; then # calico CALICO_INTERFACE="eno2" fi -ENVS="KUBERNETES_VERSION CALICO" +ENVS="KUBERNETES_VERSION CNI" # wait_pids pid_1 ... pid_n source scripts/include/wait-pids.sh @@ -52,7 +52,7 @@ pids="" pids+=" $!" wait_pids "${pids}" "SR-IOV config failed" || exit 21 -if [[ "$CALICO" == "on" ]]; then # calico +if [[ "$CNI" == "calico" ]]; then # calico # 3. Create Calico scripts directory on nodes. ssh ${SSH_OPTS} root@${master_ip} mkdir -p calico || exit 31 ssh ${SSH_OPTS} root@${worker_ip} mkdir -p calico || exit 32 @@ -123,7 +123,7 @@ wait_pids "${pids}" "worker join failed" || exit 94 # 10. Save KUBECONFIG to file. scp ${SSH_OPTS} root@${master_ip}:.kube/config ${KUBECONFIG} || exit 101 -if [[ "$CALICO" == "on" ]]; then # calico +if [[ "$CNI" == "calico" ]]; then # calico # 11. Setup cluster nodes IPs. scp ${SSH_OPTS} scripts/calico/setup-node-ip.sh root@${master_ip}:calico/setup-node-ip.sh || exit 111 scp ${SSH_OPTS} scripts/calico/setup-node-ip.sh root@${worker_ip}:calico/setup-node-ip.sh || exit 112 diff --git a/scripts/k8s/start-master.sh b/scripts/k8s/start-master.sh index 42c3ef32..ba5e301b 100755 --- a/scripts/k8s/start-master.sh +++ b/scripts/k8s/start-master.sh @@ -8,10 +8,10 @@ calico_ip="$2" K8S_DIR=$(dirname "$0") -if [[ "$CALICO" != "on" ]]; then # not calico - ip="${public_ip}" -else +if [[ "$CNI" == "calico" ]]; then # calico ip="${calico_ip}" +else + ip="${public_ip}" fi kubeadm init \ @@ -24,13 +24,13 @@ mkdir -p ~/.kube cp -f /etc/kubernetes/admin.conf ~/.kube/config chown "$(id -u):$(id -g)" ~/.kube/config -if [[ "$CALICO" != "on" ]]; then # not calico +if [[ "$CNI" == "default" ]]; then kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')&env.IPALLOC_RANGE=192.168.0.0/16" fi kubectl taint nodes --all node-role.kubernetes.io/master- -if [[ "$CALICO" == "on" ]]; then # calico +if [[ "$CNI" == "calico" ]]; then # calico kubectl -n kube-system get configmap kubeadm-config -o jsonpath='{.data.ClusterConfiguration}' > kubeadm.yaml sed -i "/^apiServer:$/a \ \ certSANs:\n - \"${public_ip}\"\n - \"${calico_ip}\"" kubeadm.yaml