gpt4 book ai didi

docker - 配置 docker 注册表通知

转载 作者:行者123 更新时间:2023-12-02 21:09:12 24 4
gpt4 key购买 nike

我使用 official helm chart 设置了一个 docker 注册表在我的 k8s 集群上。
我尝试按照 the docs 为我的注册表配置通知, 如下:

apiVersion: v1
data:
config.yml: |-
health:
storagedriver:
enabled: true
interval: 10s
threshold: 3
http:
addr: :5000
headers:
X-Content-Type-Options:
- nosniff
notifications:
endpoints:
- name: keel
url: http://keel.example.com/v1/webhooks/registry
headers:
Content-Type: application/json
timeout: 500ms
threshold: 5
backoff: 1s
log:
fields:
service: registry
storage:
cache:
blobdescriptor: inmemory
version: 0.1
kind: ConfigMap

将配置更改为包含通知后,注册表无法启动,因为它无法识别配置。我收到此错误:
configuration error: error parsing /etc/docker/registry/config.yml: yaml: unmarshal errors:
line 16: cannot unmarshal !!str `applica...` into []string

Usage:
registry serve <config> [flags]
Flags:
-h, --help=false: help for serve


Additional help topics:

最佳答案

您错过了 yaml 字符 [在他们的文档中(我承认这是一个糟糕的例子,因为 [ 经常在文档中用作“占位符在此处”),因为在 yaml 中,它是将项目转换为列表的字符 - 就像在JSON,YAML 从中汲取灵感

但是,除此之外,cannot unmarshal str into []string应该是一个死的赠品,他们期待标题的字符串数组:

headers:
Content-Type:
- application/json

或者,使用他们的 的语法可怕例子:
headers:
Content-Type: [application/json]

跟进, endpoints: reference docs还指出:

A list of static headers to add to each request. Each header's name is a key beneath headers, and each value is a list of payloads for that header name. Values must always be lists.



(重点是我的)

关于docker - 配置 docker 注册表通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55996502/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com