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
// PruneImagesRecommendedName is the recommended command name
@@ -46,7 +47,17 @@ 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 unless certificate-authority is specified:
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`)
50
61
51
62
imagesExample=templates.Examples(`
52
63
# See, what the prune command would delete if only images more than an hour old and obsoleted
@@ -80,11 +91,13 @@ type PruneImagesOptions struct {
80
91
CABundlestring
81
92
RegistryUrlOverridestring
82
93
Namespacestring
94
+
ForceInsecurebool
83
95
84
96
OSClient client.Interface
85
97
KClient kclientset.Interface
86
98
RegistryClient*http.Client
87
99
Out io.Writer
100
+
Insecurebool
88
101
}
89
102
90
103
// NewCmdPruneImages implements the OpenShift cli prune images command.
@@ -117,8 +130,9 @@ func NewCmdPruneImages(f *clientcmd.Factory, parentName, name string, out io.Wri
117
130
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
131
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
132
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.")
133
+
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
134
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.")
135
+
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