Commit graph

424 commits

Author SHA1 Message Date
Ahmet Alp Balkan
a0a9852afe
hack: comment out autogenerated warning (#182)
Fixes #181.
2019-03-07 23:29:18 -08:00
Ahmet Alp Balkan
b44d855e5c
update the architecture diagram (#179)
- remove external service call of currencyservice
- add a dependency to productcatalog from checkout service.
2019-03-07 12:12:26 -08:00
Ahmet Alp Balkan
342318a9ae
hack: remove redundant license headers in release (#171)
* remove per-yaml license headers in release manifests
* manually insert a license header in release manifests
* add README.md to /kubernetes-manifests indicating they're not ready to use
  (and refer to /release instead).
* regenerate manifests

Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2019-03-07 09:54:56 -08:00
Heechul Ryu
d23fe9cf33 Fix the half-broken url for skaffold installation (#178)
* Fix the half-broken url for skaffold installation

* fix install skaffold link
2019-03-07 09:54:40 -08:00
Ahmet Alp Balkan
b72f32d66d
istio-manifests: remove external currency api (#175)
this is not unused per #173.

Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2019-03-06 23:23:28 -08:00
Ace Nassri
f7580958cc Switch currencyservice to static JSON file (#173) 2019-03-06 16:42:08 -08:00
Mehdi El Gueddari
d5db024763 kubernetes: use apps/v1 for Deployment (#166)
In certain situations (see details below), the deployment to Kubernetes fails with:

> "The Deployment [DEPLOYMENT_OBJECT] is invalid: [...] `selector` does not match template `labels`".

This is caused by the K8S Deployment manifests missing an explicit `selector` value.

This commit:
* adds explicit `selector` values for all Deployment objects.
* bumps the K8S API from the deprecated `extensions/v1beta1` version to the stable `apps/v1` version. This version made the `selector` property of the Deployment a required value, preventing any issues with missing selectors in the future.

This change is backwards compatible with existing deployments of the microservices demo app. I.e. you should be able to pull this change and run `skaffold run` against an existing deployment of the app without issues.

This will not however resolve the issue for existing deployments. Selectors are immutable and will therefore retain their current defaulted value. You should run `skaffold delete` followed by `skaffold run` after having pulled this change to do a clean re-deployment of the app, which will resolve the issue.

**The nitty-gritty details**

In the `extensions/v1beta1` version of K8S API (the version that was used by this project), the `selector` property of a Deployment object is optional and is defaulted to the labels used in the pod template. This can cause subtle issues leading to deployment failures. This project, where Deployment selectors were omitted, is a good example of what can go wrong with defaulted selectors.

Consider this:

1. Run `skaffold run` to build locally with Docker and deploy.

Since the Deployment specs don't have explict selectors, they will be defaulted to the pod template labels. And since skaffold adds additional labels to the pod template like `skaffold-builder` and `skaffold-deployer`, the end-result will be a selector that looks like this:

> app=cartservice,cleanup=true,docker-api-version=1.39,skaffold-builder=local,skaffold-deployer=kubectl,skaffold-tag-policy=git-commit,tail=true

So far, so good.

2. Now run `skaffold run -p gcb --default-repo=your-gcr-repo` to build on Google Cloud Build instead of building locally.

This will blow up when attempting to deploy to Kubernetes with an error similar to:

> The Deployment "cartservice" is invalid: spec.template.metadata.labels: Invalid value: map[string]string{"skaffold-builder":"google-cloud-build", "profiles"="gcb", "skaffold-deployer":"kubectl", "skaffold-tag-policy":"git-commit", "docker-api-version":"1.39", "tail":"true", "app":"cartservice", "cleanup":"true"}: `selector` does not match template `labels`

(and the same error for every other deployment object)

This is because the skaffold labels that were automatically added to the pod template have changed to include references to Google Cloud Build. That normally shouldn't be an issue.

But without explicit Deployment selectors, this results in the defaulted selectors for our Deployment objects to have also changed. Which means that the new version of our Deployment objects are now managing different sets of Pods. Which is thankfully caught by kubectl before the deployment happens (otherwise this would have resulted in orphaned pods).

In this commit, we explicitely set the `selector` value of all Deployment objects, which fixes this issue. We also bump the K8S API version to the stable `apps/v1`, which makes the `selector` property a required value and will avoid accidently forgetting selectors in the future.

More details if you're curious:

* Why defaulted Deployment selectors cause problems: https://github.com/kubernetes/kubernetes/issues/26202
* Why Deployment selectors should be (and were made) immutable: https://github.com/kubernetes/kubernetes/issues/50808
2019-03-04 10:52:55 -08:00
sebright
d08d419a94 adservice: use Stackdriver special field to set sampling decision in log entries (#168)
This commit sets the new sampling decision field that is recognized by the
Stackdriver Logging agent, "logging.googleapis.com/traceSampled".  The sampling
decision field was added in
https://github.com/GoogleCloudPlatform/fluent-plugin-google-cloud/pull/297, and
it won't be available until the new version of fluent-plugin-google-cloud is
used in GKE.
2019-02-28 22:34:57 -07:00
Ahmet Alp Balkan
458bf50b95
credit card expired (#167)
fixes #164

Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2019-02-27 09:54:18 -07:00
David Ebbo
b9792c94c8 Add missing extension to pre-built images instructions in readme (#160) 2019-02-22 09:55:40 -08:00
Ahmet Alp Balkan
5f41e12b2f
README formatting (#158)
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2019-02-20 14:34:12 -08:00
Ahmet Alp Balkan
bae651f7ea
Release v0.1.0 2019-02-20 11:17:45 -08:00
Ahmet Alp Balkan
ef64fdae86
Show option to use prebuilt images (#156)
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2019-02-20 11:07:37 -08:00
Ahmet Alp Balkan
f3e29f7450
hack: fix release scripts (#157)
Previous release script wasn't committing/tagging in the right order.
Also made scripts resistant to:
* empty env vars
* current workdir the script is invoked from

cc: @m-okeefe
2019-02-20 11:07:26 -08:00
Ahmet Alp Balkan
cedf3ce827
Release v0.1.0 2019-02-20 09:47:52 -08:00
Ahmet Alp Balkan
3b4c04fe65
loadgenerator: check curl install (#153)
without &&, load generator startup was failing intermittently when it fails
to install curl from apk-add.

Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2019-02-18 15:54:01 -08:00
Ahmet Alp Balkan
1605c21f69
readme: hide option 3
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2019-02-18 14:28:14 -08:00
Dennis Lumpkins
1c1c8b42ef Fix small typo in installation section of README (#148)
Fix typo in README.md
2019-02-15 14:48:20 -08:00
Alex Rebert
7eb028d747 Fix typo in skaffold.yaml comment (#147) 2019-02-15 13:58:05 -08:00
Selçuk Usta
e99d0808bf Fixing ./gradlew: Permission denied problem on Dockerfile (#146) 2019-02-15 08:22:48 -08:00
rghetia
741c669c34 adservice: restore old grpc views until new grpc version is released. (#144) 2019-02-14 18:14:42 -08:00
Ahmet Alp Balkan
09f5ce89da
Update README.md 2019-02-14 09:49:46 -08:00
Ahmet Alp Balkan
bb31c3f15e
Update README.md 2019-02-14 09:37:08 -08:00
Ahmet Alp Balkan
0dcd8cd947
hack: compile istio manifests as well (#137)
- compile k8s manifests to release/kubernetes-manifests.yaml
- compile istio manifests to release/istio-manifests.yaml
2019-01-31 15:25:33 -08:00
Bogdan Drutu
31df60f050 Updates deps, OC instrumentation, formatting. (#131) 2019-01-30 13:35:03 -08:00
Ahmet Alp Balkan
02b2018b0e
recommendationservice: compile deps from requirements.in (#135)
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2019-01-30 00:24:07 -08:00
Megan O'Keefe
1d045de655 productcatalog: introduce configurable latency (#134) 2019-01-29 16:08:24 -08:00
Ahmet Alp Balkan
3da0ae3b31
hack: polish scripts (#133)
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2019-01-29 14:05:37 -08:00
Megan O'Keefe
1d452f449a Adds make-release script, static k8s manifests (#132)
Closes #75.  

### Changelog 

Adds 4 scripts to the `hack/` directory for building/pushing images, injecting images tags into static manifests, and tagging new releases. See [hack/README.md](https://github.com/m-okeefe/microservices-demo/tree/release-script/hack). 

**Note**: since we have not pushed images yet, the images in the `./release/` manifests are still set to the skaffold defaults (eg. `adservice`).
2019-01-29 11:23:33 -08:00
Ahmet Alp Balkan
ea424cb9f7
add skaffold version note
Fixes #127
2019-01-22 12:30:30 -08:00
rghetia
3812cf741d fix typo in Stackdriver init method name. (#130) 2019-01-22 10:37:03 -08:00
sebright
2ef073f600 adservice: Add "time" field to JSON log entries. (#129)
The Log4j JsonLayout puts the log entry timestamp in a field named "instant" by
default, but the Stackdriver Logging agent does not understand that field.  The
logging agent instead uses the time that it received the log entry, which is
less accurate and has only second-level precision.

This commit adds a key-value pair to the JsonLayout pattern that can be
understood by the logging agent.  It uses a "time" key as described in
https://cloud.google.com/logging/docs/agent/configuration#timestamp-processing
and formats the timestamp as described in the Protocol Buffer JSON mapping,
https://developers.google.com/protocol-buffers/docs/proto3#json.

Allowing the Stackdriver Logging agent to read the more accurate timestamps
inserted by Log4j is especially important in the adservice, because the logs are
correlated with traces, and it is important to see where each message was logged
on the timeline of the trace.
2019-01-22 09:56:50 -08:00
rghetia
54f0a8d058 add jaeger support for productcatalog and shipping. (#126) 2019-01-22 09:56:39 -08:00
Ahmet Alp Balkan
10dfd04ab1
README: use GKE add-on for Istio instructions (#121)
I also edited some irrelevant parts of the file, don't mind those.

Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2019-01-15 10:14:33 -08:00
Ahmet Alp Balkan
8deb49e5ec
Update README.md 2019-01-14 14:42:13 -08:00
Oussema CHERNI
dcdd657d82 Fix broken doc link (#122) 2019-01-14 08:12:52 -08:00
Dave Stanke
791a2822ad Update skaffold to v0.20.0 (to support newer skaffold config) (#123) 2019-01-14 08:11:18 -08:00
Dustin Ingram
aaf2f8717d Simplify package management for python services (#120)
This PR does a few things:

1. **Removes unnecessary Python dependencies currently being installed for `emailservice`**

    There are quite a few packages being installed that aren't actual dependencies.

2. **Removes a number of related, also unnecessary system-level dependencies for `emailservice`**

    These were a result of the Python dependencies that are unnecessary.

3. **Pins all of the sub-dependencies for `loadgenerator`**

    This is good practice to ensure that things don't break one day in the future when a newer version of an unpinned sub-dependenency is released.

4. **Compile all Python dependencies from `requirements.in` files**

    This is mostly bookkeeping. It allows us to only specify the top-level dependencies we care about in the requirements.in files, which are then compiled to frozen dependencies in the requirements.txt files. This ensures that we only install the dependencies we need, and that we're not missing any unpinned sub-dependencies. It also makes it more clear where our sub-dependencies are coming from.

5. **Switch to -slim images from -alpine**

    Python's built distribution format (wheel) is incompatible with alpine-based images, causing dependencies like `grpcio` to be compiled from scratch, rather than from a pre-built wheel.

    This should improve or possibly fi​x #58, while keeping the image size roughly the same:

    ```
    emailservice          latest           d1b818eabe05        6 seconds ago       286MB
    loadgenerator         latest           4d9b5acbfbbb        6 seconds ago       125MB
    ```
2019-01-11 14:59:27 -08:00
Ahmet Alp Balkan
823e993104
update skaffold manifest to clear warnings (#117)
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2019-01-10 10:35:17 -08:00
rghetia
2b074f7ff3
Add jaeger export to checkoutservice. (#116)
* Add jaeger export to checkoutservice.

* fix review comments.
2019-01-10 10:25:07 -08:00
rghetia
33ca3b63d8
Unify jaeger enabling method for adservice. (#115) 2019-01-09 05:42:54 -08:00
rghetia
85c7131d43 Add jaeger support for frontend. (#113) 2019-01-08 11:08:20 -08:00
Ahmet Alp Balkan
27e1b03c26
Add conference videos 2019-01-08 10:51:36 -08:00
rghetia
d944092100 Add Jaeger support for Adservice. (#111)
This is the first service that exports to jaeger. Others to follow.
Requires jaeger to be instantiated using 

- helm install --name jaeger stable/jaeger-operator
- kubectl apply -f jaeger.yaml

=== jaeger.yaml Content ===
apiVersion: io.jaegertracing/v1alpha1
kind: Jaeger
metadata:
  name: jaeger

Above steps will be added to README in subsequent PR.
2019-01-03 12:56:06 -08:00
Ahmet Alp Balkan
94ed247c0b
Update README.md 2019-01-03 11:25:03 -08:00
Ahmet Alp Balkan
90e43a8744
move img/ to docs/img (#110)
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2019-01-02 13:34:01 -08:00
charlesbaer
d966bc7c5d Minor update to README.md (#104)
Added the --region to gcloud container clusters create
2018-12-18 10:06:19 -08:00
Théo Chamley
c91dca764f Toggle bug in ProductCatalogService for demos (#85)
Fixes #84.
2018-12-17 11:06:49 -08:00
Chris Kleinknecht
5272a4d821 Re-enable opencensus python (#103)
Enables tracing in the email and recommendation services, which was disabled in 316db88 because of a memory leak in the stackdriver exporter.

We fixed the leak in https://github.com/googleapis/google-cloud-python/pull/6856. The fix is included in the [0.1.10 release of opencensus-python](https://github.com/census-instrumentation/opencensus-python/releases/tag/v0.1.10).

With this diff, traces show up as expected in stackdriver while running the demo on GKE. Using an `opencensus-python` package version before `0.1.10` causes the email and recommendation services to leak memory until they OOM. Memory use is back to normal (i.e. roughly constant) using the new package version.
2018-12-11 16:15:51 -08:00
Dave Stanke
cb241e197d Clarify description of cloudbuild.yaml (#102) 2018-12-03 14:59:18 -08:00