File tree 3 files changed +7
-0
lines changed
3 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -204,6 +204,7 @@ spec:
204
204
* Default: `5m`
205
205
* `--ignored-images` — comma-separated list of images to ignore while checking absent images.
206
206
* `--skip-registry-cert-verification` — whether to skip registries' certificate verification.
207
+ * `--namespace` — inspect specific namespace instead of whole k8s cluster.
207
208
208
209
# # Metrics
209
210
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ func main() {
31
31
ignoredImagesStr := flag .String ("ignored-images" , "" , "comma-separated image names to ignore" )
32
32
bindAddr := flag .String ("bind-address" , ":8080" , "address:port to bind /metrics endpoint to" )
33
33
insecureSkipVerify := flag .Bool ("skip-registry-cert-verification" , false , "whether to skip registries' certificate verification" )
34
+ specificNamespace := flag .String ("namespace" , "" , "inspect specific namespace instead of whole k8s cluster" )
34
35
flag .Parse ()
35
36
36
37
logrus .SetFormatter (& logrus.TextFormatter {
@@ -64,6 +65,7 @@ func main() {
64
65
kubeClient ,
65
66
* insecureSkipVerify ,
66
67
strings .Split (* ignoredImagesStr , "," ),
68
+ * specificNamespace ,
67
69
)
68
70
prometheus .MustRegister (registryChecker )
69
71
Original file line number Diff line number Diff line change @@ -53,8 +53,12 @@ func NewRegistryChecker(
53
53
kubeClient * kubernetes.Clientset ,
54
54
skipVerify bool ,
55
55
ignoredImages []string ,
56
+ specificNamespace string ,
56
57
) * RegistryChecker {
57
58
informerFactory := informers .NewSharedInformerFactory (kubeClient , time .Hour )
59
+ if specificNamespace != "" {
60
+ informerFactory = informers .NewSharedInformerFactoryWithOptions (kubeClient , time .Hour , informers .WithNamespace (specificNamespace ))
61
+ }
58
62
59
63
customTransport := http .DefaultTransport .(* http.Transport ).Clone ()
60
64
if skipVerify {
You can’t perform that action at this time.
0 commit comments