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]>
Copy file name to clipboardExpand all lines: pkg/cmd/admin/prune/images.go
+38-12
Original file line number
Diff line number
Diff line change
@@ -46,7 +46,11 @@ var (
46
46
--confirm flag is needed for changes to be effective.
47
47
48
48
Only a user with a cluster role %s or higher who is logged-in will be able to actually
49
-
delete the images.`)
49
+
delete the images.
50
+
51
+
If the registry is secured with a certificate signed by a self-signed root certificate
52
+
authority other than the one used for the cluster and present in current user's config, you
53
+
may need to specify it using --certificate-authority flag.`)
50
54
51
55
imagesExample=templates.Examples(`
52
56
# See, what the prune command would delete if only images more than an hour old and obsoleted
@@ -80,6 +84,7 @@ type PruneImagesOptions struct {
80
84
CABundlestring
81
85
RegistryUrlOverridestring
82
86
Namespacestring
87
+
ForceInsecurebool
83
88
84
89
OSClient client.Interface
85
90
KClient kclientset.Interface
@@ -117,8 +122,9 @@ func NewCmdPruneImages(f *clientcmd.Factory, parentName, name string, out io.Wri
117
122
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
123
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
124
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.")
125
+
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
126
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.")
127
+
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. By default, insecure connection is allowed only in case where neither certificate-authority nor registry-url is specified. Whenever possible, use --certificate-authority instead of this dangerous option.")
0 commit comments