Skip to content

Commit

Permalink
Merge branch 'develop' into urbs
Browse files Browse the repository at this point in the history
  • Loading branch information
zensh committed Mar 30, 2020
2 parents 5560ab2 + 1a25369 commit 1ff267d
Show file tree
Hide file tree
Showing 21 changed files with 1,456 additions and 2 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/urbs_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Urbs Gateway Release
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*-urbs' # Push events to matching v*-urbs, i.e. v1.0-urbs

jobs:
build:
name: Build And Upload Release Asset
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.14.1
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Get dependencies
run: |
go get -v -d ./...
- name: Build project # This would actually build your project, using zip for an example artifact
run: |
make binary
zip -j ./dist/traefik.linux-amd64.zip ./dist/traefik
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./dist/traefik.linux-amd64.zip
asset_name: traefik.linux-amd64.zip
asset_content_type: application/zip
29 changes: 29 additions & 0 deletions .github/workflows/urbs_test_unit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Urbs Gateway Release
on:
push:
branches:
- urbs
pull_request:
branches:
- urbs
jobs:
build:
name: Test Unit
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.14.1
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Get dependencies
run: |
go get -v -d ./...
- name: Test
run: |
make test-unit
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@
*.exe
cover.out
vendor/
debug/
12 changes: 12 additions & 0 deletions pkg/config/dynamic/http_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type Service struct {
LoadBalancer *ServersLoadBalancer `json:"loadBalancer,omitempty" toml:"loadBalancer,omitempty" yaml:"loadBalancer,omitempty"`
Weighted *WeightedRoundRobin `json:"weighted,omitempty" toml:"weighted,omitempty" yaml:"weighted,omitempty" label:"-"`
Mirroring *Mirroring `json:"mirroring,omitempty" toml:"mirroring,omitempty" yaml:"mirroring,omitempty" label:"-"`
Labeled *LabeledRoundRobin `json:"labeled,omitempty" toml:"labeled,omitempty" yaml:"labeled,omitempty" label:"-"`
}

// +k8s:deepcopy-gen=true
Expand Down Expand Up @@ -93,6 +94,17 @@ type WRRService struct {
Weight *int `json:"weight,omitempty" toml:"weight,omitempty" yaml:"weight,omitempty"`
}

// +k8s:deepcopy-gen=true

// LabeledRoundRobin defines a labeled load-balancer of services, which select service by label.
// Label will be extract from request header or cookie, with key `X-Canary-Label`.
// services should be named as `{defaultService}-{label}`. Ex. "myservice-stable", "myservice-beta", "myservice-dev"
type LabeledRoundRobin struct {
ServiceName string `json:"serviceName,omitempty" toml:"serviceName,omitempty" yaml:"serviceName,omitempty"`
Default string `json:"default,omitempty" toml:"default,omitempty" yaml:"default,omitempty"`
Services []string `json:"services,omitempty" toml:"services,omitempty" yaml:"services,omitempty"`
}

// SetDefaults Default values for a WRRService.
func (w *WRRService) SetDefaults() {
defaultWeight := 1
Expand Down
15 changes: 15 additions & 0 deletions pkg/config/dynamic/middlewares.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ type Middleware struct {
PassTLSClientCert *PassTLSClientCert `json:"passTLSClientCert,omitempty" toml:"passTLSClientCert,omitempty" yaml:"passTLSClientCert,omitempty"`
Retry *Retry `json:"retry,omitempty" toml:"retry,omitempty" yaml:"retry,omitempty"`
ContentType *ContentType `json:"contentType,omitempty" toml:"contentType,omitempty" yaml:"contentType,omitempty"`
Canary *Canary `json:"canary,omitempty" toml:"canary,omitempty" yaml:"canary,omitempty"`
}

// +k8s:deepcopy-gen=true
Expand Down Expand Up @@ -512,3 +513,17 @@ func (c *ClientTLS) CreateTLSConfig() (*tls.Config, error) {
ClientAuth: clientAuth,
}, nil
}

// +k8s:deepcopy-gen=true

// Canary middleware settings.
type Canary struct {
Product string `json:"product,omitempty" toml:"product,omitempty" yaml:"product,omitempty" export:"true"`
Server string `json:"server,omitempty" toml:"server,omitempty" yaml:"server,omitempty" export:"true"`
UIDCookies []string `json:"uidCookies,omitempty" toml:"uidCookies,omitempty" yaml:"uidCookies,omitempty" export:"true"`
AddRequestID bool `json:"addRequestID,omitempty" toml:"addRequestID,omitempty" yaml:"addRequestID,omitempty" export:"true"`
CanaryResponseHeader bool `json:"canaryResponseHeader,omitempty" toml:"canaryResponseHeader,omitempty" yaml:"canaryResponseHeader,omitempty" export:"true"`
MaxCacheSize int `json:"maxCacheSize,omitempty" toml:"maxCacheSize,omitempty" yaml:"maxCacheSize,omitempty" export:"true"`
CacheExpiration types.Duration `json:"cacheExpiration,omitempty" toml:"cacheExpiration,omitempty" yaml:"cacheExpiration,omitempty" export:"true"`
CacheCleanDuration types.Duration `json:"cacheCleanDuration,omitempty" toml:"cacheCleanDuration,omitempty" yaml:"cacheCleanDuration,omitempty" export:"true"`
}
52 changes: 52 additions & 0 deletions pkg/config/dynamic/zz_generated.deepcopy.go

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

Loading

0 comments on commit 1ff267d

Please sign in to comment.