Skip to content

Commit d9b66e1

Browse files
authored
Merge pull request #41 from kumarabd/addLabels
added istio and osm service mesh
2 parents 06bde8f + 9282b72 commit d9b66e1

File tree

5 files changed

+76
-13
lines changed

5 files changed

+76
-13
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ jobs:
3232
docker tag ${{ secrets.IMAGE_NAME }}:latest ${{ secrets.IMAGE_NAME }}:${GITHUB_SHA::6}
3333
docker push ${{ secrets.IMAGE_NAME }}:latest
3434
docker push ${{ secrets.IMAGE_NAME }}:${GITHUB_SHA::6}
35-
cd ../smi-conformance && docker build --no-cache -t smi-conformance:latest .
36-
docker tag smi-conformance:latest smi-conformance:${GITHUB_SHA::6}
37-
docker push smi-conformance:latest
38-
docker push smi-conformance:${GITHUB_SHA::6}
35+
cd ../smi-conformance && docker build --no-cache -t ${{ secrets.IMAGE_NAME }}:smi .
36+
docker tag ${{ secrets.IMAGE_NAME }}:smi ${{ secrets.IMAGE_NAME }}:smi-${GITHUB_SHA::6}
37+
docker push ${{ secrets.IMAGE_NAME }}:smi
38+
docker push ${{ secrets.IMAGE_NAME }}:smi-${GITHUB_SHA::6}
3939
- name: Docker tag release & push
4040
if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') && success()
4141
run: |
4242
docker tag ${{ secrets.IMAGE_NAME }}:latest ${{ secrets.IMAGE_NAME }}:${GITHUB_REF/refs\/tags\//}
4343
docker push ${{ secrets.IMAGE_NAME }}:${GITHUB_REF/refs\/tags\//}
44-
docker tag smi-conformance:latest smi-conformance:${GITHUB_REF/refs\/tags\//}
45-
docker push smi-conformance:${GITHUB_REF/refs\/tags\//}
44+
docker tag ${{ secrets.IMAGE_NAME }}:smi ${{ secrets.IMAGE_NAME }}:smi-${GITHUB_REF/refs\/tags\//}
45+
docker push ${{ secrets.IMAGE_NAME }}:smi-${GITHUB_REF/refs\/tags\//}

smi-conformance/Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
FROM golang:1.14-alpine3.11 as build-img
2-
LABEL maintainer "Layer5.io"
3-
42

53
RUN apk update && apk add --no-cache git libc-dev gcc pkgconf && mkdir /home/meshery
64
COPY ${PWD} /go/src/github.com/layer5io/learn-layer5/smi-conformance/

smi-conformance/grpc/handlers.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ var (
2121
PortSvcB: "9091",
2222
PortSvcC: "9091",
2323
}
24-
istioConfig = &test_gen.Linkerd{
24+
istioConfig = &test_gen.Istio{
25+
PortSvcA: "9091",
26+
PortSvcB: "9091",
27+
PortSvcC: "9091",
28+
}
29+
osmConfig = &test_gen.OSM{
2530
PortSvcA: "9091",
2631
PortSvcB: "9091",
2732
PortSvcC: "9091",
@@ -40,7 +45,11 @@ func (s *Service) RunTest(ctx context.Context, req *conformance.Request) (*confo
4045
case "maesh":
4146
config = maeshConfig
4247
case "istio":
48+
config = istioConfig
4349
req.Labels["istio-injection"] = "enabled"
50+
case "osm":
51+
config = osmConfig
52+
req.Labels["openservicemesh.io/monitored-by"] = "osm"
4453
}
4554

4655
result := test_gen.RunTest(config, req.Annotations, req.Labels)

smi-conformance/test-gen/service-mesh.go

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,63 @@ func (sm Linkerd) SvcBGetPort() string {
7878
func (sm Linkerd) SvcCGetPort() string {
7979
return sm.PortSvcC
8080
}
81+
82+
type Istio struct {
83+
PortSvcA string
84+
PortSvcB string
85+
PortSvcC string
86+
}
87+
88+
func (sm Istio) SvcAGetInternalName(namespace string) string {
89+
return fmt.Sprintf("http://%s.%s..svc.cluster.local.:%s", SERVICE_A_NAME, namespace, sm.PortSvcA)
90+
}
91+
92+
func (sm Istio) SvcBGetInternalName(namespace string) string {
93+
return fmt.Sprintf("http://%s.%s..svc.cluster.local.:%s", SERVICE_B_NAME, namespace, sm.PortSvcB)
94+
}
95+
96+
func (sm Istio) SvcCGetInternalName(namespace string) string {
97+
return fmt.Sprintf("http://%s.%s..svc.cluster.local.:%s", SERVICE_C_NAME, namespace, sm.PortSvcC)
98+
}
99+
100+
func (sm Istio) SvcAGetPort() string {
101+
return sm.PortSvcA
102+
}
103+
104+
func (sm Istio) SvcBGetPort() string {
105+
return sm.PortSvcB
106+
}
107+
108+
func (sm Istio) SvcCGetPort() string {
109+
return sm.PortSvcC
110+
}
111+
112+
type OSM struct {
113+
PortSvcA string
114+
PortSvcB string
115+
PortSvcC string
116+
}
117+
118+
func (sm OSM) SvcAGetInternalName(namespace string) string {
119+
return fmt.Sprintf("http://%s.%s..svc.cluster.local.:%s", SERVICE_A_NAME, namespace, sm.PortSvcA)
120+
}
121+
122+
func (sm OSM) SvcBGetInternalName(namespace string) string {
123+
return fmt.Sprintf("http://%s.%s..svc.cluster.local.:%s", SERVICE_B_NAME, namespace, sm.PortSvcB)
124+
}
125+
126+
func (sm OSM) SvcCGetInternalName(namespace string) string {
127+
return fmt.Sprintf("http://%s.%s..svc.cluster.local.:%s", SERVICE_C_NAME, namespace, sm.PortSvcC)
128+
}
129+
130+
func (sm OSM) SvcAGetPort() string {
131+
return sm.PortSvcA
132+
}
133+
134+
func (sm OSM) SvcBGetPort() string {
135+
return sm.PortSvcB
136+
}
137+
138+
func (sm OSM) SvcCGetPort() string {
139+
return sm.PortSvcC
140+
}

smi-conformance/test-gen/test_gen.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,6 @@ func RunTest(meshConfig ServiceMesh, annotations, labels map[string]string) Resu
7979
options.TestDirs = args
8080
}
8181

82-
// annotations := make(map[string]string)
83-
// Namespace Injection
84-
// annotations["linkerd.io/inject"] = "enabled"
85-
8682
// Runs the test using the inCluster kubeConfig (runs only when the code is running inside the pod)
8783
harness.InCluster = true
8884

0 commit comments

Comments
 (0)