DataDog / extendeddaemonset

Kubernetes Extended Daemonset controller
Apache License 2.0
98 stars 13 forks source link

Option to disable automated promotion of canary #96

Closed syndicut closed 3 years ago

syndicut commented 3 years ago

Is your feature request related to a problem? Please describe. Sometimes some sophisticated automated/manual checks need to be run before validating canary, which are impractical to put in pod health checks.

Describe the solution you'd like An option disableWaiting inside ExtendedDaemonSetSpecStrategyCanary with false default while, which disables automated validation of canary and DISABLE_WAITING environment variable in controller deployment which can be used to change default behaviour (to avoid the burden of putting disableWaiting inside every eds definition, if you want that all eds by default to be validated in manual mode).

Describe alternatives you've considered

  1. Setting duration to a very big value (like math.MaxInt64)
  2. Adding extendeddaemonset.datadoghq.com/canary-paused to every eds

Additional context

syndicut commented 3 years ago

@clamoriniere I can work on this feature in a PR, if you have any suggestions on how it should be implemented - they are highly appreciated

clamoriniere commented 3 years ago

Hello,

Thanks for opening this issue and proposing to contribute.

For the solution, I was thinking about a validationMode field inside ExtendedDaemonSetSpecStrategyCanary with for now 2 possible value: auto (default) and manual for the mode that you want to implement.

If "manual", the duration is ignored.

WDYT?

type ExtendedDaemonSetSpecStrategyCanary struct {   
    // ...
    // ValidationMode used to configure how a canary deployment is validated. possible value 'auto' (default) and 'manual`  
    ValidationMode   string   `json:"validationMode,omitempty"`
}
syndicut commented 3 years ago

Yes, LGTM. I also wanted to add env variable for operator deployment to be able to change this default, like:

// pkg/config/config.go
const (
    // NodeAffinityMatchSupportEnvVar use to know if the scheduler support this feature:
    // https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/#scheduled-by-default-scheduler-enabled-by-default-since-1-12.
    NodeAffinityMatchSupportEnvVar = "EDS_NODEAFFINITYMATCH_SUPPORT"

    // WatchNamespaceEnvVar is the constant for env variable WATCH_NAMESPACE
    // which specifies the Namespace to watch.
    // An empty value means the operator is running with cluster scope.
    WatchNamespaceEnvVar = "WATCH_NAMESPACE"
    // ValidationMode is the constant for env variable VALIDATION_MODE
    // It allows to override default validationMode setting for ExtendedDaemonSetSpecStrategyCanary.
    ValidationMode = "VALIDATION_MODE"
)

and then pass it as reconciler option on init:

// controllers/extendeddaemonset/controller.go
// ReconcilerOptions provides options read from command line.
type ReconcilerOptions struct {
    DefaultValidationMode string
}
clamoriniere commented 3 years ago

LGTM 👍