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

Improve staleness logic by improving error handling and retrying a subset of errors #32

Merged
merged 34 commits into from
Jul 10, 2019
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
a896944
Merge conflicts
lrao100 Jun 18, 2019
0b5c536
Merge conflicts
lrao100 Jun 18, 2019
1b72891
Fix lint, add comments
lrao100 Jun 18, 2019
309c5de
Remove references to staleness duration
lrao100 Jun 18, 2019
92c1049
Reset error to empty
lrao100 Jun 18, 2019
8d16b51
Revert unintended changes
lrao100 Jun 18, 2019
9a30fa5
Revert unintended changes
lrao100 Jun 18, 2019
179380b
Fixes
lrao100 Jun 18, 2019
551cd23
Fix typo
lrao100 Jun 18, 2019
370d64b
Fix imports-ed
lrao100 Jun 18, 2019
11c0341
Fix error condition during first deploy
lrao100 Jun 19, 2019
fde1dde
Update error handling
lrao100 Jun 19, 2019
25d90c8
Fix integration test and manually update config flags for clean build
lrao100 Jun 20, 2019
e5b1f56
Fix integration test
lrao100 Jun 20, 2019
a161d31
Fix unit tests with updates
lrao100 Jun 20, 2019
c542e37
Add more unit tests
lrao100 Jun 20, 2019
d676d8c
Actually generate
lrao100 Jun 20, 2019
1fe6929
Remove staleness config from integ
lrao100 Jun 20, 2019
c207e36
Fix space
lrao100 Jun 20, 2019
10c48df
First pass at review comments
lrao100 Jun 24, 2019
0cd10d4
Second pass at review comments
lrao100 Jun 25, 2019
1808750
Improve error codes based on local testing
lrao100 Jun 25, 2019
3f85790
Improving backoff with jitter and increasing default retries
lrao100 Jun 27, 2019
60919ed
Refactor to make the retry checks simpler
lrao100 Jun 27, 2019
3d245d9
Use handle() to retry instead of sleeping in the goroutine
lrao100 Jun 28, 2019
d102c02
Fix deep copy gen
lrao100 Jun 28, 2019
d8de801
Fix lint
lrao100 Jun 28, 2019
85081ed
Separate methods for retry and failfast methods, add retries for subm…
lrao100 Jul 3, 2019
d421422
Fix error code on submit job
lrao100 Jul 3, 2019
9aaa9f2
Simplify error types to 1
lrao100 Jul 9, 2019
057d411
Fix integration test
lrao100 Jul 10, 2019
29d6ad3
Update local config
lrao100 Jul 10, 2019
741ab17
Resolve conflicts
lrao100 Jul 10, 2019
9b59d32
Update integ direct mode config
lrao100 Jul 10, 2019
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: 0 additions & 1 deletion config/test/flinkk8soperator_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
operator:
ingressUrlFormat: "{{$jobCluster}}.lyft.xyz"
containerNameFormat: "%s-unknown"
statemachineStalenessDuration: 10m
logger:
show-source: true
level: 4
11 changes: 5 additions & 6 deletions integ/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,11 @@ func (s *IntegSuite) SetUpSuite(c *C) {

if runDirect {
config := controllerConfig.Config{
LimitNamespace: namespace,
UseProxy: true,
ResyncPeriod: flyteConfig.Duration{Duration: 3 * time.Second},
StatemachineStalenessDuration: flyteConfig.Duration{Duration: 30 * time.Second},
MetricsPrefix: "flinkk8soperator",
ProxyPort: flyteConfig.Port{Port: 8001},
LimitNamespace: namespace,
UseProxy: true,
ResyncPeriod: flyteConfig.Duration{Duration: 3 * time.Second},
MetricsPrefix: "flinkk8soperator",
ProxyPort: flyteConfig.Port{Port: 8001},
}

log.Info("Running operator directly")
Expand Down
2 changes: 1 addition & 1 deletion integ/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func (f *TestUtil) CreateCRD() error {

func (f *TestUtil) CreateOperator() error {
configValue := make(map[string]string)
configValue["development"] = "operator:\n containerNameFormat: \"%s-unknown\"\n statemachineStalenessDuration: 40s\n resyncPeriod: 5s"
configValue["development"] = "operator:\n containerNameFormat: \"%s-unknown\"\n resyncPeriod: 5s\n baseBackoffDuration: 10ms\n maxBackoffDuration: 50ms\n maxErrDuration: 40s\n "

configMap := v1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Expand Down
1 change: 0 additions & 1 deletion local_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
operator:
useKubectlProxy: true
containerNameFormat: "%s-unknown"
statemachineStalenessDuration: 1m
metricsPrefix: "flinkk8soperator"
resyncPeriod: 10s
proxyPort: 8001
Expand Down
20 changes: 12 additions & 8 deletions pkg/apis/app/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package v1alpha1
import (
"fmt"

"github.com/lyft/flinkk8soperator/pkg/controller/flink/client"

apiv1 "k8s.io/api/core/v1"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -151,14 +153,16 @@ type FlinkJobStatus struct {
}

type FlinkApplicationStatus struct {
Phase FlinkApplicationPhase `json:"phase"`
StartedAt *metav1.Time `json:"startedAt,omitempty"`
LastUpdatedAt *metav1.Time `json:"lastUpdatedAt,omitempty"`
Reason string `json:"reason,omitempty"`
ClusterStatus FlinkClusterStatus `json:"clusterStatus,omitempty"`
JobStatus FlinkJobStatus `json:"jobStatus"`
FailedDeployHash string `json:"failedUpdateHash,omitEmpty"`
DeployHash string `json:"deployHash"`
Phase FlinkApplicationPhase `json:"phase"`
StartedAt *metav1.Time `json:"startedAt,omitempty"`
LastUpdatedAt *metav1.Time `json:"lastUpdatedAt,omitempty"`
Reason string `json:"reason,omitempty"`
ClusterStatus FlinkClusterStatus `json:"clusterStatus,omitempty"`
JobStatus FlinkJobStatus `json:"jobStatus"`
FailedDeployHash string `json:"failedUpdateHash,omitEmpty"`
DeployHash string `json:"deployHash"`
RetryCount int32 `json:"retryCount,omitEmpty"`
LastSeenError *client.FlinkApplicationError `json:"lastSeenError,omitEmpty"`
}

func (in *FlinkApplicationStatus) GetPhase() FlinkApplicationPhase {
Expand Down
4 changes: 4 additions & 0 deletions pkg/apis/app/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 12 additions & 10 deletions pkg/controller/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,18 @@ const configSectionKey = "operator"
var ConfigSection = config.MustRegisterSection(configSectionKey, &Config{})

type Config struct {
ResyncPeriod config.Duration `json:"resyncPeriod" pflag:"\"30s\",Determines the resync period for all watchers."`
LimitNamespace string `json:"limitNamespace" pflag:"\"\",Namespaces to watch for by flink operator"`
MetricsPrefix string `json:"metricsPrefix" pflag:"\"flinkk8soperator\",Prefix for metrics propagated to prometheus"`
ProfilerPort config.Port `json:"prof-port" pflag:"\"10254\",Profiler port"`
FlinkIngressURLFormat string `json:"ingressUrlFormat"`
UseProxy bool `json:"useKubectlProxy"`
ProxyPort config.Port `json:"ProxyPort" pflag:"\"8001\",The port at which flink cluster runs locally"`
ContainerNameFormat string `json:"containerNameFormat"`
Workers int `json:"workers" pflag:"4,Number of routines to process custom resource"`
StatemachineStalenessDuration config.Duration `json:"statemachineStalenessDuration" pflag:"\"5m\",Duration for statemachine staleness."`
ResyncPeriod config.Duration `json:"resyncPeriod" pflag:"\"30s\",Determines the resync period for all watchers."`
LimitNamespace string `json:"limitNamespace" pflag:"\"\",Namespaces to watch for by flink operator"`
MetricsPrefix string `json:"metricsPrefix" pflag:"\"flinkk8soperator\",Prefix for metrics propagated to prometheus"`
ProfilerPort config.Port `json:"prof-port" pflag:"\"10254\",Profiler port"`
FlinkIngressURLFormat string `json:"ingressUrlFormat"`
UseProxy bool `json:"useKubectlProxy"`
ProxyPort config.Port `json:"ProxyPort" pflag:"\"8001\",The port at which flink cluster runs locally"`
ContainerNameFormat string `json:"containerNameFormat"`
Workers int `json:"workers" pflag:"4,Number of routines to process custom resource"`
BaseBackoffDuration config.Duration `json:"baseBackoffDuration" pflag:"\"100ms\",Determines the base backoff for exponential retries."`
MaxBackoffDuration config.Duration `json:"maxBackoffDuration" pflag:"\"30s\",Determines the max backoff for exponential retries."`
MaxErrDuration config.Duration `json:"maxErrDuration" pflag:"\"5m\",Determines the max time to wait on errors."`
}

func GetConfig() *Config {
Expand Down
34 changes: 32 additions & 2 deletions pkg/controller/config/config_flags.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 49 additions & 5 deletions pkg/controller/config/config_flags_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading