Skip to content

Commit

Permalink
initial commit of service mesh demo with istio based on their demos a…
Browse files Browse the repository at this point in the history
…t istio/istio
  • Loading branch information
christian-posta committed Apr 11, 2017
1 parent 0ce3cfc commit 6765c9a
Show file tree
Hide file tree
Showing 24 changed files with 1,075 additions and 0 deletions.
218 changes: 218 additions & 0 deletions service-mesh/istio/bookinfo/app/bookinfo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
# Copyright 2017 Istio Authors
#
# 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.

##################################################################################################
# Details service
##################################################################################################
apiVersion: v1
kind: Service
metadata:
name: details
labels:
app: details
spec:
ports:
- port: 9080
name: http
selector:
app: details
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: details-v1
spec:
replicas: 1
template:
metadata:
labels:
app: details
version: v1
spec:
containers:
- name: details
image: istio/examples-bookinfo-details-v1
imagePullPolicy: IfNotPresent
ports:
- containerPort: 9080
---
##################################################################################################
# Ratings service
##################################################################################################
apiVersion: v1
kind: Service
metadata:
name: ratings
labels:
app: ratings
spec:
ports:
- port: 9080
name: http
selector:
app: ratings
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: ratings-v1
spec:
replicas: 1
template:
metadata:
labels:
app: ratings
version: v1
spec:
containers:
- name: ratings
image: istio/examples-bookinfo-ratings-v1
imagePullPolicy: IfNotPresent
ports:
- containerPort: 9080
---
##################################################################################################
# Reviews service
##################################################################################################
apiVersion: v1
kind: Service
metadata:
name: reviews
labels:
app: reviews
spec:
ports:
- port: 9080
name: http
selector:
app: reviews
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: reviews-v1
spec:
replicas: 1
template:
metadata:
labels:
app: reviews
version: v1
spec:
containers:
- name: reviews
image: istio/examples-bookinfo-reviews-v1
imagePullPolicy: IfNotPresent
ports:
- containerPort: 9080
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: reviews-v2
spec:
replicas: 1
template:
metadata:
labels:
app: reviews
version: v2
spec:
containers:
- name: reviews
image: istio/examples-bookinfo-reviews-v2
imagePullPolicy: IfNotPresent
ports:
- containerPort: 9080
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: reviews-v3
spec:
replicas: 1
template:
metadata:
labels:
app: reviews
version: v3
spec:
containers:
- name: reviews
image: istio/examples-bookinfo-reviews-v3
imagePullPolicy: IfNotPresent
ports:
- containerPort: 9080
---
##################################################################################################
# Productpage service
##################################################################################################
apiVersion: v1
kind: Service
metadata:
name: productpage
labels:
app: productpage
spec:
ports:
- port: 9080
name: http
selector:
app: productpage
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: productpage-v1
spec:
replicas: 1
template:
metadata:
labels:
app: productpage
version: v1
spec:
containers:
- name: productpage
image: istio/examples-bookinfo-productpage-v1
imagePullPolicy: IfNotPresent
ports:
- containerPort: 9080
---
###########################################################################
# Ingress resource (gateway)
##########################################################################
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: gateway
annotations:
kubernetes.io/ingress.class: "istio"
spec:
rules:
- http:
paths:
- path: /productpage
backend:
serviceName: productpage
servicePort: 9080
- path: /login
backend:
serviceName: productpage
servicePort: 9080
- path: /logout
backend:
serviceName: productpage
servicePort: 9080
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
type: route-rule
name: ratings-test-delay
spec:
destination: ratings.default.svc.cluster.local
precedence: 2
match:
httpHeaders:
Cookie:
regex: "^(.*?;)?(user=jason)(;.*)?$"
route:
- tags:
version: v1
httpFault:
delay:
percent: 100
fixedDelaySeconds: 5.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type: mixer-rule
name: ratings-ratelimit
spec:
selector: target.service == "ratings.default.svc.cluster.local"
aspects:
- kind: quotas
params:
35 changes: 35 additions & 0 deletions service-mesh/istio/bookinfo/app/route-rule-all-v1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
type: route-rule
name: productpage-default
spec:
destination: productpage.default.svc.cluster.local
precedence: 1
route:
- tags:
version: v1
---
type: route-rule
name: reviews-default
spec:
destination: reviews.default.svc.cluster.local
precedence: 1
route:
- tags:
version: v1
---
type: route-rule
name: ratings-default
spec:
destination: ratings.default.svc.cluster.local
precedence: 1
route:
- tags:
version: v1
---
type: route-rule
name: details-default
spec:
destination: details.default.svc.cluster.local
precedence: 1
route:
- tags:
version: v1
16 changes: 16 additions & 0 deletions service-mesh/istio/bookinfo/app/route-rule-delay.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
type: route-rule
name: ratings-test-delay
spec:
destination: ratings.default.svc.cluster.local
precedence: 2
match:
httpHeaders:
Cookie:
regex: "^(.*?;)?(user=test-user)(;.*)?$"
route:
- tags:
version: v1
httpFault:
delay:
percent: 100
fixedDelaySeconds: 7.0
12 changes: 12 additions & 0 deletions service-mesh/istio/bookinfo/app/route-rule-reviews-50-v3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
type: route-rule
name: reviews-default
spec:
destination: reviews.default.svc.cluster.local
precedence: 1
route:
- tags:
version: v1
weight: 50
- tags:
version: v3
weight: 50
12 changes: 12 additions & 0 deletions service-mesh/istio/bookinfo/app/route-rule-reviews-test-v2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
type: route-rule
name: reviews-test-v2
spec:
destination: reviews.default.svc.cluster.local
precedence: 2
match:
httpHeaders:
Cookie:
regex: "^(.*?;)?(user=jason)(;.*)?$"
route:
- tags:
version: v2
9 changes: 9 additions & 0 deletions service-mesh/istio/bookinfo/app/route-rule-reviews-v3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
type: route-rule
name: reviews-default
spec:
destination: reviews.default.svc.cluster.local
precedence: 1
route:
- tags:
version: v3
weight: 100
13 changes: 13 additions & 0 deletions service-mesh/istio/bookinfo/cleanup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

. $(dirname ${BASH_SOURCE})/../../../util.sh

istioctl delete route-rule productpage-default
istioctl delete route-rule reviews-default
istioctl delete route-rule ratings-default
istioctl delete route-rule details-default
istioctl delete route-rule reviews-test-v2
istioctl delete route-rule ratings-test-delay
#istioctl delete mixer-rule ratings-ratelimit

kubectl delete -f $(relative app/bookinfo.yaml)
Loading

0 comments on commit 6765c9a

Please sign in to comment.