Anthony Chu Contact Me

Including CSS in VSTS Code Coverage Results

Wednesday, May 31, 2017

Visual Studio Team Services does not currently render external CSS files for coverage results. Code coverage reports generated by tools such as Cobertura do not have styles visible when viewed in VSTS.

No CSS

According to this GitHub issue, the styles and scripts are removed because of potential security issues. We can partially get around this by inlining styles into our reports.

Continue Reading...


Using Mongoose Discriminators to Store Multiple Entities in a Single Cosmos DB Collection

Monday, May 29, 2017

When transitioning to Cosmos DB (formerly DocumentDB), a common misconception is that collections are equivalent to tables in relational databases.

The guidance for Cosmos DB is actually to store multiple types of entities with different schemas in the same collection. The main reason for this is that documents in the same DocumentDB collection can participate in transactions (via stored procedures).

While applications using Cosmos DB's MongoDB API don't really take advantage of transactions, there's still a huge reason for using a single collection for multiple entity types... to save money. Cosmos DB charges per collection.

In this article, we'll take a look at using discriminators in Mongoose (a popular MongoDB library for Node.js) to store multiple entities in a single Cosmos DB collection.

Continue Reading...


Running a VSTS Docker Agent in Kubernetes

Monday, April 24, 2017

Kubernetes and Visual Studio Team Services are my two favorite things to hack on these days. Today we'll look at how to run VSTS private build agents in Kubernetes.

Why run VSTS agents in Kubernetes?

Save money

One reason we might want to run VSTS agents in Kubernetes is to save costs. Each VSTS account comes with 240 build minutes per month. After they're used up, we have to pay $40. That isn't a lot. But if we're running a Kubernetes cluster anyway, it might be advantageous to run our own VSTS agents on there.

In the past, it was difficult to set up and maintain agent machines. But now VSTS agents can run as Docker containers; this makes it really simple to run them in Kubernetes.

Run tests on services not accessible by VSTS hosted agents

Another reason to run VSTS agents in Kubernetes is to make it possible to run integration and functional tests on services in the cluster that do not have a public endpoint. This is the scenario we'll talk about today.

Services in Kubernetes can be exposed directly through a load balancer or via an ingress. But other services such as those of type ClusterIP are not reachable from the public internet and are difficult to test from a cloud service like VSTS.

Continue Reading...


Versioning a REST API in Kubernetes with NGINX Ingress Controller

Tuesday, April 11, 2017

An ingress makes it easy to route traffic entering a Kubernetes cluster through a load balancer like NGINX. Beyond basic load balancing and TLS termination, an ingress can have rules for routing to different backends based on paths. The NGINX ingress controller also allows more advanced configurations such as URL rewrites.

In this post, we'll use ingress rules and URL rewrites to route traffic between two versions of a REST API. Each version is deployed as a service (api-version1 and api-version2). We will route traffic with path /api/v1 to api-version1, and /api/v2 to api-version2.

Continue Reading...


Managing ASP.NET Core App Settings on Kubernetes

Tuesday, March 14, 2017

Kubernetes is quickly becoming my favorite container orchestrator. Everything, so far, has been intuitive and it looks like they've put a lot of thought into how all the pieces fit together. One example is how it handles configuration and secrets.

Today we'll look at how to use secrets in Kubernetes to override some properties in an ASP.NET Core app's configuration at runtime.

Continue Reading...