Skip to content

Commit

Permalink
Rebasing changes after knative renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
bsnchan committed Jun 5, 2018
1 parent d0f185c commit fefb769
Show file tree
Hide file tree
Showing 63 changed files with 29 additions and 1,400 deletions.
2 changes: 1 addition & 1 deletion Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 0 additions & 38 deletions cmd/queue/BUILD.bazel

This file was deleted.

33 changes: 3 additions & 30 deletions cmd/queue/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"bytes"
"context"
"encoding/gob"
"errors"
"flag"
"fmt"
"io"
Expand All @@ -33,7 +32,6 @@ import (
"syscall"
"time"

"github.com/google/tcpproxy"
"github.com/knative/serving/cmd/util"
"github.com/knative/serving/pkg/apis/serving/v1alpha1"
"github.com/knative/serving/pkg/autoscaler"
Expand Down Expand Up @@ -92,11 +90,6 @@ var (
singleConcurrencyBreaker = queue.NewBreaker(singleConcurrencyQueueDepth, 1)
)

type Proxy struct {
HttpProxy *http.Server
TcpProxy *tcpproxy.Proxy
}

func initEnv() {
podName = util.GetRequiredEnvOrFatal("ELA_POD", logger)
elaNamespace = util.GetRequiredEnvOrFatal("ELA_NAMESPACE", logger)
Expand All @@ -106,28 +99,6 @@ func initEnv() {
elaAutoscalerPort = util.GetRequiredEnvOrFatal("ELA_AUTOSCALER_PORT", logger)
}

func (p *Proxy) Run() error {
if p.HttpProxy != nil {
if err := p.HttpProxy.ListenAndServe(); err != nil {
return err
}
}
<<<<<<< HEAD:cmd/queue/main.go
if p.TcpProxy != nil {
if err := p.TcpProxy.Run(); err != nil {
return err
}
}
return errors.New("No proxies to run - both HttpProxy and TcpProxy are nil.")
=======

httpProxy = httputil.NewSingleHostReverseProxy(target)

h2cProxy = httputil.NewSingleHostReverseProxy(target)
h2cProxy.Transport = h2c.NewTransport()
>>>>>>> Update the activator to use an h2c server:cmd/ela-queue/main.go
}

func connectStatSink() {
autoscalerEndpoint := fmt.Sprintf("ws://%s.%s.svc.cluster.local:%s",
elaAutoscaler, queue.AutoscalerNamespace, elaAutoscalerPort)
Expand Down Expand Up @@ -301,7 +272,9 @@ func main() {
if err != nil {
logger.Fatal("Failed to parse localhost url", zap.Error(err))
}
proxy = httputil.NewSingleHostReverseProxy(target)
httpProxy = httputil.NewSingleHostReverseProxy(target)
h2cProxy = httputil.NewSingleHostReverseProxy(target)
h2cProxy.Transport = h2c.NewTransport()

logger.Info("Queue container is starting")
config, err := rest.InClusterConfig()
Expand Down
4 changes: 2 additions & 2 deletions config/ela-activator-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
apiVersion: v1
kind: Service
metadata:
name: activator-service
name: activator-http-service
namespace: knative-serving-system
labels:
app: ela-activator
Expand All @@ -33,7 +33,7 @@ apiVersion: v1
kind: Service
metadata:
name: activator-grpc-service
namespace: ela-system
namespace: knative-serving-system
labels:
app: ela-activator
spec:
Expand Down
6 changes: 3 additions & 3 deletions pkg/controller/route/route_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1522,7 +1522,7 @@ func TestCreateRouteWithGRPCProtocol(t *testing.T) {
rev := getTestRevision("test-rev")
rev.Spec.Protocol = "grpc"

elaClient.ElafrosV1alpha1().Revisions(testNamespace).Create(rev)
elaClient.ServingV1alpha1().Revisions(testNamespace).Create(rev)

// A route targeting the revision
route := getTestRouteWithTrafficTargets(
Expand All @@ -1533,9 +1533,9 @@ func TestCreateRouteWithGRPCProtocol(t *testing.T) {
},
},
)
elaClient.ElafrosV1alpha1().Routes(testNamespace).Create(route)
elaClient.ServingV1alpha1().Routes(testNamespace).Create(route)
// Since updateRouteEvent looks in the lister, we need to add it to the informer
elaInformer.Elafros().V1alpha1().Routes().Informer().GetIndexer().Add(route)
elaInformer.Serving().V1alpha1().Routes().Informer().GetIndexer().Add(route)

controller.updateRouteEvent(KeyOrDie(route))

Expand Down
16 changes: 0 additions & 16 deletions pkg/h2c/BUILD.bazel

This file was deleted.

19 changes: 0 additions & 19 deletions sample/grpc-ping/BUILD

This file was deleted.

6 changes: 3 additions & 3 deletions sample/grpc-ping/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ A simple gRPC server written in Go that you can use for testing.

## Prerequisites

1. [Install Elafros](https://github.com/elafros/install/blob/master/README.md)
1. [Install Knative](https://github.com/knative/install/blob/master/README.md)
1. Install [docker](https://www.docker.com/)

## Build and run the gRPC server
Expand All @@ -22,9 +22,9 @@ docker build \
docker push "${REPO}/sample/grpc-ping"
# Replace the image reference with our published image.
perl -pi -e "[email protected]/elafros/elafros/sample/grpc-ping@${REPO}/sample/grpc-ping@g" sample/grpc-ping/*.yaml
perl -pi -e "[email protected]/knative/serving/sample/grpc-ping@${REPO}/sample/grpc-ping@g" sample/grpc-ping/*.yaml
# Deploy the Elafros sample
# Deploy the Knative sample
kubectl apply -f sample/grpc-ping/sample.yaml
```
Expand Down
19 changes: 0 additions & 19 deletions sample/grpc-ping/client/BUILD.bazel

This file was deleted.

4 changes: 2 additions & 2 deletions sample/grpc-ping/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import (
"log"
"time"

pb "github.com/elafros/elafros/sample/grpc-ping/proto"
pb "github.com/knative/serving/sample/grpc-ping/proto"
"golang.org/x/net/context"
"google.golang.org/grpc"
)

var (
serverAddr = flag.String("server_addr", "127.0.0.1:8080", "The server address in the format of host:port")
serverHostOverride = flag.String("server_host_override", "grpc.elafros.dev", "")
serverHostOverride = flag.String("server_host_override", "grpc.knative.dev", "")
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion sample/grpc-ping/grpc-ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net"
"time"

ping "github.com/elafros/elafros/sample/grpc-ping/proto"
ping "github.com/knative/serving/sample/grpc-ping/proto"
"golang.org/x/net/context"
"google.golang.org/grpc"
)
Expand Down
13 changes: 0 additions & 13 deletions sample/grpc-ping/proto/BUILD.bazel

This file was deleted.

6 changes: 3 additions & 3 deletions sample/grpc-ping/sample.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
apiVersion: elafros.dev/v1alpha1
apiVersion: serving.knative.dev/v1alpha1
kind: Route
metadata:
name: grpc-ping
Expand All @@ -9,7 +9,7 @@ spec:
- configurationName: grpc-ping
percent: 100
---
apiVersion: elafros.dev/v1alpha1
apiVersion: serving.knative.dev/v1alpha1
kind: Configuration
metadata:
name: grpc-ping
Expand All @@ -22,4 +22,4 @@ spec:
spec:
protocol: grpc
container:
image: github.com/elafros/elafros/sample/grpc-ping
image: github.com/knative/serving/sample/grpc-ping
2 changes: 1 addition & 1 deletion test/conformance/route_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const (
)

func createRouteAndConfig(clients *test.Clients, imagePaths []string) error {
_, err := clients.Configs.Create(test.Configuration(namespaceName, configName, imagePaths[0]))
_, err := clients.Configs.Create(test.Configuration(namespaceName, configName, imagePaths[0], v1alpha1.RevisionProtocolHTTP))
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package e2e
import (
"testing"

"github.com/knative/serving/pkg/apis/ela/v1alpha1"
"github.com/knative/serving/pkg/apis/serving/v1alpha1"
"github.com/knative/serving/test"
// Mysteriously required to support GCP auth (required by k8s libs).
// Apparently just importing it is enough. @_@ side effects @_@.
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/errorcondition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func TestContainerErrorMsg(t *testing.T) {
imagePath := strings.Join([]string{test.Flags.DockerRepo, "invalidhelloworld"}, "/")

log.Printf("Creating a new Route and Configuration %s", imagePath)
err := CreateRouteAndConfig(clients, imagePath)
err := CreateRouteAndConfig(clients, imagePath, v1alpha1.RevisionProtocolHTTP)
if err != nil {
t.Fatalf("Failed to create Route and Configuration: %v", err)
}
Expand Down
9 changes: 6 additions & 3 deletions test/e2e/helloworld_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,12 @@ func waitForHelloWorldGRPCEndpoint(address string, spoofDomain string) error {
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
defer cancel()

resp, err := client.Hello(ctx, &hello.Request{Msg: "world"})
req := &hello.Request{Msg: "world"}
resp, err := client.Hello(ctx, req)
if err != nil {
return true, err
log.Printf("Retrying gRPC request: %+v, got err: %s", req, err)
// Continue to poll since the Ingress may take a while to start serving requests
return false, nil
}

expectedResponse := "Hello world"
Expand All @@ -141,7 +144,7 @@ func waitForHelloWorldGRPCEndpoint(address string, spoofDomain string) error {
if receivedResponse == expectedResponse {
return true, nil
}
return false, fmt.Errorf("Did not get expected response message %s, got %s", expectedResponse, receivedResponse)
return true, fmt.Errorf("Did not get expected response message %s, got %s", expectedResponse, receivedResponse)
})
return err
}
2 changes: 1 addition & 1 deletion test/e2e/test_images/helloworld-grpc/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM golang:latest

ENV APP ${GOPATH}/src/github.com/elafros/elafros/test/e2e/test_images/helloworld-grpc
ENV APP ${GOPATH}/src/github.com/knative/serving/test/e2e/test_images/helloworld-grpc

RUN mkdir -p "$APP"
ADD . "$APP"
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/test_images/helloworld-grpc/helloworld.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"net"

hello "github.com/elafros/elafros/test/e2e/test_images/helloworld-grpc/proto"
hello "github.com/knative/serving/test/e2e/test_images/helloworld-grpc/proto"
"golang.org/x/net/context"
"google.golang.org/grpc"
)
Expand Down
Loading

0 comments on commit fefb769

Please sign in to comment.