forked from kubernetes-sigs/kind
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
bd53bda
commit 4050a5d
Showing
1 changed file
with
118 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
name: Istio | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
pull_request: | ||
branches: | ||
- main | ||
paths-ignore: | ||
- 'site/**' | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
Istio: | ||
name: Istio | ||
runs-on: ubuntu-20.04 | ||
timeout-minutes: 30 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
ipFamily: [ipv4] | ||
deployment: [singleNode, multiNode] | ||
env: | ||
JOB_NAME: "docker-${{ matrix.deployment }}-${{ matrix.ipFamily }}" | ||
IP_FAMILY: ${{ matrix.ipFamily }} | ||
steps: | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | ||
|
||
- name: Install kind | ||
run: sudo make install INSTALL_DIR=/usr/local/bin | ||
|
||
- name: Install kubectl | ||
run: | | ||
curl -LO https://dl.k8s.io/release/$(curl -sL https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl | ||
chmod +x ./kubectl | ||
sudo mv ./kubectl /usr/local/bin/kubectl | ||
- name: Enable ipv4 and ipv6 forwarding | ||
run: | | ||
sudo sysctl -w net.ipv6.conf.all.forwarding=1 | ||
sudo sysctl -w net.ipv4.ip_forward=1 | ||
- name: Create single node cluster | ||
if: ${{ matrix.deployment == 'singleNode' }} | ||
run: | | ||
cat <<EOF | /usr/local/bin/kind create cluster -v7 --wait 1m --retain --config=- | ||
kind: Cluster | ||
apiVersion: kind.x-k8s.io/v1alpha4 | ||
networking: | ||
ipFamily: ${IP_FAMILY} | ||
EOF | ||
- name: Create multi node cluster | ||
if: ${{ matrix.deployment == 'multiNode' }} | ||
run: | | ||
cat <<EOF | /usr/local/bin/kind create cluster -v7 --wait 1m --retain --config=- | ||
kind: Cluster | ||
apiVersion: kind.x-k8s.io/v1alpha4 | ||
networking: | ||
ipFamily: ${IP_FAMILY} | ||
nodes: | ||
- role: control-plane | ||
- role: worker | ||
- role: worker | ||
EOF | ||
- name: Get Cluster status | ||
run: | | ||
# wait network is ready | ||
kubectl wait --for=condition=ready pods --namespace=kube-system -l k8s-app=kube-dns | ||
kubectl get nodes -o wide | ||
kubectl get pods -A | ||
ping -c 5 172.18.0.2 | ||
- name: Install Helm | ||
run: | | ||
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | ||
chmod 700 get_helm.sh | ||
./get_helm.sh | ||
- name: Install and configure Istio | ||
run: | | ||
curl -L https://istio.io/downloadIstio | sh - | ||
cd istio-1.20.2 | ||
export PATH=$PWD/bin:$PATH | ||
istioctl install --set profile=demo -y | ||
kubectl label namespace default istio-injection=enabled | ||
- name: Deploy nginx | ||
run: | | ||
kubectl create deployment nginx --image=nginx --replicas=3 | ||
kubectl wait pod --all --for=condition=Ready -n default | ||
kubectl expose deployment nginx --name=nginx --type=LoadBalancer --port=80 | ||
kubectl get pods | ||
kubectl get services | ||
kubectl describe services nginx | ||
kubectl get services | grep nginx | awk '{ print $4 }' | ||
curl -m 5 http://$(kubectl get services | grep nginx | awk '{ print $4 }'):80 | ||
- name: Export logs | ||
if: always() | ||
run: | | ||
mkdir -p /tmp/kind/logs | ||
/usr/local/bin/kind export logs /tmp/kind/logs | ||
sudo chown -R $USER:$USER /tmp/kind/logs | ||
- name: Upload logs | ||
if: always() | ||
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | ||
with: | ||
name: kind-logs-${{ env.JOB_NAME }}-${{ github.run_id }} | ||
path: /tmp/kind/logs | ||
|
||
- name: Delete cluster | ||
run: /usr/local/bin/kind delete cluster |