Skip to content

Commit

Permalink
Merge pull request #41 from kumarabd/addLabels
Browse files Browse the repository at this point in the history
added istio and osm service mesh
  • Loading branch information
leecalcote authored Aug 13, 2020
2 parents 06bde8f + 9282b72 commit d9b66e1
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 13 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ jobs:
docker tag ${{ secrets.IMAGE_NAME }}:latest ${{ secrets.IMAGE_NAME }}:${GITHUB_SHA::6}
docker push ${{ secrets.IMAGE_NAME }}:latest
docker push ${{ secrets.IMAGE_NAME }}:${GITHUB_SHA::6}
cd ../smi-conformance && docker build --no-cache -t smi-conformance:latest .
docker tag smi-conformance:latest smi-conformance:${GITHUB_SHA::6}
docker push smi-conformance:latest
docker push smi-conformance:${GITHUB_SHA::6}
cd ../smi-conformance && docker build --no-cache -t ${{ secrets.IMAGE_NAME }}:smi .
docker tag ${{ secrets.IMAGE_NAME }}:smi ${{ secrets.IMAGE_NAME }}:smi-${GITHUB_SHA::6}
docker push ${{ secrets.IMAGE_NAME }}:smi
docker push ${{ secrets.IMAGE_NAME }}:smi-${GITHUB_SHA::6}
- name: Docker tag release & push
if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') && success()
run: |
docker tag ${{ secrets.IMAGE_NAME }}:latest ${{ secrets.IMAGE_NAME }}:${GITHUB_REF/refs\/tags\//}
docker push ${{ secrets.IMAGE_NAME }}:${GITHUB_REF/refs\/tags\//}
docker tag smi-conformance:latest smi-conformance:${GITHUB_REF/refs\/tags\//}
docker push smi-conformance:${GITHUB_REF/refs\/tags\//}
docker tag ${{ secrets.IMAGE_NAME }}:smi ${{ secrets.IMAGE_NAME }}:smi-${GITHUB_REF/refs\/tags\//}
docker push ${{ secrets.IMAGE_NAME }}:smi-${GITHUB_REF/refs\/tags\//}
2 changes: 0 additions & 2 deletions smi-conformance/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
FROM golang:1.14-alpine3.11 as build-img
LABEL maintainer "Layer5.io"


RUN apk update && apk add --no-cache git libc-dev gcc pkgconf && mkdir /home/meshery
COPY ${PWD} /go/src/github.com/layer5io/learn-layer5/smi-conformance/
Expand Down
11 changes: 10 additions & 1 deletion smi-conformance/grpc/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ var (
PortSvcB: "9091",
PortSvcC: "9091",
}
istioConfig = &test_gen.Linkerd{
istioConfig = &test_gen.Istio{
PortSvcA: "9091",
PortSvcB: "9091",
PortSvcC: "9091",
}
osmConfig = &test_gen.OSM{
PortSvcA: "9091",
PortSvcB: "9091",
PortSvcC: "9091",
Expand All @@ -40,7 +45,11 @@ func (s *Service) RunTest(ctx context.Context, req *conformance.Request) (*confo
case "maesh":
config = maeshConfig
case "istio":
config = istioConfig
req.Labels["istio-injection"] = "enabled"
case "osm":
config = osmConfig
req.Labels["openservicemesh.io/monitored-by"] = "osm"
}

result := test_gen.RunTest(config, req.Annotations, req.Labels)
Expand Down
60 changes: 60 additions & 0 deletions smi-conformance/test-gen/service-mesh.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,63 @@ func (sm Linkerd) SvcBGetPort() string {
func (sm Linkerd) SvcCGetPort() string {
return sm.PortSvcC
}

type Istio struct {
PortSvcA string
PortSvcB string
PortSvcC string
}

func (sm Istio) SvcAGetInternalName(namespace string) string {
return fmt.Sprintf("http://%s.%s..svc.cluster.local.:%s", SERVICE_A_NAME, namespace, sm.PortSvcA)
}

func (sm Istio) SvcBGetInternalName(namespace string) string {
return fmt.Sprintf("http://%s.%s..svc.cluster.local.:%s", SERVICE_B_NAME, namespace, sm.PortSvcB)
}

func (sm Istio) SvcCGetInternalName(namespace string) string {
return fmt.Sprintf("http://%s.%s..svc.cluster.local.:%s", SERVICE_C_NAME, namespace, sm.PortSvcC)
}

func (sm Istio) SvcAGetPort() string {
return sm.PortSvcA
}

func (sm Istio) SvcBGetPort() string {
return sm.PortSvcB
}

func (sm Istio) SvcCGetPort() string {
return sm.PortSvcC
}

type OSM struct {
PortSvcA string
PortSvcB string
PortSvcC string
}

func (sm OSM) SvcAGetInternalName(namespace string) string {
return fmt.Sprintf("http://%s.%s..svc.cluster.local.:%s", SERVICE_A_NAME, namespace, sm.PortSvcA)
}

func (sm OSM) SvcBGetInternalName(namespace string) string {
return fmt.Sprintf("http://%s.%s..svc.cluster.local.:%s", SERVICE_B_NAME, namespace, sm.PortSvcB)
}

func (sm OSM) SvcCGetInternalName(namespace string) string {
return fmt.Sprintf("http://%s.%s..svc.cluster.local.:%s", SERVICE_C_NAME, namespace, sm.PortSvcC)
}

func (sm OSM) SvcAGetPort() string {
return sm.PortSvcA
}

func (sm OSM) SvcBGetPort() string {
return sm.PortSvcB
}

func (sm OSM) SvcCGetPort() string {
return sm.PortSvcC
}
4 changes: 0 additions & 4 deletions smi-conformance/test-gen/test_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ func RunTest(meshConfig ServiceMesh, annotations, labels map[string]string) Resu
options.TestDirs = args
}

// annotations := make(map[string]string)
// Namespace Injection
// annotations["linkerd.io/inject"] = "enabled"

// Runs the test using the inCluster kubeConfig (runs only when the code is running inside the pod)
harness.InCluster = true

Expand Down

0 comments on commit d9b66e1

Please sign in to comment.