-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Welcome to the service-cache wiki! In this wiki, you will learn how service-cache help you enhance the service performance and reduce latency by using cache.
When you want to enable cache for a service, what you have to do is simply adding annotations for the service.
You are free to choose what resources of a service are cacheable.
metadata:
annotations:
service-cache.github.io/default: "true"
metadata:
annotations:
service-cache.github.io/default: 'true'
service-cache.github.io/URLs: '["/foo", "/bar"]'
or disabled caching by default, but allow caching for only some of resources:
metadata:
annotations:
service-cache.github.io/default: 'false'
service-cache.github.io/URLs: '["/foo", "/bar"]'
An alternative way to add cache for a services is, create a custom resource - ServiceCache. By creating a ServiceCache resource, you tell Service Cache what service and its resources are going to be cached.
To process the above two ways of caching for services, you need to deploy a kubernetes operator. The kubernetes operator monitors services and ServiceCache and correlates them.
The kubernetes operator has two controllers, each of them is used to do following.
The first Kubernetes controller is used to monitor what services are to be service-cache enabled. When a service is annotated, the kubernetes controller creates a custom resource - ServiceCache for it.
When the annotations in a service are updated or deleted, its corresponding ServiceCache object is also updated or deleted.
The second Kubernetes controller is used to monitor ServiceCache. Once it knows a ServiceCache has been created or updated, it checks and ensures the service related to this ServiceCache is also annotated and synced.
When a ServiceCache object is deleted, the operator also removes the annotations from the related service.
The Envoy filter is a filter of Istio Envoy proxy. It is used to intercept the requests and determine if the cacheable response should be returned, based on the configurations stored in ServiceCache resources.
Read more about envoy-cache-filter.
service-cache - make k8s service cacheable more easily