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

Setup for blue/green deployment mode #180

Merged
merged 43 commits into from
Mar 26, 2020
Merged
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
0c3fb79
Working version 1
glaksh100 Feb 19, 2020
3fa7911
Create setup for blue green deploys
glaksh100 Feb 21, 2020
a8fbe00
[WIP] Setup status sub-resource for blue green deploys
glaksh100 Feb 27, 2020
df89376
Updates
glaksh100 Feb 27, 2020
d5543d7
fix bug
glaksh100 Feb 27, 2020
2d7919e
Fixes
glaksh100 Feb 27, 2020
f89a2e1
Make running jobs calculation idempotent
glaksh100 Feb 27, 2020
469cc96
Fix bugs
glaksh100 Feb 27, 2020
0409316
Reset running jobs in recovering phase
glaksh100 Feb 27, 2020
57882da
Make status index calculation simpler
glaksh100 Feb 27, 2020
08e5ce4
Add container env and annotations
glaksh100 Feb 28, 2020
5fdbc22
Update CRD to v1beta2
glaksh100 Mar 8, 2020
cd44057
Update CRD to v1beta2
glaksh100 Mar 8, 2020
1fdf5a1
Fix CRD update issues
glaksh100 Mar 9, 2020
1cad6dd
Fix lint
glaksh100 Mar 9, 2020
7aff3f0
Merge master and restore v1beta1 to original version
glaksh100 Mar 9, 2020
dcba167
Merge master and restore v1beta1 to original version
glaksh100 Mar 9, 2020
4783327
Upgrade integ test to v1beta2
glaksh100 Mar 9, 2020
32d4a60
Backward compatibility changes
glaksh100 Mar 10, 2020
1a4b8c0
Work around status subresource bug
glaksh100 Mar 10, 2020
ea2c93b
Rename status array to VersionStatuses and add comment on k8s bug
glaksh100 Mar 10, 2020
937b965
Remove DesiredApplicationCount
glaksh100 Mar 10, 2020
612de70
Minor updates
glaksh100 Mar 10, 2020
5c17983
Minor updates
glaksh100 Mar 10, 2020
b543ab0
Initialize counter
glaksh100 Mar 10, 2020
4e2d93e
Handle edge case for jobId
glaksh100 Mar 10, 2020
6ef5216
Debug
glaksh100 Mar 10, 2020
facab34
Debug
glaksh100 Mar 10, 2020
dc63057
fixes
glaksh100 Mar 10, 2020
8d33782
Fix edge case
glaksh100 Mar 10, 2020
1577b77
Fix unit tests
glaksh100 Mar 10, 2020
9e11592
Debug logs
glaksh100 Mar 10, 2020
3c4d0be
Fix overwriting of versionstatuses
glaksh100 Mar 10, 2020
bd689d9
Remove debug logs
glaksh100 Mar 10, 2020
6abcfe2
Merge master
glaksh100 Mar 19, 2020
88c535d
Merge master
glaksh100 Mar 19, 2020
9e0a682
Revert CRD upgrade
glaksh100 Mar 19, 2020
d5fbbc0
Keep Status.ClusterStatus and Status.JobStatus unchanged for Dual mode
glaksh100 Mar 19, 2020
0073401
Remove unwarranted changes
glaksh100 Mar 19, 2020
527fab0
Make import name more descriptive
glaksh100 Mar 24, 2020
719e881
Revert file name to add_v1beta1
glaksh100 Mar 24, 2020
578a82b
Remove an unnecessary diff
glaksh100 Mar 26, 2020
0b381e2
Remove an unnecessary diff
glaksh100 Mar 26, 2020
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
68 changes: 53 additions & 15 deletions pkg/apis/app/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,19 +168,37 @@ 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:"failedDeployHash,omitempty"`
RollbackHash string `json:"rollbackHash,omitempty"`
DeployHash string `json:"deployHash"`
SavepointTriggerID string `json:"savepointTriggerId,omitempty"`
SavepointPath string `json:"savepointPath,omitempty"`
RetryCount int32 `json:"retryCount,omitempty"`
LastSeenError *FlinkApplicationError `json:"lastSeenError,omitempty"`
Phase FlinkApplicationPhase `json:"phase"`
StartedAt *metav1.Time `json:"startedAt,omitempty"`
LastUpdatedAt *metav1.Time `json:"lastUpdatedAt,omitempty"`
Reason string `json:"reason,omitempty"`
DeployVersion string `json:"deployVersion,omitempty"`
UpdatingVersion string `json:"updatingVersion,omitempty"`
// To ensure backward compatibility, repeat ClusterStatus and JobStatus
ClusterStatus FlinkClusterStatus `json:"clusterStatus,omitempty"`
JobStatus FlinkJobStatus `json:"jobStatus,omitempty"`
VersionStatuses []FlinkApplicationVersionStatus `json:"versionStatuses,omitempty"`
FailedDeployHash string `json:"failedDeployHash,omitempty"`
RollbackHash string `json:"rollbackHash,omitempty"`
DeployHash string `json:"deployHash"`
SavepointTriggerID string `json:"savepointTriggerId,omitempty"`
SavepointPath string `json:"savepointPath,omitempty"`
RetryCount int32 `json:"retryCount,omitempty"`
LastSeenError *FlinkApplicationError `json:"lastSeenError,omitempty"`
}

type FlinkApplicationVersion string

const (
BlueFlinkApplication FlinkApplicationVersion = "Blue"
GreenFlinkApplication FlinkApplicationVersion = "Green"
)

type FlinkApplicationVersionStatus struct {
Version FlinkApplicationVersion `json:"appVersion,omitempty"`
VersionHash string `json:"versionHash,omitempty"`
ClusterStatus FlinkClusterStatus `json:"clusterStatus,omitempty"`
JobStatus FlinkJobStatus `json:"jobStatus,omitempty"`
}

func (in *FlinkApplicationStatus) GetPhase() FlinkApplicationPhase {
Expand Down Expand Up @@ -226,6 +244,8 @@ const (
FlinkApplicationRecovering FlinkApplicationPhase = "Recovering"
FlinkApplicationRollingBackJob FlinkApplicationPhase = "RollingBackJob"
FlinkApplicationDeployFailed FlinkApplicationPhase = "DeployFailed"
FlinkApplicationDualRunning FlinkApplicationPhase = "DualRunning"
FlinkApplicationTeardown FlinkApplicationPhase = "Teardown"
)

var FlinkApplicationPhases = []FlinkApplicationPhase{
Expand All @@ -240,17 +260,35 @@ var FlinkApplicationPhases = []FlinkApplicationPhase{
FlinkApplicationRecovering,
FlinkApplicationDeployFailed,
FlinkApplicationRollingBackJob,
FlinkApplicationDualRunning,
FlinkApplicationTeardown,
}

func IsRunningPhase(phase FlinkApplicationPhase) bool {
return phase == FlinkApplicationRunning || phase == FlinkApplicationDeployFailed
}

func IsBlueGreenDeploymentMode(mode DeploymentMode) bool {
// Backaward compatibility between v1beta1 and v1beta1
if mode == DeploymentModeDual {
return false
}
return mode == DeploymentModeBlueGreen
}

func GetMaxRunningJobs(mode DeploymentMode) int32 {
if IsBlueGreenDeploymentMode(mode) {
return int32(2)
}
return int32(1)
}

type DeploymentMode string

const (
DeploymentModeSingle DeploymentMode = "Single"
DeploymentModeDual DeploymentMode = "Dual"
DeploymentModeSingle DeploymentMode = "Single"
DeploymentModeDual DeploymentMode = "Dual"
DeploymentModeBlueGreen DeploymentMode = "BlueGreen"
)

type DeleteMode string
Expand Down
25 changes: 25 additions & 0 deletions pkg/apis/app/v1beta1/zz_generated.deepcopy.go

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

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

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

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

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

Loading