Skip to content

Commit

Permalink
Added listeners to virtual-router under VirtualService CRD
Browse files Browse the repository at this point in the history
  • Loading branch information
kiranmeduri committed Jun 19, 2019
1 parent 734d868 commit a8de398
Show file tree
Hide file tree
Showing 12 changed files with 146 additions and 78 deletions.
17 changes: 17 additions & 0 deletions deploy/all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,23 @@ spec:
properties:
name:
type: string
listeners:
type: array
items:
type: object
properties:
portMapping:
properties:
port:
type: integer
protocol:
type: string
enum:
- tcp
- http
- grpc
- http2
- https
routes:
type: array
items:
Expand Down
94 changes: 52 additions & 42 deletions examples/color.yaml → examples/color.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -4,119 +4,129 @@ kind: Namespace
metadata:
labels:
appmesh.k8s.aws/sidecarInjectorWebhook: enabled
name: appmesh-demo
name: ${APP_NAMESPACE}
---
apiVersion: appmesh.k8s.aws/v1beta1
kind: Mesh
metadata:
name: color-mesh
name: ${MESH_NAME}
---
apiVersion: appmesh.k8s.aws/v1beta1
kind: VirtualNode
metadata:
name: colorgateway
namespace: appmesh-demo
namespace: ${APP_NAMESPACE}
spec:
meshName: color-mesh
meshName: ${MESH_NAME}
listeners:
- portMapping:
port: 9080
protocol: http
serviceDiscovery:
dns:
hostName: colorgateway.appmesh-demo.svc.cluster.local
hostName: colorgateway.${APP_NAMESPACE}.svc.cluster.local
backends:
- virtualService:
virtualServiceName: colorteller.appmesh-demo
virtualServiceName: colorteller.${APP_NAMESPACE}
---
apiVersion: appmesh.k8s.aws/v1beta1
kind: VirtualNode
metadata:
name: colorteller
namespace: appmesh-demo
namespace: ${APP_NAMESPACE}
spec:
meshName: color-mesh
meshName: ${MESH_NAME}
listeners:
- portMapping:
port: 9080
protocol: http
serviceDiscovery:
dns:
hostName: colorteller.appmesh-demo.svc.cluster.local
hostName: colorteller.${APP_NAMESPACE}.svc.cluster.local
---
apiVersion: appmesh.k8s.aws/v1beta1
kind: VirtualNode
metadata:
name: colorteller-black
namespace: appmesh-demo
namespace: ${APP_NAMESPACE}
spec:
meshName: color-mesh
meshName: ${MESH_NAME}
listeners:
- portMapping:
port: 9080
protocol: http
serviceDiscovery:
dns:
hostName: colorteller-black.appmesh-demo.svc.cluster.local
hostName: colorteller-black.${APP_NAMESPACE}.svc.cluster.local
---
apiVersion: appmesh.k8s.aws/v1beta1
kind: VirtualNode
metadata:
name: colorteller-blue
namespace: appmesh-demo
namespace: ${APP_NAMESPACE}
spec:
meshName: color-mesh
meshName: ${MESH_NAME}
listeners:
- portMapping:
port: 9080
protocol: http
serviceDiscovery:
dns:
hostName: colorteller-blue.appmesh-demo.svc.cluster.local
hostName: colorteller-blue.${APP_NAMESPACE}.svc.cluster.local
---
apiVersion: appmesh.k8s.aws/v1beta1
kind: VirtualNode
metadata:
name: colorteller-red
namespace: appmesh-demo
namespace: ${APP_NAMESPACE}
spec:
meshName: color-mesh
meshName: ${MESH_NAME}
listeners:
- portMapping:
port: 9080
protocol: http
serviceDiscovery:
dns:
hostName: colorteller-red.appmesh-demo.svc.cluster.local
hostName: colorteller-red.${APP_NAMESPACE}.svc.cluster.local
---
apiVersion: appmesh.k8s.aws/v1beta1
kind: VirtualService
metadata:
name: colorteller.appmesh-demo
namespace: appmesh-demo
name: colorteller.${APP_NAMESPACE}
namespace: ${APP_NAMESPACE}
spec:
meshName: color-mesh
meshName: ${MESH_NAME}
virtualRouter:
listeners:
- portMapping:
port: 9080
protocol: http
routes:
- name: color-route
http:
match:
prefix: /
action:
weightedTargets:
- virtualNodeName: colorteller.appmesh-demo
- virtualNodeName: colorteller
weight: 1
- virtualNodeName: colorteller-blue
weight: 1
- virtualNodeName: colorteller-black.appmesh-demo
- virtualNodeName: colorteller-black
weight: 1
---
apiVersion: appmesh.k8s.aws/v1beta1
kind: VirtualService
metadata:
name: colorgateway.appmesh-demo
namespace: appmesh-demo
name: colorgateway.${APP_NAMESPACE}
namespace: ${APP_NAMESPACE}
spec:
meshName: color-mesh
meshName: ${MESH_NAME}
virtualRouter:
listeners:
- portMapping:
port: 9080
protocol: http
routes:
- name: color-route
http:
Expand All @@ -131,7 +141,7 @@ apiVersion: v1
kind: Service
metadata:
name: colorgateway
namespace: appmesh-demo
namespace: ${APP_NAMESPACE}
labels:
app: colorgateway
spec:
Expand All @@ -145,7 +155,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: colorgateway
namespace: appmesh-demo
namespace: ${APP_NAMESPACE}
spec:
replicas: 1
selector:
Expand All @@ -160,20 +170,20 @@ spec:
spec:
containers:
- name: colorgateway
image: "970805265562.dkr.ecr.us-west-2.amazonaws.com/gateway:latest"
image: ${COLOR_GATEWAY_IMAGE}
ports:
- containerPort: 9080
env:
- name: "SERVER_PORT"
value: "9080"
- name: "COLOR_TELLER_ENDPOINT"
value: "colorteller.appmesh-demo:9080"
value: "colorteller.${APP_NAMESPACE}:9080"
---
apiVersion: v1
kind: Service
metadata:
name: colorteller
namespace: appmesh-demo
namespace: ${APP_NAMESPACE}
labels:
app: colorteller
spec:
Expand All @@ -190,7 +200,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: colorteller
namespace: appmesh-demo
namespace: ${APP_NAMESPACE}
spec:
replicas: 1
selector:
Expand All @@ -205,7 +215,7 @@ spec:
spec:
containers:
- name: colorteller
image: 970805265562.dkr.ecr.us-west-2.amazonaws.com/colorteller:latest
image: ${COLOR_TELLER_IMAGE}
ports:
- containerPort: 9080
env:
Expand All @@ -219,7 +229,7 @@ apiVersion: v1
kind: Service
metadata:
name: colorteller-black
namespace: appmesh-demo
namespace: ${APP_NAMESPACE}
labels:
app: colorteller
version: black
Expand All @@ -235,7 +245,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: colorteller-black
namespace: appmesh-demo
namespace: ${APP_NAMESPACE}
spec:
replicas: 1
selector:
Expand All @@ -250,7 +260,7 @@ spec:
spec:
containers:
- name: colorteller
image: 970805265562.dkr.ecr.us-west-2.amazonaws.com/colorteller:latest
image: ${COLOR_TELLER_IMAGE}
ports:
- containerPort: 9080
env:
Expand All @@ -264,7 +274,7 @@ apiVersion: v1
kind: Service
metadata:
name: colorteller-blue
namespace: appmesh-demo
namespace: ${APP_NAMESPACE}
labels:
app: colorteller
version: blue
Expand All @@ -280,7 +290,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: colorteller-blue
namespace: appmesh-demo
namespace: ${APP_NAMESPACE}
spec:
replicas: 1
selector:
Expand All @@ -295,7 +305,7 @@ spec:
spec:
containers:
- name: colorteller
image: 970805265562.dkr.ecr.us-west-2.amazonaws.com/colorteller:latest
image: ${COLOR_TELLER_IMAGE}
ports:
- containerPort: 9080
env:
Expand All @@ -309,7 +319,7 @@ apiVersion: v1
kind: Service
metadata:
name: colorteller-red
namespace: appmesh-demo
namespace: ${APP_NAMESPACE}
labels:
app: colorteller
version: red
Expand All @@ -325,7 +335,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: colorteller-red
namespace: appmesh-demo
namespace: ${APP_NAMESPACE}
spec:
replicas: 1
selector:
Expand All @@ -340,7 +350,7 @@ spec:
spec:
containers:
- name: colorteller
image: 970805265562.dkr.ecr.us-west-2.amazonaws.com/colorteller:latest
image: ${COLOR_TELLER_IMAGE}
ports:
- containerPort: 9080
env:
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module github.com/aws/aws-app-mesh-controller-for-k8s

require (
github.com/BurntSushi/toml v0.3.1 // indirect
github.com/aws/aws-sdk-go v1.19.0
github.com/aws/aws-sdk-go v1.20.3
github.com/deckarep/golang-set v1.7.1
github.com/ghodss/yaml v1.0.0 // indirect
github.com/gogo/protobuf v1.2.1 // indirect
Expand Down
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/aws/aws-sdk-go v1.17.13 h1:MJZwZoDI/UGp/6l0+cfZOQlWCqKmrHTuewhxfd5uQeE=
github.com/aws/aws-sdk-go v1.17.13/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
github.com/aws/aws-sdk-go v1.19.0 h1:3d9Htr/dl/+8xJYx/fpjEifvfpabZB1YUu61i/WX87Q=
github.com/aws/aws-sdk-go v1.19.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
github.com/aws/aws-sdk-go v1.20.3 h1:iQLxGfR0yh7g5M8Xg7wOGyhQ4hoZb/zA0XQNOGPdlpY=
github.com/aws/aws-sdk-go v1.20.3/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
Expand Down
8 changes: 5 additions & 3 deletions pkg/apis/appmesh/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ type MeshSpec struct {
type MeshStatus struct {
// MeshArn is the AppMesh Mesh object's Amazon Resource Name
// +optional
MeshArn *string `json:"meshArn,omitempty"`
Conditions []MeshCondition `json:"meshCondition"`
MeshArn *string `json:"meshArn,omitempty"`
Conditions []MeshCondition `json:"meshCondition"`
}

type MeshConditionType string
Expand Down Expand Up @@ -102,8 +102,10 @@ type VirtualServiceSpec struct {
Routes []Route `json:"routes,omitempty"`
}

// VirtualRouter is the spec for a VirtualRouter resource
type VirtualRouter struct {
Name string `json:"name"`
Name string `json:"name"`
Listeners []Listener `json:"listeners,omitempty"`
}

type Route struct {
Expand Down
7 changes: 6 additions & 1 deletion pkg/apis/appmesh/v1beta1/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 a8de398

Please sign in to comment.