Skip to content

deploy meshery istio #44

deploy meshery istio

deploy meshery istio #44

Workflow file for this run

name: E2E tests for MeshSync
on: [push]
# push:
# branches:
# - "*"
# pull_request:
# branches:
# - "*"
jobs:
e2e-test:
name: End to End
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
k8s_version: ['v1.27.3']
# platform: ['docker', 'kubernetes']
steps:
- name: Setup Kubernetes
uses: manusa/[email protected]
with:
minikube version: 'v1.30.1'
kubernetes version: ${{matrix.k8s_version}}
driver: docker
# - name: Run minikube tunnel
# run: |
# echo 'Running minikube tunnel'
# minikube tunnel $> /dev/null &
# shell: bash
- name: Checkout Code
uses: actions/checkout@master
- name: Retrieve kubeconfig
run: |
echo "Before flattening"
cat ~/.kube/config
kubectl config view --minify --flatten > ~/.kube/configtemp
mv ~/.kube/configtemp ~/.kube/config
echo "After flattening"
cat ~/.kube/config
# Setup meshery config.yaml and auth.json
- name: Setup meshery config and infinite token for use
env:
provider_token: ${{ secrets.PROVIDER_TOKEN }}
provider: "Meshery"
run: |
echo $provider_token
mkdir ~/.meshery
config='{"contexts":{"local":{"endpoint":"http://localhost:9081","token":"default","platform":"kubernetes","components":[],"channel":"stable","version":"latest"}},"current-context":"local","tokens":[{"location":"auth.json","name":"default"}]}'
echo $config > ~/.meshery/config.yaml
cat ~/.meshery/config.yaml
echo "Using provider": $provider
if [ $provider = "Meshery" ] && [ "$provider_token" != "" ] ;then
echo '{ "meshery-provider": "Meshery", "token": null }' | jq -c '.token = "'$provider_token'"' > ~/.meshery/auth.json
else
echo '{ "meshery-provider": "None", "token": "" }' > ~/.meshery/auth.json
fi
cat ~/.meshery/auth.json
- name: Cluster info for debugging before starting Meshery
run: kubectl get all -A
# Start Meshery Server (Assuming that this step will create the meshery namespace)
- name: Start Meshery Server using mesheryctl
run: |
curl -L https://meshery.io/install | PLATFORM=kubernetes bash -
- name: Run minikube tunnel
run: |
echo 'Running minikube tunnel'
minikube tunnel $> /dev/null &
shell: bash
# If external IP has not been allotted then server is unreachable, exit here in that case
- name: Check if Meshery has been allotted external IP
run: |
svcstatus=$(kubectl get svc -n meshery| grep meshery | tr -s ' ' | cut -d " " -f 4)
echo $svcstatus
if [ "$svcstatus" = "<pending>" ];then
exit 1
fi
# Reset meshery's address to the external IP in config.yaml such that mesheryctl can reach it
- name: Reset Meshery address
run: |
kubectl get svc -n meshery
svcip="http://$(kubectl get svc -n meshery | grep "meshery " | tr -s ' ' | cut -d " " -f 3):9081"
echo "this is $svcip"
config='{"contexts":{"local":{"endpoint":'$svcip',"token":"default","platform":"kubernetes","adapters":["meshery-istio"],"channel":"stable","version":"latest"}},"current-context":"local","tokens":[{"location":"auth.json","name":"default"}]}'
echo $config > ~/.meshery/config.yam
mesheryctl mesh deploy meshery-istio
- name: System Checks
run: mesheryctl system check
# - name: Build MeshSync Docker image
# run: |
# docker build -t meshery-meshsync:test .
# Checking meshery server logs
- name: Check Meshery pod logs
run: |
SECONDS=0
end=$((SECONDS+300))
while [ $SECONDS -lt $end ]; do
status=$(mesheryctl system status -v | sed -n 2p | sed -e "s/[[:space:]]\+/ /g" | cut -d " " -f 3)
if [ "$status" = "Running" ];then
break
fi
done
mesheryctl system logs meshery
- name: Replace MeshSync
run: |
# # Set your deployment name, container name, new image version, and new image pull policy
DEPLOYMENT_NAME="meshery-meshsync"
CONTAINER_NAME="meshsync"
NEW_IMAGE_VERSION="meshery-meshsync:test"
NEW_IMAGE_PULL_POLICY="Never"
NAMESPACE="meshery"
# # Update the deployment with the new image and pull policy
# kubectl scale --replicas=0 deployment ${DEPLOYMENT_NAME} -n meshery
# sleep 5
# kubectl set image deployment/${DEPLOYMENT_NAME} ${CONTAINER_NAME}=${NEW_IMAGE_VERSION} -n $NAMESPACE
# kubectl patch -n meshery deployment meshery-meshsync -p '{"spec":{"template":{"spec":{"containers":[{"name":"meshsync","imagePullPolicy":"IfNotPresent", "image":"meshery-meshsync:test"}]}}}}'
# kubectl scale --replicas=1 deployment ${DEPLOYMENT_NAME} -n meshery
# sleep 5
kubectl describe deployment -n $NAMESPACE ${DEPLOYMENT_NAME}
kubectl get pods -A
sleep 30
CLUSTER_ID=$(kubectl get ns kube-system -o jsonpath='{.metadata.uid}')
echo $CLUSTER_ID
# Deploy pod
kubectl run nginx-pod --image=nginx --labels=app=web,tier=frontend,purpose=meshsync-test
svcip="http://$(kubectl get svc -n meshery | grep "meshery " | tr -s ' ' | cut -d " " -f 3):9081"
echo "this is $svcip"
curl --location "${svcip}/api/system/meshsync/resources?kind=Pod&status=true&spec=true&annotations=true&labels=true&clusterIds=%5B\"${CLUSTER_ID}\"%5D&page=0&pagesize=25&search=&order=" \
--header "meshery-token: ${{ secrets.PROVIDER_TOKEN }}" \
--header "Cookie: meshery-provider=Meshery; token=${{ secrets.PROVIDER_TOKEN }}"
shell: bash