0

我正在尝试在 kubernetes 环境中使用 flagger 和 nginx 进行金丝雀部署,但即使我使用不存在的 metricTemplate 名称,flagger 也会继续推进我的部署,因为一切都很好。这是我的金丝雀资源

apiVersion: flagger.app/v1beta1
kind: Canary
metadata:
  name: {{ .Chart.Name }}
spec:
  provider: nginx
  targetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: {{ .Chart.Name }}
  ingressRef:
    apiVersion: networking.k8s.io/v1beta1
    kind: Ingress
    name: {{ .Chart.Name }}
  autoscalerRef:
    apiVersion: autoscaling/v2beta2
    kind: HorizontalPodAutoscaler
    name: {{ .Chart.Name }}
  progressDeadlineSeconds: 60
  service:
    port: {{ .Values.service.port }}
    targetPort: {{ .Values.service.port }}
  analysis:
    interval: 10s
    threshold: 10
    maxWeight: 50
    stepWeight: 5
    metrics:
    - name: nonexistent_metric
      interval: 1m
      thresholdRange:
        min: 99
    webhooks:
    - name: acceptance-test
      type: pre-rollout
      url: http://flagger-loadtester.flagger/
      timeout: 30s
      metadata:
        type: bash
        cmd: "curl -X GET http://myappService.myappNamespace:5555/api/v1/teste -H  'accept: application/json'"
    - name: load-test
      url: http://flagger-loadtester.flagger/
      timeout: 5s
      metadata:
        cmd: "hey -z 1m -q 10 -c 2 -H 'accept: application/json' http://myappService.myappNamespace:5555/api/v1/teste" 

这是一个 kubectl 获取 MetricTemplate --all-namespaces 输出

$ kubectl get MetricTemplate --all-namespaces
NAMESPACE   NAME           PROVIDER
flagger     error-rate     prometheus
flagger     success-rate   prometheus

这是一个 kubectl get canary -n myappNamespace -w

$ kubectl get canary -n myappNamespace -w
myappNamespace  Progressing   0        2021-04-26T18:20:15Z
myappNamespace   Progressing   0        2021-04-26T18:20:25Z
myappNamespace   Progressing   0        2021-04-26T18:21:05Z
myappNamespace   Progressing   5        2021-04-26T18:21:20Z
myappNamespace   Progressing   10       2021-04-26T18:21:20Z
myappNamespace   Progressing   15       2021-04-26T18:21:25Z
myappNamespace   Progressing   20       2021-04-26T18:21:35Z
myappNamespace   Progressing   25       2021-04-26T18:21:45Z
myappNamespace   Progressing   30       2021-04-26T18:21:55Z
myappNamespace   Progressing   35       2021-04-26T18:22:05Z
myappNamespace   Progressing   40       2021-04-26T18:22:15Z
myappNamespace   Progressing   45       2021-04-26T18:22:25Z
myappNamespace   Progressing   50       2021-04-26T18:22:35Z
myappNamespace   Promoting     0        2021-04-26T18:22:45Z
myappNamespace   Finalising    0        2021-04-26T18:22:55Z
myappNamespace   Succeeded     0        2021-04-26T18:23:05Z

我正在使用 ghcr.io/fluxcd/flagger:1.7.0 图像

也许我做错了什么。

4

0 回答 0