Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(options): ability to configure the initial edge poll frequency #653

Open
wants to merge 1 commit into
base: release/2.21
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ type (
EdgeID string
EdgeUIServerAddr string
EdgeUIServerPort string
EdgePollFrequency string
EdgeInactivityTimeout string
EdgeInsecurePoll bool
EdgeTunnel bool
Expand Down
2 changes: 1 addition & 1 deletion edge/edge.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (manager *Manager) Start() error {
pollServiceConfig := &pollServiceConfig{
APIServerAddr: apiServerAddr,
EdgeID: manager.agentOptions.EdgeID,
PollFrequency: agent.DefaultEdgePollInterval,
PollFrequency: manager.agentOptions.EdgePollFrequency,
InactivityTimeout: manager.agentOptions.EdgeInactivityTimeout,
TunnelCapability: manager.agentOptions.EdgeTunnel,
PortainerURL: manager.key.PortainerInstanceURL,
Expand Down
3 changes: 3 additions & 0 deletions os/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const (
EnvKeyEdgeID = "EDGE_ID"
EnvKeyEdgeServerHost = "EDGE_SERVER_HOST"
EnvKeyEdgeServerPort = "EDGE_SERVER_PORT"
EnvKeyEdgePollFrequency = "EDGE_POLL_FREQUENCY"
EnvKeyEdgeInactivityTimeout = "EDGE_INACTIVITY_TIMEOUT"
EnvKeyEdgeInsecurePoll = "EDGE_INSECURE_POLL"
EnvKeyEdgeTunnel = "EDGE_TUNNEL"
Expand Down Expand Up @@ -79,6 +80,7 @@ var (
fEdgeID = kingpin.Flag("edge-id", EnvKeyEdgeID+" a unique identifier associated to this agent cluster").Envar(EnvKeyEdgeID).String()
fEdgeServerAddr = kingpin.Flag("edge-host", EnvKeyEdgeServerHost+" address on which the Edge UI will be exposed (default to 0.0.0.0)").Envar(EnvKeyEdgeServerHost).Default(agent.DefaultEdgeServerAddr).IP()
fEdgeServerPort = kingpin.Flag("edge-port", EnvKeyEdgeServerPort+" port on which the Edge UI will be exposed (default to 80)").Envar(EnvKeyEdgeServerPort).Default(agent.DefaultEdgeServerPort).Int()
fEdgePollFrequency = kingpin.Flag("edge-poll-frequency", EnvKeyEdgePollFrequency+" frequency at which the agent will poll the server before receiving its configuration remotely (default to 5s)").Envar(EnvKeyEdgePollFrequency).Default(agent.DefaultEdgePollInterval).String()
fEdgeInactivityTimeout = kingpin.Flag("edge-inactivity", EnvKeyEdgeInactivityTimeout+" timeout used by the agent to close the reverse tunnel after inactivity (default to 5m)").Envar(EnvKeyEdgeInactivityTimeout).Default(agent.DefaultEdgeSleepInterval).String()
fEdgeInsecurePoll = kingpin.Flag("edge-insecurepoll", EnvKeyEdgeInsecurePoll+" enable this option if you need the agent to poll a HTTPS Portainer instance with self-signed certificates. Disabled by default, set to 1 to enable it").Envar(EnvKeyEdgeInsecurePoll).Bool()
fEdgeTunnel = kingpin.Flag("edge-tunnel", EnvKeyEdgeTunnel+" disable this option if you wish to prevent the agent from opening tunnels over websockets").Envar(EnvKeyEdgeTunnel).Default("true").Bool()
Expand Down Expand Up @@ -143,6 +145,7 @@ func (parser *EnvOptionParser) Options() (*agent.Options, error) {
EdgeID: *fEdgeID,
EdgeUIServerAddr: fEdgeServerAddr.String(),
EdgeUIServerPort: strconv.Itoa(*fEdgeServerPort),
EdgePollFrequency: *fEdgePollFrequency,
EdgeInactivityTimeout: *fEdgeInactivityTimeout,
EdgeInsecurePoll: *fEdgeInsecurePoll,
EdgeTunnel: *fEdgeTunnel,
Expand Down
Loading