Skip to content
This repository has been archived by the owner on Aug 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #32 from DelusionalOptimist/new-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
DelusionalOptimist authored Aug 13, 2021
2 parents 4a1f84c + 2fd60dd commit 56f3439
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 22 deletions.
70 changes: 54 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,45 +39,82 @@ GitHub Action for `mesheryctl mesh validate` for SMI conformance - https://meshe
- [Design Specification](https://docs.google.com/document/d/1HL8Sk7NSLLj-9PRqoHYVIGyU6fZxUQFotrxbmfFtjwc/edit#)
- [Conformance Test Details](https://layer5.io/projects/service-mesh-interface-conformance)

## How to Use
## Usage

* **For initial releases, this action works the best with minikube clusters.**
* We recommend using the [manusa/actions-setup-minikube](https://github.com/manusa/actions-setup-minikube) action.
* We also recommend using the [ubuntu-latest](https://github.com/actions/virtual-environments#available-environments) environment.

### Inputs
```yaml
# this token is used to auth with meshery provider and persist conformance results
provider_token:
description: "Provider token to use. NOTE: value of the 'token' key in auth.json"
required: optional
spec:
description: "Spec to run. Possible values: SMI, istio-vet. (SMP coming soon)"
required: true

# the name of the service mesh to run tests on. Must be in compliance with the Service Mesh Performance specification.
# see: https://github.com/service-mesh-performance/service-mesh-performance/blob/1de8c93d8cba4ba8c1120fe09b7bf6ce0aa48c83/protos/service_mesh.proto#L15-L28
service_mesh:
# used for provisioning appropriate meshery-adatper
description: "Service mesh to use. e.g: osm, istio etc"
description: "SMP compatible name for service mesh to use. e.g: open_service_mesh, istio etc"
required: true
platform:
description: "Platform to deploy meshery on. Possible values: docker, kubernetes"
default: docker

# to identify if you want to run the tests on a cluster having the service
# mesh pre-installed
mesh_deployed:
description: "A boolean. Set to true if you want to do tests on a custom deployment of the service mesh and not only on the latest release"
required: true
```
## Example Configuration
### Example Configurations
#### Running SMI Conformance Tests on latest release of a Service Mesh
```yaml
name: Meshery
name: SMI Conformance Validation using Meshery
on:
push:
tags:
- 'v*'

jobs:
do_conformance:
name: Conformance Validation
runs-on: ubuntu-latest
steps:

# This action takes care of installing a cluster, installing the latest
# release of a service mesh and running SMI Conformance Tests on it
- name: SMI conformance tests
uses: layer5io/mesheryctl-smi-conformance-action@master
with:
provider_token: ${{ secrets.PROVIDER_TOKEN }}
service_mesh: open_service_mesh
mesh_deployed: false
```
#### Running SMI Conformance Tests on any version of a service mesh
```yaml
name: SMI Conformance Validation using Meshery
on:
push:
branches:
- 'master'

jobs:
job1:
name: everything
do_conformance:
name: SMI Conformance on every commit to master
runs-on: ubuntu-latest
steps:

# deploy k8s
- name: Deploy k8s
uses: manusa/[email protected]
with:
minikube version: 'v1.21.0'
kubernetes version: 'v1.20.7'
driver: docker

# Install the wanted version of your service mesh
- name: Install OSM
run: |
curl -LO https://github.com/openservicemesh/osm/releases/download/v0.9.1/osm-v0.9.1-linux-amd64.tar.gz
Expand All @@ -87,12 +124,13 @@ jobs:
PATH="$PATH:$HOME/osm/bin/"
osm-bin install --osm-namespace default
- name: mesheryctl action
# perform SMI conformance validation on the mesh installed in the cluster
- name: SMI conformance tests
uses: layer5io/mesheryctl-smi-conformance-action@master
with:
platform: docker
spec: smi
service_mesh: osm
provider_token: ${{ secrets.PROVIDER_TOKEN }}
service_mesh: open_service_mesh
mesh_deployed: true
```
Expand Down
11 changes: 11 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,24 @@ name: "Service Mesh Interface Conformance with Meshery"
description: "Validate SMI specifications using Meshery"
author: "Layer5"
inputs:
# this token is used to auth with meshery provider and persist conformance results
provider_token:
description: "Provider token to use. NOTE: value of the 'token' key in auth.json"
required: true

# the name of the service mesh to deploy. Must be in compliance with
# https://github.com/service-mesh-performance/service-mesh-performance/blob/1de8c93d8cba4ba8c1120fe09b7bf6ce0aa48c83/protos/service_mesh.proto#L15-L28
service_mesh:
# used for provisioning appropriate meshery-adatper
description: "SMP compatible name for service mesh to use. e.g: open_service_mesh, istio etc"
required: true

# to identify if you want to run the tests on a cluster having the service
# mesh pre-installed
mesh_deployed:
description: "Set to true if you want to do tests on a custom deployment of the service mesh and not only on the latest release"
required: true

runs:
using: "node12"
main: "main.js"
Expand Down
11 changes: 11 additions & 0 deletions main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@ main() {
commandArgs+=(--service-mesh ${meshNameLower})
fi

if [[ -n "${INPUT_MESH_DEPLOYED:-}" ]]; then
boolLower=`echo $INPUT_MESH_DEPLOYED | tr -d '"' | tr '[:upper:]' '[:lower:]'`
if [[ $boolLower != "true" && $boolLower != "false" ]]
then
echo "mesh_deployed should be set to 'true' or 'false'"
exit 1
else
commandArgs+=(--mesh-deployed ${boolLower})
fi
fi

"$SCRIPT_DIR/mesheryctl.sh" "${commandArgs[@]}"
}

Expand Down
5 changes: 2 additions & 3 deletions meshery.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ main() {
parse_command_line "$@"

echo "Checking if a k8s cluster exits..."
kubectl config current-context
if kubectl config current-context
then
echo "Cluster found"
Expand All @@ -37,9 +36,9 @@ main() {
mv ~/minified_config ~/.kube/config

curl -L https://git.io/meshery | DEPLOY_MESHERY=false bash -
mesheryctl system context create new-context --adapters $service_mesh_adapter --platform docker --url http://localhost:9081 --set --yes
#mesheryctl system context create new-context --adapters $service_mesh_adapter --platform docker --url http://localhost:9081 --set --yes

mesheryctl system start
mesheryctl system start --yes

sleep 30
}
Expand Down
20 changes: 17 additions & 3 deletions mesheryctl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ adapters["traefik_mesh"]=meshery-traefik-mesh:10006
main() {
local service_mesh_adapter=
local service_mesh=
local mesh_deployed=

parse_command_line "$@"

Expand All @@ -40,8 +41,13 @@ main() {
minikube tunnel &> /dev/null &
sleep 10

# deploys the service mesh
mesheryctl mesh deploy --adapter $service_mesh_adapter -t ~/auth.json $service_mesh --watch
# deploys the service mesh if not present
if [[ $mesh_deployed != "true" ]]
then
echo "Deploying $service_mesh..."
mesheryctl mesh deploy --adapter $service_mesh_adapter -t ~/auth.json $service_mesh --watch
sleep 30
fi

mesheryctl mesh validate --spec "smi" --adapter $service_mesh_adapter -t ~/auth.json --watch
echo "Uploading results to cloud provider..."
Expand All @@ -54,7 +60,6 @@ parse_command_line() {
case "${1:-}" in
--service-mesh)
if [[ -n "${2:-}" ]]; then
# figure out assigning port numbers and adapter names
service_mesh=$2
service_mesh_adapter=${adapters["$2"]}
shift
Expand All @@ -63,6 +68,15 @@ parse_command_line() {
exit 1
fi
;;
--mesh-deployed)
if [[ -n "${2:-}" ]]; then
mesh_deployed=$2
shift
else
echo "ERROR: '--mesh-deployed' cannot be empty." >&2
exit 1
fi
;;
*)
break
;;
Expand Down

0 comments on commit 56f3439

Please sign in to comment.