Skip to content

Commit

Permalink
Break up the helloworld sample into versions (istio#11650)
Browse files Browse the repository at this point in the history
* Break up the helloworld sample into versions

* Moved to default namespace

* Seperated gateway file and added labels

* Update the doc

* Cleanup section updated too
  • Loading branch information
ymesika authored and smawson committed Feb 12, 2019
1 parent fc955dd commit 1b3d141
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 35 deletions.
4 changes: 3 additions & 1 deletion samples/helloworld/README.md
Expand Up @@ -20,10 +20,11 @@ containers within the `helloworld.yaml` are pre-defined with the request. The (m
injected istio-proxy containers also have the requests cpu therefore making the `helloworld`
ready for autoscaling.

Now create the deployment using the updated yaml file:
Now create the deployment using the updated yaml file and create the gateway configuration:

```bash
kubectl create -f helloworld-istio.yaml
kubectl create -f helloworld-gateway.yaml
```

Follow the [instructions](https://preliminary.istio.io/docs/tasks/traffic-management/ingress.html#determining-the-ingress-ip-and-ports) to set the INGRESS_HOST and INGRESS_PORT variables then confirm it's running using curl.
Expand Down Expand Up @@ -63,5 +64,6 @@ value > 1.

```bash
kubectl delete -f helloworld-istio.yaml
kubectl delete -f helloworld-gateway.yaml
kubectl delete hpa helloworld-v1 helloworld-v2
```
33 changes: 33 additions & 0 deletions samples/helloworld/helloworld-gateway.yaml
@@ -0,0 +1,33 @@
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: helloworld-gateway
spec:
selector:
istio: ingressgateway # use istio default controller
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: helloworld
spec:
hosts:
- "*"
gateways:
- helloworld-gateway
http:
- match:
- uri:
exact: /hello
route:
- destination:
host: helloworld
port:
number: 5000
38 changes: 4 additions & 34 deletions samples/helloworld/helloworld.yaml
Expand Up @@ -15,6 +15,8 @@ apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: helloworld-v1
labels:
version: v1
spec:
replicas: 1
template:
Expand All @@ -37,6 +39,8 @@ apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: helloworld-v2
labels:
version: v2
spec:
replicas: 1
template:
Expand All @@ -54,37 +58,3 @@ spec:
imagePullPolicy: IfNotPresent #Always
ports:
- containerPort: 5000
---
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: helloworld-gateway
spec:
selector:
istio: ingressgateway # use istio default controller
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: helloworld
spec:
hosts:
- "*"
gateways:
- helloworld-gateway
http:
- match:
- uri:
exact: /hello
route:
- destination:
host: helloworld
port:
number: 5000

0 comments on commit 1b3d141

Please sign in to comment.