Skip to content

Commit cb0a289

Browse files
authored
Merge pull request #3 from navendu-pottekkat/update-action/navendu-pottekkat
2 parents b597eca + 70843a8 commit cb0a289

File tree

6 files changed

+267
-149
lines changed

6 files changed

+267
-149
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,7 @@
1111
# Output of the go coverage tool, specifically when used with LiteIDE
1212
*.out
1313

14+
.vscode/*
15+
1416
# Dependency directories (remove the comment below to include it)
1517
# vendor/

README.md

Lines changed: 210 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,229 @@
1-
# Service Mesh Patterns for mesheryctl GitHub Action
1+
# Meshery - Service Mesh Patterns GitHub Action
22

3-
Incorporate Service Mesh Patterns into your GitHub workflows using Meshery's CLI
3+
GitHub Action to deploy [Service Mesh Patterns](https://layer5.io/learn/service-mesh-books/service-mesh-patterns) on CI/CD pipelines.
44

5-
<div>&nbsp;</div>
5+
## Learn More
6+
7+
- [Functionality: Service Mesh Patterns](https://docs.meshery.io/functionality/pattern-management)
8+
- [Configuring your Deployment with Patterns, Filters and Applications](https://docs.meshery.io/guides/configuration-management#configuring-your-deployment-with-patterns-filters-and-applicatio)
9+
10+
## Supported Service Meshes
11+
12+
Meshery supports 10 different service meshes.
13+
14+
<details>
15+
<summary><strong>See all Supported Service Meshes</strong></summary>
16+
<div class="container flex">
17+
<div class="text editable">
18+
<p>Service mesh adapters provision, configure, and manage their respective service meshes.
19+
<table class="adapters">
20+
<thead style="display:none;">
21+
<th>Status</th>
22+
<th>Adapter</th>
23+
</thead>
24+
<tbody>
25+
<tr>
26+
<td rowspan="9" class="stable-adapters">stable</td>
27+
</tr>
28+
<tr>
29+
<td><a href="https://github.com/layer5io/meshery-istio">
30+
<img src='https://docs.meshery.io/assets/img/service-meshes/istio.svg' alt='Meshery Adapter for Istio Service Mesh' align="middle" hspace="10px" vspace="5px" height="30px" > Meshery adapter for Istio</a>
31+
</td>
32+
</tr>
33+
<tr>
34+
<td><a href="https://github.com/layer5io/meshery-linkerd">
35+
<img src='https://docs.meshery.io/assets/img/service-meshes/linkerd.svg' alt='Linkerd' align="middle" hspace="5px" vspace="5px" height="30px" width="30px"> Meshery adapter for Linkerd</a>
36+
</td>
37+
</tr>
38+
<tr>
39+
<td><a href="https://github.com/layer5io/meshery-consul">
40+
<img src='https://docs.meshery.io/assets/img/service-meshes/consul.svg' alt='Consul Connect' align="middle" hspace="5px" vspace="5px" height="30px" width="30px"> Meshery adapter for Consul</a>
41+
</td>
42+
</tr>
43+
<tr>
44+
<td><a href="https://github.com/layer5io/meshery-octarine">
45+
<img src='https://docs.meshery.io/assets/img/service-meshes/octarine.svg' alt='Octarine Service Mesh' align="middle" hspace="5px" vspace="5px" height="30px" width="30px">Meshery adapter for Octarine</a>
46+
</td>
47+
</tr>
48+
<tr>
49+
<td><a href="https://github.com/layer5io/meshery-nsm">
50+
<img src='https://docs.meshery.io/assets/img/service-meshes/nsm.svg' alt='Network Mesh' align="middle" hspace="5px" vspace="5px" height="30px" width="30px">Meshery adapter for Network Service Mesh</a>
51+
</td>
52+
</tr>
53+
<tr>
54+
<td><a href="https://github.com/layer5io/meshery-kuma">
55+
<img src='https://docs.meshery.io/assets/img/service-meshes/kuma.svg' alt='Kuma Service Mesh' align="middle" hspace="5px" vspace="5px" height="30px" width="30px">Meshery adapter for Kuma</a>
56+
</td>
57+
</tr>
58+
<tr>
59+
<td><a href="https://github.com/layer5io/meshery-osm">
60+
<img src='https://docs.meshery.io/assets/img/service-meshes/osm.svg' alt='Open Service Mesh' align="middle" hspace="5px" vspace="5px" height="30px" width="30px">Meshery adapter for Open Service Mesh</a>
61+
</td>
62+
</tr>
63+
<tr><td colspan="2" class="stable-adapters"></td></tr>
64+
<tr>
65+
<td rowspan="5" class="beta-adapters">beta</td>
66+
</tr>
67+
<tr>
68+
<td><a href="https://github.com/layer5io/meshery-cpx">
69+
<img src='https://docs.meshery.io/assets/img/service-meshes/citrix.svg' alt='Citrix CPX Service Mesh' align="middle" hspace="5px" vspace="5px" height="30px" width="30px">Meshery adapter for Citrix CPX</a>
70+
</td>
71+
</tr>
72+
<tr>
73+
<td><a href="https://github.com/layer5io/meshery-traefik-mesh">
74+
<img src='https://docs.meshery.io/assets/img/service-meshes/traefik-mesh.svg' alt='Traefik Service Mesh' align="middle" hspace="5px" vspace="5px" height="30px" width="30px">Meshery adapter for Traefik Mesh</a>
75+
</td>
76+
</tr>
77+
<tr>
78+
<td><a href="https://github.com/meshery/meshery-nginx-sm">
79+
<img src='https://docs.meshery.io/assets/img/service-meshes/nginx-sm.svg' alt='NGINX Service Mesh' align="middle" hspace="5px" vspace="5px" height="30px" width="30px">Meshery adapter for NGINX Service Mesh</a>
80+
</td>
81+
</tr>
82+
<tr><td colspan="2" class="beta-adapters"></td></tr>
83+
<tr>
84+
<td rowspan="3" class="alpha-adapters">alpha</td>
85+
</tr>
86+
<tr>
87+
<td><a href="https://github.com/meshery/meshery-tanzu-sm">
88+
<img src='https://docs.meshery.io/assets/img/service-meshes/tanzu.svg' alt='Tanzu Service Mesh' align="middle" hspace="5px" vspace="5px" height="30px" width="30px">Meshery adapter for Tanzu SM</a>
89+
</td>
90+
</tr>
91+
<tr>
92+
<td><a href="https://github.com/meshery/meshery-app-mesh">
93+
<img src='https://docs.meshery.io/assets/img/service-meshes/app-mesh.svg' alt='AWS App Mesh Service Mesh' align="middle" hspace="5px" vspace="5px" height="30px" width="30px">Meshery adapter for App Mesh</a>
94+
</td>
95+
</tr>
96+
<tr><td colspan="2" class="alpha-adapters"></td></tr>
97+
</tbody>
98+
</table>
99+
</p>
100+
</div>
101+
</details>
102+
103+
## Usage
104+
105+
See [action.yml](action.yml)
106+
107+
Users can define pattern files and store it in a remote location and pass the URL to the action or directly keep the file in the `.github` folder and reference it by file name.
6108

7-
## Sample pattern action configuration
109+
### Sample Configurations
110+
111+
#### Deploying a pattern with URL
8112

9113
```yaml
10-
name: Mesheryctl Pattern Action
114+
name: Apply Service Mesh Pattern with Meshery
11115
on:
12-
push:
13-
branches:
14-
- 'master'
15-
# if manually triggering, provide a provider token yourself
16116
workflow_dispatch:
17117
inputs:
18118
provider_token:
19-
description: "Meshery auth token"
20-
required: true
119+
description: "Provider token to use"
120+
required: false
121+
platform:
122+
description: "Platform to deploy Meshery to"
123+
required: false
124+
pattern_url:
125+
description: "URL of the pattern to be deployed"
126+
required: false
127+
pattern_file:
128+
description: "Name of the pattern file relative to the .github folder"
129+
required: false
21130

22131
jobs:
23-
mesheryctl-pattern-action:
24-
name: Mesheryctl Pattern Actions
132+
apply-pattern-file:
133+
name: Meshery Pattern Apply
25134
runs-on: ubuntu-latest
26135
steps:
27-
- name: mesheryctl pattern action
136+
- name: Setup Kubernetes
137+
uses: manusa/[email protected]
138+
with:
139+
minikube version: 'v1.23.2'
140+
kubernetes version: 'v1.22.2'
141+
driver: docker
142+
143+
- name: Apply Pattern
28144
uses: layer5io/mesheryctl-service-mesh-patterns-action@master
29145
with:
30146
provider_token: ${{ github.event.inputs.provider_token }}
31-
platform: docker
32-
url: https://raw.githubusercontent.com/service-mesh-patterns/service-mesh-patterns/master/samples/IstioFilterPattern.yaml
147+
platform: ${{ github.event.inputs.platform }}
148+
pattern_url: ${{ github.event.inputs.pattern_url }}
149+
```
150+
151+
### Sample Pattern File
152+
153+
```yaml
154+
name: ImageHubRateLimit
155+
version: 0.0.1
156+
services:
157+
generic-istio-filter:
158+
type: EnvoyFilterIstio
159+
namespace: istio-test
160+
settings:
161+
configPatches:
162+
- applyTo: HTTP_FILTER
163+
match:
164+
context: SIDECAR_INBOUND
165+
proxy:
166+
proxyVersion: '^1\.9.*'
167+
listener:
168+
portNumber: 9091
169+
filterChain:
170+
filter:
171+
name: envoy.http_connection_manager
172+
subFilter:
173+
name: envoy.router
174+
patch:
175+
operation: INSERT_BEFORE
176+
value:
177+
name: envoy.filter.http.wasm
178+
config_discovery:
179+
config_source:
180+
ads: {}
181+
initial_fetch_timeout: 0s
182+
type_urls: ["type.googleapis.com/envoy.extensions.filters.http.wasm.v3.Wasm"]
183+
workloadSelector:
184+
labels:
185+
app: api
186+
version: v1
187+
188+
ratelimit-filter:
189+
type: EnvoyFilterIstio
190+
namespace: istio-test
191+
settings:
192+
configPatches:
193+
- applyTo: EXTENSION_CONFIG
194+
match:
195+
context: SIDECAR_INBOUND
196+
patch:
197+
operation: ADD
198+
value:
199+
name: envoy.filter.http.wasm
200+
typed_config:
201+
"@type": type.googleapis.com/udpa.type.v1.TypedStruct
202+
type_url: type.googleapis.com/envoy.extensions.filters.http.wasm.v3.Wasm
203+
value:
204+
config:
205+
configuration:
206+
"@type": type.googleapis.com/google.protobuf.StringValue
207+
value: "rate_limit_filter"
208+
root_id: "rate_limit_filter"
209+
vm_config:
210+
code:
211+
remote:
212+
http_uri:
213+
uri: https://github.com/layer5io/image-hub/raw/master/rate-limit-filter/pkg/rate_limit_filter_bg.wasm
214+
215+
runtime: envoy.wasm.runtime.v8
216+
vm_id: rate_limit_filter
217+
configuration:
218+
"@type": type.googleapis.com/google.protobuf.StringValue
219+
value: "WwogIHsKICAgICJuYW1lIjogIi9wdWxsIiwKICAgICJydWxlIjp7CiAgICAgICJydWxlVHlwZSI6ICJyYXRlLWxpbWl0ZXIiLAogICAgICAicGFyYW1ldGVycyI6WwogICAgICAgIHsiaWRlbnRpZmllciI6ICJFbnRlcnByaXNlIiwgImxpbWl0IjogMTAwMH0sCiAgICAgICAgeyJpZGVudGlmaWVyIjogIlRlYW0iLCAibGltaXQiOiAxMDB9LAogICAgICAgIHsiaWRlbnRpZmllciI6ICJQZXJzb25hbCIsICJsaW1pdCI6IDEwfQogICAgICBdCiAgICB9CiAgfSwKICB7CiAgICAibmFtZSI6ICIvYXV0aCIsCiAgICAicnVsZSI6ewogICAgICAicnVsZVR5cGUiOiAibm9uZSIKICAgIH0KICB9LAogIHsKICAgICJuYW1lIjogIi9zaWdudXAiLAogICAgInJ1bGUiOnsKICAgICAgInJ1bGVUeXBlIjogIm5vbmUiCiAgICB9CiAgfSwKICB7CiAgICAibmFtZSI6ICIvdXBncmFkZSIsCiAgICAicnVsZSI6ewogICAgICAicnVsZVR5cGUiOiAibm9uZSIKICAgIH0KICB9Cl0="
220+
allow_precompiled: true
221+
workloadSelector:
222+
labels:
223+
app: api
224+
version: v1
225+
dependsOn:
226+
- generic-istio-filter
33227
```
34228
35229
## Join the service mesh community!

action.yml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,25 @@ name: "Service Mesh Pattern Testing with Meshery"
22
description: "Importing Pattern to Meshery"
33
author: "Layer5"
44
inputs:
5+
# token to authenticate with Meshery
56
provider_token:
67
description: "Provider token to use. NOTE: value of the 'token' key in auth.json"
7-
service_mesh:
8-
# used for provisioning appropriate meshery-adatper
9-
description: "Service mesh to use. e.g: osm, istio etc"
10-
default: istio
11-
required: true
8+
required: false
9+
# platform to deploy Meshery to
1210
platform:
13-
description: "Platform to deploy meshery on. Possible values: docker, kubernetes"
11+
description: "Platform to deploy Meshery to. Allowed values: docker, kubernetes"
1412
default: docker
15-
url:
16-
description: "A raw Github URL for the patterns to be deployed"
17-
default: "https://raw.githubusercontent.com/service-mesh-patterns/service-mesh-patterns/master/samples/IstioFilterPattern.yaml"
18-
required: true
13+
required: false
14+
pattern_url:
15+
description: "URL of the pattern to be deployed"
16+
required: false
17+
# upload the pattern file to the .github folder and reference its path relative to the folder
18+
pattern_file:
19+
description: "Name of the pattern file relative to the .github folder"
20+
required: false
1921
runs:
2022
using: "node12"
2123
main: "main.js"
2224
branding:
23-
icon: 'check-circle'
24-
color: 'green'
25+
icon: 'settings'
26+
color: 'purple'

main.sh

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,7 @@ set -o pipefail
66

77
SCRIPT_DIR=$(dirname -- "$(readlink -f "${BASH_SOURCE[0]}" || realpath "${BASH_SOURCE[0]}")")
88

9-
# Short names
10-
declare -A meshName
11-
meshName["open_service_mesh"]=osm
12-
meshName["traefik_mesh"]=traefik-mesh
13-
meshName["network_service_mesh"]=nsm
14-
159
main() {
16-
local INPUT_SERVICE_MESH="istio"
1710
get_dependencies
1811

1912
setupArgs=()
@@ -25,30 +18,15 @@ main() {
2518
setupArgs+=(--platform ${INPUT_PLATFORM})
2619
fi
2720

28-
if [[ -n "${INPUT_SERVICE_MESH:-}" ]]; then
29-
meshNameLower=`echo $INPUT_SERVICE_MESH | tr -d '"' | tr '[:upper:]' '[:lower:]'`
30-
if [ $meshNameLower = "open_service_mesh" ] || [ $meshNameLower = "traefik_mesh" ] || [ $meshNameLower = "network_service_mesh" ]
31-
then
32-
serviceMeshAbb=${meshName["$meshNameLower"]}
33-
else
34-
serviceMeshAbb=$meshNameLower
35-
fi
36-
setupArgs+=(--service-mesh ${serviceMeshAbb})
37-
fi
38-
3921
bash "$SCRIPT_DIR/meshery.sh" "${setupArgs[@]}"
4022

4123
commandArgs=()
42-
if [[ -n "${INPUT_PATTERN_FILENAME:-}" ]]; then
43-
commandArgs=(--pattern-filename ${INPUT_PATTERN_FILENAME})
44-
fi
45-
46-
if [[ -n "${INPUT_PATTERN_NAME:-}" ]]; then
47-
commandArgs=(--pattern-name ${INPUT_PATTERN_NAME})
24+
if [[ -n "${INPUT_PATTERN_FILE:-}" ]]; then
25+
commandArgs=(--pattern-file ${INPUT_PATTERN_FILE})
4826
fi
4927

50-
if [[ -n "${INPUT_SERVICE_MESH:-}" ]]; then
51-
commandArgs+=(--service-mesh ${meshNameLower})
28+
if [[ -n "${INPUT_PATTERN_URL:-}" ]]; then
29+
commandArgs=(--pattern-url ${INPUT_PATTERN_URL})
5230
fi
5331

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

0 commit comments

Comments
 (0)