Skip to content

Commit

Permalink
Docs: Add Gateway Plugin Support
Browse files Browse the repository at this point in the history
Signed-off-by: Gidi233 <[email protected]>
  • Loading branch information
Gidi233 committed Sep 13, 2024
1 parent bfd6a70 commit 35324d3
Show file tree
Hide file tree
Showing 4 changed files with 492 additions and 7 deletions.
117 changes: 115 additions & 2 deletions docs/content/en/docs/fleet-manager/rollout/abtest.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ istio-system istio-ingressgateway-65b5c9f9bb-8w5ml 1/1
istio-system istiod-657f7686cf-hshwp 1/1 Running 0 2m5s
```

### Prometheus
#### Prometheus

Kurator needs to use Prometheus to collect metrics on monitored resources in the cluster, which will be used as the basis for determining whether to continue rolling out.

Expand All @@ -75,7 +75,7 @@ istio-system prometheus-5d5d6d6fc-5hxbh 2/2

Notes: It is recommended to change the release in the above commands to match the version of Istio that was already installed.

### Ingress Gateway
#### Ingress Gateway

To allow external programs access to the services you've deployed, you will need to create an IngressGateway resource.

Expand Down Expand Up @@ -109,6 +109,21 @@ kubectl get gateway -n istio-system --kubeconfig=/root/.kube/kurator-member1.con
istio-system public-gateway 17s
```

### Nginx

When Nginx is specified in fleet's `rollout.trafficRoutingProvider` , Kurator will install Nginx and its supporting Prometheus via helm in the fleet-managed clusters.

You can review the results a few minutes after applying fleet:
```console
kubectl get po -n ingress-nginx --kubeconfig=/root/.kube/kurator-member1.config
NAME READY STATUS RESTARTS AGE
ingress-nginx-flagger-kurator-member-7fbdfb7f7-hphc2 1/1 Running 0 5m44s
ingress-nginx-flagger-kurator-member-prometheus-56bdbf4855l4jkx 1/1 Running 0 5m44s
ingress-nginx-nginx-kurator-member-controller-6566b7886-b7g8f 1/1 Running 0 5m33s
ingress-nginx-testloader-kurator-member-loadtester-7ff7d75l2dwj 1/1 Running 0 5m51s

```

### Kurator Rollout Plugin

Before delving into the how to Perform a Unified Rollout, ensure you have successfully installed the Rollout plugin as outlined in the [Rollout plugin installation guide](/docs/fleet-manager/rollout/rollout-plugin/).
Expand Down Expand Up @@ -331,6 +346,104 @@ If the status shows as `Initialized`, it means the initialization of rollout pro

**Notes**: In the above configuration, we set the `kustomization.interval` to 0s. This disables Fluxcd's periodic synchronization of configurations between the local mirror and cluster. The reason is that Flagger needs to modify the replica counts in Deployments to complete its initialization process. If you are uncertain whether the replicas for all applications in your deployments are set to zero, it is recommended to also set `kustomization.interval` to 0s.

### Using Nginx
You can deploy a abtest application demo using Nginx by the following command:

```console
kubectl apply -f examples/rollout/ab-testingNginx.yaml
```

Here is the configuration:
```yaml
apiVersion: apps.kurator.dev/v1alpha1
kind: Application
metadata:
name: abtesting-nginx-demo
namespace: default
spec:
source:
gitRepository:
interval: 3m0s
ref:
branch: master
timeout: 1m0s
url: https://github.com/stefanprodan/podinfo
syncPolicies:
- destination:
fleet: quickstart
kustomization:
interval: 0s
path: ./deploy/webapp
prune: true
timeout: 2m0s
rollout:
testLoader: true
trafficRoutingProvider: nginx
workload:
apiVersion: apps/v1
name: backend
kind: Deployment
namespace: webapp
serviceName: backend
port: 9898
rolloutPolicy:
trafficRouting:
analysisTimes: 3
timeoutSeconds: 60
host: "app.example.com"
match:
- headers:
x-canary:
exact: "insider"
- headers:
cookie:
exact: "canary"
trafficAnalysis:
checkIntervalSeconds: 90
checkFailedTimes: 2
metrics:
- name: nginx-request-success-rate
intervalSeconds: 90
thresholdRange:
min: 99
customMetric:
provider:
type: prometheus
address: http://ingress-nginx-flagger-kurator-member-prometheus.ingress-nginx:9090
query: |
sum(
rate(
http_requests_total{
status!~"5.*"
}[{{ interval }}]
)
)
/
sum(
rate(
http_requests_total[{{ interval }}]
)
) * 100
webhooks:
timeoutSeconds: 60
command:
- "hey -z 1m -q 10 -c 2 http://app.example.com/"
rolloutTimeoutSeconds: 600
- destination:
fleet: quickstart
kustomization:
targetNamespace: default
interval: 5m0s
path: ./kustomize
prune: true
timeout: 2m0s
```
To use Nginx, you need to provide the `host` it uses. Kurator will generate an ingress resource based on this field. Here is the [specific configuration generated](/docs/references/app-api/#apps.kurator.dev/v1alpha1.TrafficRoutingConfig).
. Other configurations are the same as above.

**Notes:**There is a problem with the metric provided by the current flagger, so `customMetric` is used.Here is the detailed [API](/docs/references/app-api/#apps.kurator.dev/v1alpha1.Metric).

### Trigger Rollout

An A/B Testing can be triggered by either updating the container image referenced in the git repository configuration, or directly updating the image of the deployment resource locally in the Kubernetes cluster.
Expand Down
111 changes: 109 additions & 2 deletions docs/content/en/docs/fleet-manager/rollout/blue-green.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ istio-system istio-ingressgateway-65b5c9f9bb-8w5ml 1/1
istio-system istiod-657f7686cf-hshwp 1/1 Running 0 2m5s
```

### Prometheus
#### Prometheus

Kurator needs to use Prometheus to collect metrics on monitored resources in the cluster, which will be used as the basis for determining whether to continue rolling out.

Expand All @@ -75,7 +75,7 @@ istio-system prometheus-5d5d6d6fc-5hxbh 2/2

Notes: It is recommended to change the release in the above commands to match the version of Istio that was already installed.

### Ingress Gateway
#### Ingress Gateway

To allow external programs access to the services you've deployed, you will need to create an IngressGateway resource.

Expand Down Expand Up @@ -109,6 +109,21 @@ kubectl get gateway -n istio-system --kubeconfig=/root/.kube/kurator-member1.con
istio-system public-gateway 17s
```

### Nginx

When Nginx is specified in fleet's `rollout.trafficRoutingProvider` , Kurator will install Nginx and its supporting Prometheus via helm in the fleet-managed clusters.

You can review the results a few minutes after applying fleet:
```console
kubectl get po -n ingress-nginx --kubeconfig=/root/.kube/kurator-member1.config
NAME READY STATUS RESTARTS AGE
ingress-nginx-flagger-kurator-member-7fbdfb7f7-hphc2 1/1 Running 0 5m44s
ingress-nginx-flagger-kurator-member-prometheus-56bdbf4855l4jkx 1/1 Running 0 5m44s
ingress-nginx-nginx-kurator-member-controller-6566b7886-b7g8f 1/1 Running 0 5m33s
ingress-nginx-testloader-kurator-member-loadtester-7ff7d75l2dwj 1/1 Running 0 5m51s

```

### Kurator Rollout Plugin

Before delving into the how to Perform a Unified Rollout, ensure you have successfully installed the Rollout plugin as outlined in the [Rollout plugin installation guide](/docs/fleet-manager/rollout/rollout-plugin/).
Expand Down Expand Up @@ -323,6 +338,98 @@ If the status shows as `Initialized`, it means the initialization of rollout pro

**Notes**: In the above configuration, we set the `kustomization.interval` to 0s. This disables Fluxcd's periodic synchronization of configurations between the local mirror and cluster. The reason is that Flagger needs to modify the replica counts in Deployments to complete its initialization process. If you are uncertain whether the replicas for all applications in your deployments are set to zero, it is recommended to also set `kustomization.interval` to 0s.

### Using Nginx
You can deploy a blue-green application demo using Nginx by the following command:

```console
kubectl apply -f examples/rollout/blue_greenNginx.yaml
```

Here is the configuration:
```yaml
apiVersion: apps.kurator.dev/v1alpha1
kind: Application
metadata:
name: blue-green-nginx-demo
namespace: default
spec:
source:
gitRepository:
interval: 3m0s
ref:
branch: master
timeout: 1m0s
url: https://github.com/stefanprodan/podinfo
syncPolicies:
- destination:
fleet: quickstart
kustomization:
interval: 0s
path: ./deploy/webapp
prune: true
timeout: 2m0s
rollout:
testLoader: true
trafficRoutingProvider: nginx
workload:
apiVersion: apps/v1
name: backend
kind: Deployment
namespace: webapp
serviceName: backend
port: 9898
rolloutPolicy:
trafficRouting:
analysisTimes: 3
timeoutSeconds: 60
host: "app.example.com"
trafficAnalysis:
checkIntervalSeconds: 90
checkFailedTimes: 2
metrics:
- name: nginx-request-success-rate
intervalSeconds: 90
thresholdRange:
min: 99
customMetric:
provider:
type: prometheus
address: http://ingress-nginx-flagger-kurator-member-prometheus.ingress-nginx:9090
query: |
sum(
rate(
http_requests_total{
status!~"5.*"
}[{{ interval }}]
)
)
/
sum(
rate(
http_requests_total[{{ interval }}]
)
) * 100
webhooks:
timeoutSeconds: 60
command:
- "hey -z 1m -q 10 -c 2 http://app.example.com/"
rolloutTimeoutSeconds: 600
- destination:
fleet: quickstart
kustomization:
targetNamespace: default
interval: 5m0s
path: ./kustomize
prune: true
timeout: 2m0s
```
To use Nginx, you need to provide the `host` it uses. Kurator will generate an ingress resource based on this field. Here is the [specific configuration generated](/docs/references/app-api/#apps.kurator.dev/v1alpha1.TrafficRoutingConfig).
. Other configurations are the same as above.

**Notes:**There is a problem with the metric provided by the current flagger, so `customMetric` is used.Here is the detailed [API](/docs/references/app-api/#apps.kurator.dev/v1alpha1.Metric).


### Trigger Rollout

#### Automated Rollout
Expand Down
Loading

0 comments on commit 35324d3

Please sign in to comment.