Skip to content
Open

Poc #18

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Golang CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-go/ for more details
version: 2
jobs:
build:
docker:
# specify the version
- image: circleci/golang:1.9

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/postgres:9.4

working_directory: /go/src/github.com/aunem/transpose
steps:
- checkout

- run:
name: Install Docker Compose
command: |
curl -L https://github.com/docker/compose/releases/download/1.19.0/docker-compose-`uname -s`-`uname -m` > ~/docker-compose
chmod +x ~/docker-compose
sudo mv ~/docker-compose /usr/local/bin/docker-compose

- setup_remote_docker

- run:
name: Install deps
command: |
ls
make deps

- run:
name: Integration test
command: |
make integration
28 changes: 14 additions & 14 deletions Gopkg.lock

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

3 changes: 2 additions & 1 deletion MAINTAINERS.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Patrick Barker -- grillz
<name> | <handle> | <email>
Patrick Barker | @grillz | patrickbarkerco@gmail.com
18 changes: 14 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@

.PHONY: deps
deps:
go get -u github.com/golang/dep/cmd/dep
docker-compose run --rm deps

.PHONY: build
docker-compose run -rm build
build:
docker-compose run --rm build

.PHONY: plugins
plugins:
docker-compose run --rm plugins

.PHONY: integration
integration:
docker-compose -f integration-compose.yaml up
integration: plugins
docker-compose run --rm integration

.PHONY: integration-down
integration-down:
docker-compose -f integration-compose.yaml down
docker-compose down

.PHONY: clean
clean:
go run main.go plugin clean

.PHONY: proto-gateway
proto-gateway:
Expand Down
53 changes: 37 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
![logo](docs/img/Gopher_logo.png)

# Transpose

Transpose is a cloud native composable proxy with a focus on kubernetes written in go.
Expand All @@ -14,7 +16,13 @@ Transpose is a cloud native composable proxy with a focus on kubernetes written
* Cloud native

## Getting Started
Example config:

##### Install
`go get -u github.com/aunem/transpose`

Transpose depends on [dep](github.com/golang/dep)

##### Example
```yaml
apiVersion: alpha.aunem.com/v1
Kind: Transpose
Expand All @@ -36,13 +44,6 @@ spec:
spec:
authUrl: my.auth.com
clientID: transposeClient
response:
- name: hydraAuth
package: github.com/aunem/transpose-plugins/middleware/hydra
spec:
authUrl: my.auth.com
clientID: transposeClient
auditUrl: my.audit.com

roundtrip:
name: myroundtrip
Expand All @@ -57,24 +58,41 @@ spec:

see [start.md](docs/start.md) for more details

## Plugins

### Listener
Plugin | Description | Build | Contexts Supported
--- | --- | --- | ---
[http](github.com/aunem/transpose-plugins/listener/http)| simple http listener | build data | http

### Middleware
Plugin | Description | Build | Contexts Supported
--- | --- | --- | ---
[hydra](github.com/aunem/transpose-plugins/middleware/hydra)| hydra auth middleware | build data | http

### Roundtrip
Plugin | Description | Build | Contexts Supported
--- | --- | --- | ---
[supermux](github.com/aunem/transpose-plugins/roundtrip/supermux)| an enhanced router | build data | http, grpc



To develop plugins see [developing_plugins.md](docs/developing_plugins.md)

## Inspiration

* Envoy [github.com/envoyproxy/envoy](github.com/envoyproxy/envoy)
* Traefik [github.com/containous/traefik](github.com/containous/traefik)
* Gentleman [github.com/h2non/gentleman](github.com/h2non/gentleman)
* Istio [github.com/istio/istio](github.com/istio/istio)
* OpenFaas [github.com/openfaas/faas](github.com/openfaas/faas)

## Libs

* Oxy [github.com/vulcand/oxy](github.com/vulcand/oxy)
* Gorrilla Mux [github.com/gorilla/mux](github.com/gorilla/mux)
* Fluentd [github.com/fluent/fluentd](github.com/fluent/fluentd)

## Roadmap

- [ ] Middleware plugins
- [ ] Roundtrip plugins
- [ ] Listener plugins
- [x] Roundtrip plugins
- [x] Listener plugins
- [ ] HTTP/2
- [ ] GRPC
- [ ] Data plane
Expand All @@ -84,4 +102,7 @@ see [start.md](docs/start.md) for more details

Development happens out of the [Makefile](./Makefile). The targets are fairly simple but if you have any issues contact us.

## Contact
## Contact and Questions

Chat with us on discord:
https://discord.gg/q9mnWtd
23 changes: 18 additions & 5 deletions cmd/plugin_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ package cmd
import (
"fmt"

res "github.com/aunem/transpose/pkg/resolve"
"github.com/aunem/transpose/pkg/template"
"github.com/aunem/transpose/pkg/utils"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)

var ptyp string
var pname string
var ptyp, pname, ppackage string

var initCmd = &cobra.Command{
Use: "init",
Expand All @@ -19,13 +21,24 @@ var initCmd = &cobra.Command{

func init() {
pluginCmd.AddCommand(initCmd)
initCmd.Flags().StringVarP(&ptyp, "type", "t", "", "type of plugin (listener, middleware, or roundtrip)")
initCmd.Flags().StringVarP(&pname, "name", "n", "", "name of plugin")
initCmd.Flags().StringVarP(&ptyp, "type", "t", "", "type of plugin (listener, middleware, or roundtrip) (required)")
initCmd.Flags().StringVarP(&pname, "name", "n", "", "name of plugin (required)")
initCmd.Flags().StringVarP(&ppackage, "package", "p", "", "golang package (required)")
initCmd.MarkFlagRequired("type")
initCmd.MarkFlagRequired("name")
initCmd.MarkFlagRequired("package")
}

// Init plugins
func Init(cmd *cobra.Command, args []string) {
fmt.Println("not yet implemented")

fmt.Println("creating templates...")
p := template.NewPlugin(pname, ppackage, ptyp)
err := p.Template()
if err != nil {
log.Fatal(err)
}
fmt.Println("resolving dependencies...")
res.Init()
fmt.Println("successfully templated plugin repo!")
}
8 changes: 4 additions & 4 deletions cmd/plugin_resolve.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ import (
var localBuild bool
var build bool

var reolveCmd = &cobra.Command{
var resolveCmd = &cobra.Command{
Use: "resolve",
Short: "resolve plugins",
Long: utils.GetArt(),
Run: Resolve,
}

func init() {
pluginCmd.AddCommand(reolveCmd)
initCmd.Flags().BoolVarP(&localBuild, "local", "l", false, "build plugin from local gopath")
initCmd.Flags().BoolVarP(&build, "build", "b", false, "resolve all plugins anew")
pluginCmd.AddCommand(resolveCmd)
resolveCmd.Flags().BoolVarP(&localBuild, "local", "l", false, "build plugin from local gopath")
resolveCmd.Flags().BoolVarP(&build, "build", "b", false, "resolve all plugins anew")
}

// Resolve plugins
Expand Down
4 changes: 2 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ var rootCmd = &cobra.Command{
}

func init() {
cobra.OnInitialize(initConfig)
rootCmd.PersistentFlags().StringVar(&name, "config-name", "", "name of the kubernetes config to sync to")
rootCmd.PersistentFlags().StringVar(&namespace, "config-namespace", "local", "namespace of the kubernetes config to sync to, use 'local' for a local config, leave blank for current ns")
viper.BindPFlag("config-name", rootCmd.PersistentFlags().Lookup("config-name"))
viper.BindPFlag("config-namespace", rootCmd.PersistentFlags().Lookup("config-namespace"))
}

func initConfig() {
// InitConfig initializes the config
func InitConfig() {
r := strings.NewReplacer("_", "-")
viper.SetEnvKeyReplacer(r)
viper.AutomaticEnv()
Expand Down
1 change: 1 addition & 0 deletions cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ var serverCmd = &cobra.Command{

// Serve starts a new transpose server
func Serve(cmd *cobra.Command, args []string) {
InitConfig()
log.Info("finding or creating bins...")
utils.MakeBins()
log.Info("resolving middleware plugin...")
Expand Down
Loading