mirror of
https://github.com/GoogleContainerTools/kaniko
synced 2026-10-22 09:37:48 +02:00
add option additonal-whitelist
Add a new option additonal-whitelist which defaults to a single entry, "/var/run". This will allow users to remove "/var/run" from the whitelist or retain the current behavior with no change.
This commit is contained in:
@@ -38,9 +38,10 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
opts = &config.KanikoOptions{}
|
||||
logLevel string
|
||||
force bool
|
||||
opts = &config.KanikoOptions{}
|
||||
logLevel string
|
||||
force bool
|
||||
additionalWhitelist []string
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -73,6 +74,16 @@ var RootCmd = &cobra.Command{
|
||||
if len(opts.Destinations) == 0 && opts.ImageNameDigestFile != "" {
|
||||
return errors.New("You must provide --destination if setting ImageNameDigestFile")
|
||||
}
|
||||
|
||||
if additionalWhitelist == nil {
|
||||
additionalWhitelist = []string{
|
||||
"/var/run",
|
||||
}
|
||||
}
|
||||
|
||||
for _, path := range additionalWhitelist {
|
||||
util.AddToWhitelist(path)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
},
|
||||
@@ -144,6 +155,10 @@ func addKanikoOptionsFlags() {
|
||||
RootCmd.PersistentFlags().DurationVarP(&opts.CacheTTL, "cache-ttl", "", time.Hour*336, "Cache timeout in hours. Defaults to two weeks.")
|
||||
RootCmd.PersistentFlags().VarP(&opts.InsecureRegistries, "insecure-registry", "", "Insecure registry using plain HTTP to push and pull. Set it repeatedly for multiple registries.")
|
||||
RootCmd.PersistentFlags().VarP(&opts.SkipTLSVerifyRegistries, "skip-tls-verify-registry", "", "Insecure registry ignoring TLS verify to push and pull. Set it repeatedly for multiple registries.")
|
||||
|
||||
// We use nil as the default value so we can differentiate between the flag passed
|
||||
// with an empty list and the flag not set
|
||||
RootCmd.PersistentFlags().StringSliceVar(&additionalWhitelist, "additional-whitelist", nil, "Paths to whitelist. These will be ignored be kaniko to improve performance.")
|
||||
}
|
||||
|
||||
// addHiddenFlags marks certain flags as hidden from the executor help text
|
||||
|
||||
Reference in New Issue
Block a user