Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workflows: refactor EKS workflows #442

Merged
merged 1 commit into from
Jul 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .github/in-cluster-test-scripts/eks-install.sh

This file was deleted.

12 changes: 0 additions & 12 deletions .github/in-cluster-test-scripts/eks-tunnel-install.sh

This file was deleted.

11 changes: 11 additions & 0 deletions .github/in-cluster-test-scripts/eks-tunnel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,23 @@
set -x
set -e

# Install Cilium
cilium install \
--cluster-name "${CLUSTER_NAME}" \
--wait=false \
--config monitor-aggregation=none \
--datapath-mode=tunnel \
--ipam cluster-pool

# Enable Relay
cilium hubble enable

# Wait for Cilium status to be ready
cilium status --wait

# Make sure the 'aws-node' DaemonSet exists but has no scheduled pods
[[ $(kubectl -n kube-system get ds/aws-node -o jsonpath='{.status.currentNumberScheduled}') == 0 ]]

# Port forward Relay
cilium hubble port-forward&
sleep 10s
Expand Down
3 changes: 3 additions & 0 deletions .github/in-cluster-test-scripts/eks-uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ set -e

# Uninstall Cilium
cilium uninstall --wait

# Make sure the 'aws-node' DaemonSet blocking nodeSelector was removed
[[ ! $(kubectl -n kube-system get ds/aws-node -o jsonpath="{.spec.template.spec.nodeSelector['io\.cilium/aws-node-enabled']}") ]]
9 changes: 9 additions & 0 deletions .github/in-cluster-test-scripts/eks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,21 @@
set -x
set -e

# Install Cilium
cilium install \
--cluster-name "${CLUSTER_NAME}" \
--wait=false \
--config monitor-aggregation=none

# Enable Relay
cilium hubble enable

# Wait for Cilium status to be ready
cilium status --wait

# Make sure the 'aws-node' DaemonSet exists but has no scheduled pods
[[ $(kubectl -n kube-system get ds/aws-node -o jsonpath='{.status.currentNumberScheduled}') == 0 ]]

# Port forward Relay
cilium hubble port-forward&
sleep 10s
Expand Down
26 changes: 5 additions & 21 deletions .github/workflows/eks-tunnel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
echo ::set-output name=sha::${SHA}
echo ::set-output name=owner::${OWNER}

- name: Create EKS cluster with nodegroup
- name: Create EKS cluster
run: |
cat <<EOF > eks-config.yaml
apiVersion: eksctl.io/v1alpha5
Expand Down Expand Up @@ -91,23 +91,6 @@ jobs:
.github/get-kubeconfig.sh
kubectl create configmap cilium-cli-kubeconfig -n kube-system --from-file kubeconfig

- name: Load cilium install script in configmap
run: |
kubectl create configmap cilium-cli-test-script-install -n kube-system --from-file=in-cluster-test-script.sh=.github/in-cluster-test-scripts/eks-tunnel-install.sh

- name: Create cilium-cli install job
run: |
helm install .github/cilium-cli-test-job-chart \
--generate-name \
--set tag=${{ steps.vars.outputs.sha }} \
--set cluster_name=${{ env.clusterName }} \
--set job_name=cilium-cli-install \
--set test_script_cm=cilium-cli-test-script-install

- name: Make sure the 'aws-node' DaemonSet exists but has no scheduled pods
run: |
[[ $(kubectl -n kube-system get ds/aws-node -o jsonpath='{.status.currentNumberScheduled}') == 0 ]]

- name: Load cilium cli script in configmap
run: |
kubectl create configmap cilium-cli-test-script -n kube-system --from-file=in-cluster-test-script.sh=.github/in-cluster-test-scripts/eks-tunnel.sh
Expand All @@ -121,13 +104,12 @@ jobs:

- name: Wait for test job
run: |
kubectl -n kube-system wait job/cilium-cli --for=condition=complete --timeout=10m
kubectl -n kube-system wait job/cilium-cli --for=condition=complete --timeout=20m

- name: Post-test information gathering
if: ${{ !success() }}
run: |
echo "=== Retrieve in-cluster jobs logs ==="
kubectl logs --timestamps -n kube-system job/cilium-cli-install
kubectl logs --timestamps -n kube-system job/cilium-cli

echo "\n\n\n=== Install latest stable CLI ==="
Expand All @@ -152,7 +134,9 @@ jobs:
--set job_name=cilium-cli-uninstall \
--set test_script_cm=cilium-cli-test-script-uninstall
kubectl -n kube-system wait job/cilium-cli-uninstall --for=condition=complete --timeout=2m
[[ ! $(kubectl -n kube-system get ds/aws-node -o jsonpath="{.spec.template.spec.nodeSelector['io\.cilium/aws-node-enabled']}") ]]

echo "=== Retrieve in-cluster jobs logs ==="
kubectl logs --timestamps -n kube-system job/cilium-cli-uninstall

- name: Clean up EKS
if: ${{ always() }}
Expand Down
26 changes: 5 additions & 21 deletions .github/workflows/eks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
echo ::set-output name=sha::${SHA}
echo ::set-output name=owner::${OWNER}

- name: Create EKS cluster nodegroup
- name: Create EKS cluster
run: |
cat <<EOF > eks-config.yaml
apiVersion: eksctl.io/v1alpha5
Expand Down Expand Up @@ -91,23 +91,6 @@ jobs:
.github/get-kubeconfig.sh
kubectl create configmap cilium-cli-kubeconfig -n kube-system --from-file kubeconfig

- name: Load cilium install script in configmap
run: |
kubectl create configmap cilium-cli-test-script-install -n kube-system --from-file=in-cluster-test-script.sh=.github/in-cluster-test-scripts/eks-install.sh

- name: Create cilium-cli install job
run: |
helm install .github/cilium-cli-test-job-chart \
--generate-name \
--set tag=${{ steps.vars.outputs.sha }} \
--set cluster_name=${{ env.clusterName }} \
--set job_name=cilium-cli-install \
--set test_script_cm=cilium-cli-test-script-install

- name: Make sure the 'aws-node' DaemonSet exists but has no scheduled pods
run: |
[[ $(kubectl -n kube-system get ds/aws-node -o jsonpath='{.status.currentNumberScheduled}') == 0 ]]

- name: Load cilium cli script in configmap
run: |
kubectl create configmap cilium-cli-test-script -n kube-system --from-file=in-cluster-test-script.sh=.github/in-cluster-test-scripts/eks.sh
Expand All @@ -121,13 +104,12 @@ jobs:

- name: Wait for test job
run: |
kubectl -n kube-system wait job/cilium-cli --for=condition=complete --timeout=10m
kubectl -n kube-system wait job/cilium-cli --for=condition=complete --timeout=20m

- name: Post-test information gathering
if: ${{ !success() }}
run: |
echo "=== Retrieve in-cluster jobs logs ==="
kubectl logs --timestamps -n kube-system job/cilium-cli-install
kubectl logs --timestamps -n kube-system job/cilium-cli

echo "\n\n\n=== Install latest stable CLI ==="
Expand All @@ -152,7 +134,9 @@ jobs:
--set job_name=cilium-cli-uninstall \
--set test_script_cm=cilium-cli-test-script-uninstall
kubectl -n kube-system wait job/cilium-cli-uninstall --for=condition=complete --timeout=2m
[[ ! $(kubectl -n kube-system get ds/aws-node -o jsonpath="{.spec.template.spec.nodeSelector['io\.cilium/aws-node-enabled']}") ]]

echo "=== Retrieve in-cluster jobs logs ==="
kubectl logs --timestamps -n kube-system job/cilium-cli-uninstall

- name: Clean up EKS
if: ${{ always() }}
Expand Down