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
The default stays the same. When a CA bundle or a registry url is
specified, require secure connection with certificate verification.
Allow the user to force insecure connection using --force-insecure if he
has to.
Signed-off-by: Michal Minář <[email protected]>
// PruneImagesRecommendedName is the recommended command name
@@ -46,7 +47,18 @@ var (
46
47
--confirm flag is needed for changes to be effective.
47
48
48
49
Only a user with a cluster role %s or higher who is logged-in will be able to actually
49
-
delete the images.`)
50
+
delete the images.
51
+
52
+
If the registry is secured with a certificate signed by a self-signed root certificate
53
+
authority other than the one present in current user's config, you may need to specify it
54
+
using --certificate-authority flag.
55
+
56
+
Insecure connection is allowed in following cases:
57
+
1. --force-insecure is given
58
+
2. user's config allows for insecure connection (the user logged in to the cluster with
59
+
--insecure-skip-tls-verify or allowed for insecure connection)
60
+
3. registry url is not given or it's a private/link-local address AND
61
+
--certificate-authority is not specified`)
50
62
51
63
imagesExample=templates.Examples(`
52
64
# See, what the prune command would delete if only images more than an hour old and obsoleted
@@ -80,11 +92,13 @@ type PruneImagesOptions struct {
80
92
CABundlestring
81
93
RegistryUrlOverridestring
82
94
Namespacestring
95
+
ForceInsecurebool
83
96
84
97
OSClient client.Interface
85
98
KClient kclientset.Interface
86
99
RegistryClient*http.Client
87
100
Out io.Writer
101
+
Insecurebool
88
102
}
89
103
90
104
// NewCmdPruneImages implements the OpenShift cli prune images command.
@@ -117,8 +131,9 @@ func NewCmdPruneImages(f *clientcmd.Factory, parentName, name string, out io.Wri
117
131
cmd.Flags().DurationVar(opts.KeepYoungerThan, "keep-younger-than", *opts.KeepYoungerThan, "Specify the minimum age of an image for it to be considered a candidate for pruning.")
118
132
cmd.Flags().IntVar(opts.KeepTagRevisions, "keep-tag-revisions", *opts.KeepTagRevisions, "Specify the number of image revisions for a tag in an image stream that will be preserved.")
119
133
cmd.Flags().BoolVar(opts.PruneOverSizeLimit, "prune-over-size-limit", *opts.PruneOverSizeLimit, "Specify if images which are exceeding LimitRanges (see 'openshift.io/Image'), specified in the same namespace, should be considered for pruning. This flag cannot be combined with --keep-younger-than nor --keep-tag-revisions.")
120
-
cmd.Flags().StringVar(&opts.CABundle, "certificate-authority", opts.CABundle, "The path to a certificate authority bundle to use when communicating with the managed Docker registries. Defaults to the certificate authority data from the current user's config file.")
134
+
cmd.Flags().StringVar(&opts.CABundle, "certificate-authority", opts.CABundle, "The path to a certificate authority bundle to use when communicating with the managed Docker registries. Defaults to the certificate authority data from the current user's config file. It cannot be used together with --force-insecure.")
121
135
cmd.Flags().StringVar(&opts.RegistryUrlOverride, "registry-url", opts.RegistryUrlOverride, "The address to use when contacting the registry, instead of using the default value. This is useful if you can't resolve or reach the registry (e.g.; the default is a cluster-internal URL) but you do have an alternative route that works.")
136
+
cmd.Flags().BoolVar(&opts.ForceInsecure, "force-insecure", opts.ForceInsecure, "If true, allow an insecure connection to the docker registry that is hosted via HTTP or has an invalid HTTPS certificate. Whenever possible, use --certificate-authority instead of this dangerous option.")
0 commit comments