mirror of
https://github.com/portainer/portainer.git
synced 2025-07-19 13:29:41 +02:00
feat(docker): add --pull-limit-check-disabled cli flag [BE-11739] (#581)
This commit is contained in:
parent
4c1e80ff58
commit
a5d857d5e7
8 changed files with 63 additions and 46 deletions
|
@ -60,6 +60,7 @@ func CLIFlags() *portainer.CLIFlags {
|
||||||
LogLevel: kingpin.Flag("log-level", "Set the minimum logging level to show").Default("INFO").Enum("DEBUG", "INFO", "WARN", "ERROR"),
|
LogLevel: kingpin.Flag("log-level", "Set the minimum logging level to show").Default("INFO").Enum("DEBUG", "INFO", "WARN", "ERROR"),
|
||||||
LogMode: kingpin.Flag("log-mode", "Set the logging output mode").Default("PRETTY").Enum("NOCOLOR", "PRETTY", "JSON"),
|
LogMode: kingpin.Flag("log-mode", "Set the logging output mode").Default("PRETTY").Enum("NOCOLOR", "PRETTY", "JSON"),
|
||||||
KubectlShellImage: kingpin.Flag("kubectl-shell-image", "Kubectl shell image").Envar(portainer.KubectlShellImageEnvVar).Default(portainer.DefaultKubectlShellImage).String(),
|
KubectlShellImage: kingpin.Flag("kubectl-shell-image", "Kubectl shell image").Envar(portainer.KubectlShellImageEnvVar).Default(portainer.DefaultKubectlShellImage).String(),
|
||||||
|
PullLimitCheckDisabled: kingpin.Flag("pull-limit-check-disabled", "Pull limit check").Envar(portainer.PullLimitCheckDisabledEnvVar).Default(defaultPullLimitCheckDisabled).Bool(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,4 +20,5 @@ const (
|
||||||
defaultSSL = "false"
|
defaultSSL = "false"
|
||||||
defaultBaseURL = "/"
|
defaultBaseURL = "/"
|
||||||
defaultSecretKeyName = "portainer"
|
defaultSecretKeyName = "portainer"
|
||||||
|
defaultPullLimitCheckDisabled = "false"
|
||||||
)
|
)
|
||||||
|
|
|
@ -18,4 +18,5 @@ const (
|
||||||
defaultSnapshotInterval = "5m"
|
defaultSnapshotInterval = "5m"
|
||||||
defaultBaseURL = "/"
|
defaultBaseURL = "/"
|
||||||
defaultSecretKeyName = "portainer"
|
defaultSecretKeyName = "portainer"
|
||||||
|
defaultPullLimitCheckDisabled = "false"
|
||||||
)
|
)
|
||||||
|
|
|
@ -576,6 +576,7 @@ func buildServer(flags *portainer.CLIFlags) portainer.Server {
|
||||||
AdminCreationDone: adminCreationDone,
|
AdminCreationDone: adminCreationDone,
|
||||||
PendingActionsService: pendingActionsService,
|
PendingActionsService: pendingActionsService,
|
||||||
PlatformService: platformService,
|
PlatformService: platformService,
|
||||||
|
PullLimitCheckDisabled: *flags.PullLimitCheckDisabled,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,6 +80,13 @@ func (handler *Handler) endpointDockerhubStatus(w http.ResponseWriter, r *http.R
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if handler.PullLimitCheckDisabled {
|
||||||
|
return response.JSON(w, &dockerhubStatusResponse{
|
||||||
|
Limit: 10,
|
||||||
|
Remaining: 10,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
httpClient := client.NewHTTPClient()
|
httpClient := client.NewHTTPClient()
|
||||||
token, err := getDockerHubToken(httpClient, registry)
|
token, err := getDockerHubToken(httpClient, registry)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -39,6 +39,7 @@ type Handler struct {
|
||||||
BindAddress string
|
BindAddress string
|
||||||
BindAddressHTTPS string
|
BindAddressHTTPS string
|
||||||
PendingActionsService *pendingactions.PendingActionsService
|
PendingActionsService *pendingactions.PendingActionsService
|
||||||
|
PullLimitCheckDisabled bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewHandler creates a handler to manage environment(endpoint) operations.
|
// NewHandler creates a handler to manage environment(endpoint) operations.
|
||||||
|
|
|
@ -112,6 +112,7 @@ type Server struct {
|
||||||
AdminCreationDone chan struct{}
|
AdminCreationDone chan struct{}
|
||||||
PendingActionsService *pendingactions.PendingActionsService
|
PendingActionsService *pendingactions.PendingActionsService
|
||||||
PlatformService platform.Service
|
PlatformService platform.Service
|
||||||
|
PullLimitCheckDisabled bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start starts the HTTP server
|
// Start starts the HTTP server
|
||||||
|
@ -181,6 +182,7 @@ func (server *Server) Start() error {
|
||||||
endpointHandler.BindAddress = server.BindAddress
|
endpointHandler.BindAddress = server.BindAddress
|
||||||
endpointHandler.BindAddressHTTPS = server.BindAddressHTTPS
|
endpointHandler.BindAddressHTTPS = server.BindAddressHTTPS
|
||||||
endpointHandler.PendingActionsService = server.PendingActionsService
|
endpointHandler.PendingActionsService = server.PendingActionsService
|
||||||
|
endpointHandler.PullLimitCheckDisabled = server.PullLimitCheckDisabled
|
||||||
|
|
||||||
var endpointEdgeHandler = endpointedge.NewHandler(requestBouncer, server.DataStore, server.FileService, server.ReverseTunnelService)
|
var endpointEdgeHandler = endpointedge.NewHandler(requestBouncer, server.DataStore, server.FileService, server.ReverseTunnelService)
|
||||||
|
|
||||||
|
|
|
@ -134,6 +134,7 @@ type (
|
||||||
LogLevel *string
|
LogLevel *string
|
||||||
LogMode *string
|
LogMode *string
|
||||||
KubectlShellImage *string
|
KubectlShellImage *string
|
||||||
|
PullLimitCheckDisabled *bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// CustomTemplateVariableDefinition
|
// CustomTemplateVariableDefinition
|
||||||
|
@ -1689,6 +1690,8 @@ const (
|
||||||
PortainerCacheHeader = "X-Portainer-Cache"
|
PortainerCacheHeader = "X-Portainer-Cache"
|
||||||
// KubectlShellImageEnvVar is the environment variable used to override the default kubectl shell image
|
// KubectlShellImageEnvVar is the environment variable used to override the default kubectl shell image
|
||||||
KubectlShellImageEnvVar = "KUBECTL_SHELL_IMAGE"
|
KubectlShellImageEnvVar = "KUBECTL_SHELL_IMAGE"
|
||||||
|
// PullLimitCheckDisabledEnvVar is the environment variable used to disable the pull limit check
|
||||||
|
PullLimitCheckDisabledEnvVar = "PULL_LIMIT_CHECK_DISABLED"
|
||||||
)
|
)
|
||||||
|
|
||||||
// List of supported features
|
// List of supported features
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue