Skip to content

Commit

Permalink
Adding timeouts to Runtime controller configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
koala7659 committed Aug 4, 2024
1 parent 6b70bfc commit 202c144
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
19 changes: 16 additions & 3 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ const defaultExpirationTime = 24 * time.Hour
const defaultRuntimeReconcilerEnabled = true
const defaultGardenerRequestTimeout = 60 * time.Second

const defaultProvisioingTimeout = 15 * time.Minute
const defaultDeprovisioningTimeout = 15 * time.Minute
const defaultUpgradeTimeout = 15 * time.Minute

func main() {
var metricsAddr string
var enableLeaderElection bool
Expand All @@ -74,6 +78,9 @@ func main() {
var enableRuntimeReconciler bool
var converterConfigFilepath string
var shootSpecDumpEnabled bool
var provisionTimeout time.Duration
var deprovisionTimeout time.Duration
var upgradeTimeout time.Duration

flag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.")
flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")
Expand All @@ -88,6 +95,9 @@ func main() {
flag.BoolVar(&enableRuntimeReconciler, "runtime-reconciler-enabled", defaultRuntimeReconcilerEnabled, "Feature flag for all runtime reconciler functionalities")
flag.StringVar(&converterConfigFilepath, "converter-config-filepath", "hack/converter_config.json", "A file path to the gardener shoot converter configuration.")
flag.BoolVar(&shootSpecDumpEnabled, "shoot-spec-dump-enabled", false, "Feature flag to allow persisting specs of created shoots")
flag.DurationVar(&provisionTimeout, "provisioning-timeout", defaultProvisioingTimeout, "Runtime provisioning timeout")
flag.DurationVar(&deprovisionTimeout, "deprovisioning-timeout", defaultDeprovisioningTimeout, "Runtime deprovisioning timeout")
flag.DurationVar(&upgradeTimeout, "kubeconfig-expiration-time", defaultUpgradeTimeout, "Runtime upgrade timeout")

opts := zap.Options{
Development: true,
Expand Down Expand Up @@ -170,9 +180,12 @@ func main() {
}

cfg := fsm.RCCfg{
Finalizer: infrastructuremanagerv1.Finalizer,
ShootNamesapace: gardenerNamespace,
ConverterConfig: converterConfig,
Finalizer: infrastructuremanagerv1.Finalizer,
ShootNamesapace: gardenerNamespace,
ConverterConfig: converterConfig,
ProvisionTimeout: provisionTimeout,
DeprovisionTimeout: deprovisionTimeout,
UpdateTimeout: upgradeTimeout,
}
if shootSpecDumpEnabled {
cfg.PVCPath = "/testdata/kim"
Expand Down
11 changes: 7 additions & 4 deletions internal/controller/runtime/fsm/runtime_fsm.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,12 @@ type writerGetter = func(filePath string) (io.Writer, error)

// runtime reconciler specific configuration
type RCCfg struct {
Finalizer string
PVCPath string
ShootNamesapace string
ProvisionTimeout time.Duration
DeprovisionTimeout time.Duration
UpdateTimeout time.Duration
Finalizer string
PVCPath string
ShootNamesapace string
shoot.ConverterConfig
}

Expand Down Expand Up @@ -98,7 +101,7 @@ loop:
}, err
}

func NewFsm(log logr.Logger, cfg RCCfg, k8s K8s) Fsm {
func NewFsm(log logr.Logger, cfg RCCfg, k8s K8s, timeoutProvision, timeoutDeprovision, timeoutUpdate time.Duration) Fsm {
return &fsm{
fn: sFnTakeSnapshot,
writerProvider: getWriterForFilesystem,
Expand Down

0 comments on commit 202c144

Please sign in to comment.