Skip to content

Commit

Permalink
Nats standard and streaming support (#156)
Browse files Browse the repository at this point in the history
* Fixing deactivate route bug in webhook gateway

* Fixing deactivate route bug in storage gateway

* fixing event source deactivation -> activation bug

* Started adding support for NATS streaming

* Started working on supporting nats standard and streaming for communication between gateway and sensor

* Changing nats subscription to queue subscription

* Fire K8s event on nats connection/subscription updates

* Updating gateway and sensor controller validate method

* Fixing nats-streaming issue

* Fix storage grid channel issue

* Removing premature return in transformer

* Renaming dispatchProtocol to eventProtocol

* Moving common structs in apis package

* Adding deepcopy and proto files for common api

* making trigger errors more explicit
  • Loading branch information
VaibhavPage authored and magaldima committed Jan 28, 2019
1 parent 2605141 commit 3461eda
Show file tree
Hide file tree
Showing 72 changed files with 6,359 additions and 4,171 deletions.
98 changes: 70 additions & 28 deletions Gopkg.lock

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

12 changes: 8 additions & 4 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ required = [
"github.com/gogo/protobuf/protoc-gen-gogofast",
]

[[constraint]]
name = "k8s.io/code-generator"
branch = "release-1.10"

[[constraint]]
name = "github.com/nats-io/go-nats-streaming"
branch = "master"

[[constraint]]
name = "github.com/smartystreets/goconvey"
version = "1.6.3"
Expand All @@ -24,10 +32,6 @@ required = [
name = "github.com/golang/protobuf"
branch = "master"

[[constraint]]
name = "k8s.io/code-generator"
branch = "release-1.10"

[[constraint]]
name = "github.com/eclipse/paho.mqtt.golang"
version = "1.1.1"
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ endif

# Build the project images
.DELETE_ON_ERROR:
all: sensor-linux sensor-controller-linux gateway-controller-linux gateway-client-linux webhook-linux calendar-linux resource-linux artifact-linux file-linux nats-linux kafka-linux amqp-linux mqtt-linux storage-grid-linux
all: sensor-linux sensor-controller-linux gateway-controller-linux gateway-client-linux webhook-linux calendar-linux resource-linux artifact-linux file-linux nats-linux kafka-linux amqp-linux mqtt-linux storage-grid-linux github-linux

all-images: sensor-image sensor-controller-image gateway-controller-image gateway-client-image webhook-image calendar-image resource-image artifact-image file-image nats-image kafka-image amqp-image mqtt-image storage-grid-image
all-images: sensor-image sensor-controller-image gateway-controller-image gateway-client-image webhook-image calendar-image resource-image artifact-image file-image nats-image kafka-image amqp-image mqtt-image storage-grid-image github-image

all-controller-images: sensor-controller-image gateway-controller-image

Expand Down
3 changes: 0 additions & 3 deletions common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ const (

// SENSOR CONSTANTS
const (
// Sensor service port
SensorServicePort = "9300"

// SensorServiceEndpoint is the endpoint to dispatch the event to
SensorServiceEndpoint = "/"

Expand Down
18 changes: 17 additions & 1 deletion common/events_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
/*
Copyright 2018 BlackRock, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package common

import (
"github.com/smartystreets/goconvey/convey"
"testing"

"github.com/smartystreets/goconvey/convey"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes/fake"
)
Expand Down
15 changes: 10 additions & 5 deletions common/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@ func DefaultServiceName(serviceName string) string {

// DefaultGatewayConfigurationName returns a formulated name for a gateway configuration
func DefaultGatewayConfigurationName(gatewayName string, configurationName string) string {
return fmt.Sprintf("%s/%s", gatewayName, configurationName)
return fmt.Sprintf("%s:%s", gatewayName, configurationName)
}

// DefaultNatsQueueName returns a queue name for nats subject
func DefaultNatsQueueName(subject string) string {
return fmt.Sprintf("%s-%s", subject, "queue")
}

// GetClientConfig return rest config, if path not specified, assume in cluster config
Expand All @@ -70,15 +75,15 @@ func ServerResourceForGroupVersionKind(disco discovery.DiscoveryInterface, gvk s
}

// SendSuccessResponse sends http success response
func SendSuccessResponse(writer http.ResponseWriter) {
func SendSuccessResponse(writer http.ResponseWriter, response string) {
writer.WriteHeader(http.StatusOK)
writer.Write([]byte(SuccessResponse))
writer.Write([]byte(response))
}

// SendErrorResponse sends http error response
func SendErrorResponse(writer http.ResponseWriter) {
func SendErrorResponse(writer http.ResponseWriter, response string) {
writer.WriteHeader(http.StatusBadRequest)
writer.Write([]byte(ErrorResponse))
writer.Write([]byte(response))
}

// LoggerConf returns standard logging configuration
Expand Down
Loading

0 comments on commit 3461eda

Please sign in to comment.