diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4f3cfb1..b0b4e05 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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\//} diff --git a/smi-conformance/Dockerfile b/smi-conformance/Dockerfile index 3e0b33a..a78b8ee 100644 --- a/smi-conformance/Dockerfile +++ b/smi-conformance/Dockerfile @@ -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/ diff --git a/smi-conformance/grpc/handlers.go b/smi-conformance/grpc/handlers.go index 7360d16..9fce133 100644 --- a/smi-conformance/grpc/handlers.go +++ b/smi-conformance/grpc/handlers.go @@ -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", @@ -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) diff --git a/smi-conformance/test-gen/service-mesh.go b/smi-conformance/test-gen/service-mesh.go index 2fb342e..bb76499 100644 --- a/smi-conformance/test-gen/service-mesh.go +++ b/smi-conformance/test-gen/service-mesh.go @@ -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 +} diff --git a/smi-conformance/test-gen/test_gen.go b/smi-conformance/test-gen/test_gen.go index ced8970..b8e5e90 100644 --- a/smi-conformance/test-gen/test_gen.go +++ b/smi-conformance/test-gen/test_gen.go @@ -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