Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into trait_name
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghostbaby committed Jul 7, 2020
2 parents c1d0efc + d9a7a18 commit 05cdd00
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 9 deletions.
2 changes: 2 additions & 0 deletions charts/oam-core-runtime/templates/oam-controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,13 @@ spec:
ports:
- containerPort: 8443
name: https
{{ if .Values.useWebhook }}
volumes:
- name: tls-cert
secret:
defaultMode: 420
secretName: {{ .Values.certificate.secretName | quote }}
{{ end }}
terminationGracePeriodSeconds: 10
{{- with .Values.nodeSelector }}
nodeSelector:
Expand Down
59 changes: 59 additions & 0 deletions examples/flight-tracker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Flight Tracker

This is an example microservices application with a Javascript Web UI, a PostgreSQL database, and a series of API microservices. The idea is that various app developers would create Components for their corresponding apps. The overall config will add traits and allow the app to be fully deployed

![](https://github.com/oam-dev/samples/raw/master/2.ServiceTracker_App/service-tracker-diagram.jpg)

> Full application original source here: https://github.com/chzbrgr71/service-tracker
## Apply Definition

For this demo, it is necessary to create a `WorkloadDefinition` for the `ContainerizedWorkload` and `PostgreSQLInstance` workload types, and a `TraitDefinition` for the `ManualScalerTrait` type.

```bash
$ kubectl apply -f definitions/
workloaddefinition.core.oam.dev/containerizedworkloads.core.oam.dev created
traitdefinition.core.oam.dev/manualscalertraits.core.oam.dev created
```

## Install Component

Register the `Components`.

```bash
$ kubectl apply -f components/
component.core.oam.dev/data-api created
component.core.oam.dev/tracker-postgres-db created
component.core.oam.dev/flights-api created
component.core.oam.dev/quakes-api created
component.core.oam.dev/service-tracker-ui created
component.core.oam.dev/weather-api created
```

## Run ApplicationConfiguration

Install the `ApplicationConfiguration`.

```bash
$ kubectl apply -f tracker-app-config.yaml
secret/dbuser created
applicationconfiguration.core.oam.dev/service-tracker created
```

## Result

Visit your browser, and open `http://{your-ingress-address}/web-ui` for the Service Tracker website. Refresh the data on the dashboard for each of the microservices.

![image](https://tvax2.sinaimg.cn/large/ad5fbf65ly1ggh2brro77j21hb0tan00.jpg)

## Clean up

clean resource of `flight-tracke`.

```bash
$ kubectl delete -f .
$ kubectl delete -f components/
$ kubectl delete -f definitions/
```

> More info, please see https://github.com/oam-dev/samples/tree/master/2.ServiceTracker_App
7 changes: 7 additions & 0 deletions examples/flight-tracker/definitions/ingress-trait.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: core.oam.dev/v1alpha2
kind: TraitDefinition
metadata:
name: ingresses.extensions
spec:
definitionRef:
name: ingresses.extensions
12 changes: 11 additions & 1 deletion examples/flight-tracker/tracker-app-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,14 @@ spec:
- name: weatherUri
value: "http://weather-api.default.svc.cluster.local:3015/"
- name: quakesUri
value: "http://quakes-api.default.svc.cluster.local:3012/"
value: "http://quakes-api.default.svc.cluster.local:3012/"
traits:
- trait:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: tracker-ingress
spec:
backend:
serviceName: web-ui
servicePort: 8080
8 changes: 0 additions & 8 deletions examples/flight-tracker/tracker-ingress.yaml

This file was deleted.

0 comments on commit 05cdd00

Please sign in to comment.