mirror of
https://github.com/fluxcd/flagger.git
synced 2026-04-15 06:57:34 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -554,6 +554,85 @@ spec:
|
||||
Flagger works for user facing apps exposed outside the cluster via an ingress gateway
|
||||
and for backend HTTP APIs that are accessible only from inside the mesh.
|
||||
|
||||
If `Delegation` is enabled, Flagger would generate Istio VirtualService without hosts and gateway,
|
||||
making the service compatible with Istio delegation.
|
||||
|
||||
```yaml
|
||||
apiVersion: flagger.app/v1beta1
|
||||
kind: Canary
|
||||
metadata:
|
||||
name: backend
|
||||
namespace: test
|
||||
spec:
|
||||
service:
|
||||
delegation: true
|
||||
port: 9898
|
||||
targetRef:
|
||||
apiVersion: v1
|
||||
kind: Deployment
|
||||
name: podinfo
|
||||
analysis:
|
||||
interval: 15s
|
||||
threshold: 15
|
||||
maxWeight: 30
|
||||
stepWeight: 10
|
||||
```
|
||||
|
||||
Based on the above spec, Flagger will create the following virtual service:
|
||||
|
||||
```yaml
|
||||
apiVersion: networking.istio.io/v1alpha3
|
||||
kind: VirtualService
|
||||
metadata:
|
||||
name: backend
|
||||
namespace: test
|
||||
ownerReferences:
|
||||
- apiVersion: flagger.app/v1beta1
|
||||
blockOwnerDeletion: true
|
||||
controller: true
|
||||
kind: Canary
|
||||
name: backend
|
||||
uid: 58562662-5e10-4512-b269-2b789c1b30fe
|
||||
spec:
|
||||
http:
|
||||
- route:
|
||||
- destination:
|
||||
host: podinfo-primary
|
||||
weight: 100
|
||||
- destination:
|
||||
host: podinfo-canary
|
||||
weight: 0
|
||||
```
|
||||
|
||||
Therefore, The following virtual service forward the traffic to `/podinfo` by the above delegate VirtualService.
|
||||
|
||||
```yaml
|
||||
apiVersion: networking.istio.io/v1alpha3
|
||||
kind: VirtualService
|
||||
metadata:
|
||||
name: frontend
|
||||
namespace: test
|
||||
spec:
|
||||
gateways:
|
||||
- public-gateway.istio-system.svc.cluster.local
|
||||
- mesh
|
||||
hosts:
|
||||
- frontend.example.com
|
||||
- frontend
|
||||
http:
|
||||
- match:
|
||||
- uri:
|
||||
prefix: /podinfo
|
||||
rewrite:
|
||||
uri: /
|
||||
delegate:
|
||||
name: backend
|
||||
namespace: test
|
||||
```
|
||||
|
||||
Note that pilot env `PILOT_ENABLE_VIRTUAL_SERVICE_DELEGATE` must also be set.
|
||||
(For the use of Istio Delegation, you can refer to the documentation of [Virtual Service](https://istio.io/latest/docs/reference/config/networking/virtual-service/#Delegate) and [pilot environment variables](https://istio.io/latest/docs/reference/commands/pilot-discovery/#envvars).)
|
||||
|
||||
### Istio Ingress Gateway
|
||||
|
||||
**How can I expose multiple canaries on the same external domain?**
|
||||
|
||||
@@ -12,6 +12,8 @@ Install Istio with telemetry support and Prometheus:
|
||||
|
||||
```bash
|
||||
istioctl manifest apply --set profile=default
|
||||
# istio 1.7 or newer
|
||||
istioctl install --set profile=default
|
||||
```
|
||||
|
||||
Install Flagger using Kustomize (kubectl >= 1.14) in the `istio-system` namespace:
|
||||
|
||||
@@ -345,7 +345,7 @@ podinfod=stefanprodan/podinfo:3.1.3
|
||||
Generate high response latency:
|
||||
|
||||
```bash
|
||||
watch curl http://app.exmaple.com/delay/2
|
||||
watch curl http://app.example.com/delay/2
|
||||
```
|
||||
|
||||
Watch Flagger logs:
|
||||
|
||||
@@ -351,7 +351,7 @@ podinfod=stefanprodan/podinfo:4.0.6
|
||||
Generate high response latency:
|
||||
|
||||
```bash
|
||||
watch curl http://app.exmaple.com/delay/2
|
||||
watch curl http://app.example.com/delay/2
|
||||
```
|
||||
|
||||
Watch Flagger logs:
|
||||
|
||||
@@ -314,3 +314,56 @@ Reference the template in the canary analysis:
|
||||
```
|
||||
|
||||
**Note** that Flagger need AWS IAM permission to perform `cloudwatch:GetMetricData` to use this provider.
|
||||
|
||||
### New Relic
|
||||
|
||||
You can create custom metric checks using the New Relic provider.
|
||||
|
||||
Create a secret with your New Relic Insights credentials:
|
||||
|
||||
```yaml
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: newrelic
|
||||
namespace: istio-system
|
||||
data:
|
||||
newrelic_account_id: your-account-id
|
||||
newrelic_query_key: your-insights-query-key
|
||||
```
|
||||
|
||||
New Relic template example:
|
||||
|
||||
```yaml
|
||||
apiVersion: flagger.app/v1beta1
|
||||
kind: MetricTemplate
|
||||
metadata:
|
||||
name: newrelic-error-rate
|
||||
namespace: ingress-nginx
|
||||
spec:
|
||||
provider:
|
||||
type: newrelic
|
||||
secretRef:
|
||||
name: newrelic
|
||||
query: |
|
||||
SELECT
|
||||
filter(sum(nginx_ingress_controller_requests), WHERE status >= '500') /
|
||||
sum(nginx_ingress_controller_requests) * 100
|
||||
FROM Metric
|
||||
WHERE metricName = 'nginx_ingress_controller_requests'
|
||||
AND ingress = '{{ ingress }}' AND namespace = '{{ namespace }}'
|
||||
```
|
||||
|
||||
Reference the template in the canary analysis:
|
||||
|
||||
```yaml
|
||||
analysis:
|
||||
metrics:
|
||||
- name: "error rate"
|
||||
templateRef:
|
||||
name: newrelic-error-rate
|
||||
namespace: ingress-nginx
|
||||
thresholdRange:
|
||||
max: 5
|
||||
interval: 1m
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user