You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, Problem
Going through the pain of Clair v2->v4 upgrade.
Combo mode, single node, k8s deployment+service
I saw that I have to define http_listen_addr, A string in <host>:<port> in config.
And then I saw IndexerAddr and MatcherAddr both commented as A string in <host>:<port> format.
So I was quite happy about that, as I run Clair on single node, so I used YAML anchor functionality to have Clair address (and pgconn str) be defined once in the beginning of my config:
As Clair address is also appearing in matcher.indexer_addr, notifier.indexer_addr and notifier.matcher_addr, I was glad I don't need to duplicate it 4 times, because DRY!
But looks like docs are lying, as container started and I got service initialization failed: failed to initialize notifier: parse \"0.0.0.0:6060\": first path segment in URL cannot contain colon error.
Turned out, Notifier config validation uses url.Parse() which is sensitive about missing schema, and docs said <host>:<port> should be sufficient.
So I changed my listener address to be http://0.0.0.0:6060, and then I got container failing immediately with error failed to validate config: address http://0.0.0.0:6060: too many colons in address, because (here docs don't lie) main Clair config validation uses net.SplitHostPort() which explicitly wants <host>:<port>.
As YAML anchors do not allow string concatenation, I have to put same 0.0.0.0:6060 twice, with and without http:// prefix.
Idea:
to keep Clair config more DRY, use aligned approach for defining and parsing http_listen_addr and indexer_addr, matcher_addr
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
Problem
Going through the pain of Clair v2->v4 upgrade.
Combo mode, single node, k8s deployment+service
I saw that I have to define
http_listen_addr
,A string in <host>:<port>
in config.And then I saw
IndexerAddr
andMatcherAddr
both commented asA string in <host>:<port> format
.So I was quite happy about that, as I run Clair on single node, so I used YAML anchor functionality to have Clair address (and pgconn str) be defined once in the beginning of my config:
As Clair address is also appearing in
matcher.indexer_addr
,notifier.indexer_addr
andnotifier.matcher_addr
, I was glad I don't need to duplicate it 4 times, because DRY!But looks like docs are lying, as container started and I got
service initialization failed: failed to initialize notifier: parse \"0.0.0.0:6060\": first path segment in URL cannot contain colon
error.Turned out, Notifier config validation uses
url.Parse()
which is sensitive about missing schema, and docs said<host>:<port>
should be sufficient.So I changed my listener address to be
http://0.0.0.0:6060
, and then I got container failing immediately with errorfailed to validate config: address http://0.0.0.0:6060: too many colons in address
, because (here docs don't lie) main Clair config validation usesnet.SplitHostPort()
which explicitly wants<host>:<port>
.As YAML anchors do not allow string concatenation, I have to put same
0.0.0.0:6060
twice, with and withouthttp://
prefix.Idea:
http_listen_addr
andindexer_addr
,matcher_addr
TrimPrefix
-like functionalityBeta Was this translation helpful? Give feedback.
All reactions