Last active
August 23, 2022 05:35
-
-
Save nilesh93/f3f59c16f8cb39745c08d62f4758b411 to your computer and use it in GitHub Desktop.
Cilium Traffic Splitting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: cilium.io/v2 | |
kind: CiliumEnvoyConfig | |
metadata: | |
name: envoy-lb-listener | |
namespace: default | |
spec: | |
services: | |
- name: traffic-split-svc | |
namespace: default | |
backendServices: | |
- name: echo-app-v1 | |
namespace: default | |
# number: 8080 | |
- name: echo-app-v2 | |
namespace: default | |
# number: 8080 | |
resources: | |
- "@type": type.googleapis.com/envoy.config.listener.v3.Listener | |
name: envoy-lb-listener | |
filter_chains: | |
- filters: | |
- name: envoy.filters.network.http_connection_manager | |
typed_config: | |
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager | |
stat_prefix: envoy-lb-listener | |
rds: | |
route_config_name: lb_route # ref | |
http_filters: | |
- name: envoy.filters.http.router | |
- "@type": type.googleapis.com/envoy.config.route.v3.RouteConfiguration | |
name: lb_route | |
virtual_hosts: | |
- name: "lb_route" # ref | |
domains: ["*"] | |
routes: | |
- match: | |
prefix: "/" | |
route: | |
weighted_clusters: | |
clusters: | |
- name: "default/echo-app-v1" | |
weight: 50 | |
- name: "default/echo-app-v2" | |
weight: 50 | |
retry_policy: | |
retry_on: 5xx | |
num_retries: 3 | |
per_try_timeout: 1s | |
regex_rewrite: | |
pattern: | |
google_re2: {} | |
regex: "^/foo.*$" | |
substitution: "/" | |
- "@type": type.googleapis.com/envoy.config.cluster.v3.Cluster | |
name: "default/echo-app-v1" | |
connect_timeout: 5s | |
lb_policy: ROUND_ROBIN | |
type: EDS | |
outlier_detection: | |
split_external_local_origin_errors: true | |
consecutive_local_origin_failure: 2 | |
- "@type": type.googleapis.com/envoy.config.cluster.v3.Cluster | |
name: "default/echo-app-v2" | |
connect_timeout: 3s | |
lb_policy: ROUND_ROBIN | |
type: EDS | |
outlier_detection: | |
split_external_local_origin_errors: true | |
consecutive_local_origin_failure: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
creationTimestamp: null | |
labels: | |
app: echo-app-v1 | |
name: echo-app-v1 | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
app: echo-app-v1 | |
strategy: {} | |
template: | |
metadata: | |
creationTimestamp: null | |
labels: | |
app: echo-app-v1 | |
spec: | |
containers: | |
- image: hashicorp/http-echo | |
name: echo | |
args: | |
- "-text=Canary v1" | |
- -listen=:8080 | |
ports: | |
- containerPort: 8080 | |
resources: {} | |
status: {} | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
creationTimestamp: null | |
labels: | |
app: echo-app-v1 | |
name: echo-app-v1 | |
spec: | |
ports: | |
- port: 80 | |
protocol: TCP | |
targetPort: 8080 | |
selector: | |
app: echo-app-v1 | |
type: ClusterIP | |
status: | |
loadBalancer: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
creationTimestamp: null | |
labels: | |
app: echo-app-v2 | |
name: echo-app-v2 | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
app: echo-app-v2 | |
strategy: {} | |
template: | |
metadata: | |
creationTimestamp: null | |
labels: | |
app: echo-app-v2 | |
spec: | |
containers: | |
- image: hashicorp/http-echo | |
name: echo | |
args: | |
- "-text=Canary v2" | |
- -listen=:8080 | |
ports: | |
- containerPort: 8080 | |
resources: {} | |
status: {} | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
creationTimestamp: null | |
labels: | |
app: echo-app-v2 | |
name: echo-app-v2 | |
spec: | |
ports: | |
- port: 80 | |
protocol: TCP | |
targetPort: 8080 | |
selector: | |
app: echo-app-v2 | |
type: ClusterIP | |
status: | |
loadBalancer: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: traffic-split-svc | |
namespace: default | |
spec: | |
type: ClusterIP | |
ports: | |
- protocol: TCP | |
port: 80 | |
targetPort: 8080 | |
--- | |
apiVersion: v1 | |
kind: Endpoints | |
metadata: | |
name: traffic-split-svc | |
namespace: default | |
subsets: | |
- addresses: | |
# Dummy IP, never used but required for now | |
- ip: 192.192.192.192 | |
ports: | |
- port: 8080 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment