Skip to content

Graceful shutdown timeout #4571

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

Merged
Merged
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
5 changes: 5 additions & 0 deletions changelog/fragments/ansible-graceful-shutdown-timeout.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
entries:
- description: >
For Ansible-based operators, allow passing a --graceful-shutdown-timeout to configure the duration the manager should wait before stopping.
kind: "addition"
breaking: false
7 changes: 7 additions & 0 deletions internal/ansible/flags/flag.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type Flags struct {
ProbeAddr string
LeaderElectionID string
LeaderElectionNamespace string
GracefulShutdownTimeout time.Duration
AnsibleArgs string
}

Expand Down Expand Up @@ -109,6 +110,12 @@ func (f *Flags) AddTo(flagSet *pflag.FlagSet) {
" holding the leader lock (required if running locally with leader"+
" election enabled).",
)
flagSet.DurationVar(&f.GracefulShutdownTimeout,
"graceful-shutdown-timeout",
30*time.Second,
"The amount of time that will be spent waiting"+
" for runners to gracefully exit.",
)
flagSet.StringVar(&f.AnsibleArgs,
"ansible-args",
"",
Expand Down
1 change: 1 addition & 0 deletions internal/cmd/ansible-operator/run/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ func run(cmd *cobra.Command, f *flags.Flags) {
LeaderElectionResourceLock: resourcelock.ConfigMapsResourceLock,
LeaderElectionNamespace: f.LeaderElectionNamespace,
ClientBuilder: clientbuilder.NewUnstructedCached(),
GracefulShutdownTimeout: &f.GracefulShutdownTimeout,
}

namespace, found := os.LookupEnv(k8sutil.WatchNamespaceEnvVar)
Expand Down