Skip to content

Commit

Permalink
Hardcode RecoverPanic to true for extensions controller
Browse files Browse the repository at this point in the history
  • Loading branch information
shafeeqes committed Jan 30, 2023
1 parent 880e208 commit 690d8a8
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 11 deletions.
2 changes: 0 additions & 2 deletions cmd/gardener-extension-provider-local/app/app.go
Expand Up @@ -34,7 +34,6 @@ import (
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
vpaautoscalingv1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1"
"k8s.io/client-go/tools/leaderelection/resourcelock"
"k8s.io/utils/pointer"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/manager"
Expand Down Expand Up @@ -92,7 +91,6 @@ func NewControllerManagerCommand(ctx context.Context) *cobra.Command {
WebhookCertDir: "/tmp/gardener-extensions-cert",
MetricsBindAddress: ":8080",
HealthBindAddress: ":8081",
RecoverPanic: pointer.Bool(true),
}
generalOpts = &extensionscmdcontroller.GeneralOptions{}

Expand Down
8 changes: 2 additions & 6 deletions extensions/pkg/controller/cmd/options.go
Expand Up @@ -24,6 +24,7 @@ import (
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
"k8s.io/client-go/tools/leaderelection/resourcelock"
"k8s.io/utils/pointer"
controllerconfigv1alpha1 "sigs.k8s.io/controller-runtime/pkg/config/v1alpha1"
"sigs.k8s.io/controller-runtime/pkg/controller"
"sigs.k8s.io/controller-runtime/pkg/manager"
Expand Down Expand Up @@ -197,8 +198,6 @@ type ManagerOptions struct {
MetricsBindAddress string
// HealthBindAddress is the TCP address that the controller should bind to for serving health probes.
HealthBindAddress string
// RecoverPanic indicates if panics should be recovered.
RecoverPanic *bool
// LogLevel defines the level/severity for the logs. Must be one of [info,debug,error]
LogLevel string
// LogFormat defines the format for the logs. Must be one of [json,text]
Expand Down Expand Up @@ -254,7 +253,6 @@ func (m *ManagerOptions) Complete() error {
m.WebhookCertDir,
m.MetricsBindAddress,
m.HealthBindAddress,
m.RecoverPanic,
logger}
return nil
}
Expand Down Expand Up @@ -284,8 +282,6 @@ type ManagerConfig struct {
MetricsBindAddress string
// HealthBindAddress is the TCP address that the controller should bind to for serving health probes.
HealthBindAddress string
// RecoverPanic indicates if panics should be recovered.
RecoverPanic *bool
// Logger is a logr.Logger compliant logger
Logger logr.Logger
}
Expand All @@ -302,7 +298,7 @@ func (c *ManagerConfig) Apply(opts *manager.Options) {
opts.MetricsBindAddress = c.MetricsBindAddress
opts.HealthProbeBindAddress = c.HealthBindAddress
opts.Logger = c.Logger
opts.Controller = controllerconfigv1alpha1.ControllerConfigurationSpec{RecoverPanic: c.RecoverPanic}
opts.Controller = controllerconfigv1alpha1.ControllerConfigurationSpec{RecoverPanic: pointer.Bool(true)}
}

// Options initializes empty manager.Options, applies the set values and returns it.
Expand Down
1 change: 0 additions & 1 deletion extensions/pkg/controller/cmd/options_test.go
Expand Up @@ -602,7 +602,6 @@ var _ = Describe("Options", func() {
LeaderElectionResourceLock: leaderElectionResourceLock,
LeaderElectionID: leaderElectionID,
LeaderElectionNamespace: leaderElectionNamespace,
RecoverPanic: pointer.Bool(true),
}

opts := manager.Options{}
Expand Down
Expand Up @@ -20,7 +20,6 @@ import (

"github.com/spf13/cobra"
componentbaseconfig "k8s.io/component-base/config"
"k8s.io/utils/pointer"
"sigs.k8s.io/controller-runtime/pkg/manager"

extensionscontroller "github.com/gardener/gardener/extensions/pkg/controller"
Expand All @@ -41,7 +40,6 @@ func NewControllerCommand(ctrlName string, osTypes []string, generator generator
LeaderElection: true,
LeaderElectionID: extensionscmdcontroller.LeaderElectionNameID(ctrlName),
LeaderElectionNamespace: os.Getenv("LEADER_ELECTION_NAMESPACE"),
RecoverPanic: pointer.Bool(true),
}
ctrlOpts = &extensionscmdcontroller.ControllerOptions{
MaxConcurrentReconciles: 5,
Expand Down

0 comments on commit 690d8a8

Please sign in to comment.