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

[Draft]: Upgrade statemachine #1193

Open
wants to merge 43 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
bed6401
Added changeAnnotation method
tgarg-splunk Jun 14, 2023
7de6f36
Refined changeClusterManagerAnnotations
tgarg-splunk Jun 15, 2023
f4453a1
test case for upgrade scenario
vivekr-splunk Jun 15, 2023
32c385d
Modified kuttl cases
tgarg-splunk Jun 21, 2023
8efb456
Added kuttl tests; Updated LicenseMaster
tgarg-splunk Jun 22, 2023
3c75c99
Fixed uninstall kuttl test
tgarg-splunk Jun 22, 2023
ee474fc
Fixed unit test
tgarg-splunk Jun 22, 2023
35a2eb0
Removed changeAnnotation from licenseMaster
tgarg-splunk Jun 23, 2023
d9540fd
Added branch in int-tests
tgarg-splunk Jun 23, 2023
5a17a5f
Completed code coverage tests
tgarg-splunk Jun 26, 2023
706dc96
Added upgradeScenario and related methods for CM
tgarg-splunk Jun 15, 2023
c5af670
Added label selectors to get Current Image
tgarg-splunk Jun 15, 2023
237ecdf
Changed pod.Spec to pod.Status
tgarg-splunk Jun 15, 2023
5966d87
Added changeAnnotations for MC
tgarg-splunk Jun 21, 2023
b827bd9
Added kuttl test cases
tgarg-splunk Jun 22, 2023
a1159a8
Fixed unit test
tgarg-splunk Jun 23, 2023
3aa032b
Fixed SmartStore unit test
tgarg-splunk Jun 23, 2023
f0e73c8
Added code coverage test
tgarg-splunk Jun 26, 2023
53f6f68
using fake client instead of mock
vivekr-splunk Jun 27, 2023
8301fd9
removed creating statefulset and service
vivekr-splunk Jun 27, 2023
8353d25
Corrected LMCurrentImage method
tgarg-splunk Jun 26, 2023
dab93db
Completed Coverage tests for CM
tgarg-splunk Jun 27, 2023
fb77880
Refined changeClusterManagerAnnotations
tgarg-splunk Jun 15, 2023
b6c70d5
test case for upgrade scenario
vivekr-splunk Jun 15, 2023
6957966
Modified kuttl cases
tgarg-splunk Jun 21, 2023
70c73c2
Added kuttl tests; Updated LicenseMaster
tgarg-splunk Jun 22, 2023
4a945eb
Fixed unit test
tgarg-splunk Jun 22, 2023
a2c9f6d
Removed changeAnnotation from licenseMaster
tgarg-splunk Jun 23, 2023
86baa21
Completed code coverage tests
tgarg-splunk Jun 26, 2023
b24fca7
Resolved all conflict issues
tgarg-splunk Jun 28, 2023
1d0cc57
Added comments
tgarg-splunk Jun 28, 2023
10cc0b6
Updated upgradeScenario to check if statefulSet exists
tgarg-splunk Jun 30, 2023
27ddd67
Fixed Unit tests
tgarg-splunk Jun 30, 2023
0378e94
Added common APIs, changed upgrade condition
tgarg-splunk Jul 10, 2023
a116e9c
Added only warning if annotation not found
tgarg-splunk Jul 10, 2023
3695b41
Add warning
tgarg-splunk Jul 10, 2023
80e6acc
Updated upgradeCondition
tgarg-splunk Jul 11, 2023
422d572
changes to support state machine
vivekr-splunk Jul 12, 2023
336e193
adding go modules
vivekr-splunk Jul 12, 2023
b7394b0
some small changes
vivekr-splunk Jul 12, 2023
a4fd740
some small changes
vivekr-splunk Jul 12, 2023
b5c1545
fixed verification part
vivekr-splunk Jul 12, 2023
6d7a198
added few more changes
vivekr-splunk Jul 12, 2023
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: 1 addition & 0 deletions .github/workflows/helm-test-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Helm Test WorkFlow
on:
push:
branches:
- CSPL-2094-LM-upgrade-strategy
- develop
- main
jobs:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/int-test-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Integration Test WorkFlow
on:
push:
branches:
- CSPL-2094-LM-upgrade-strategy
- develop
- main
- feature**
Expand Down
62 changes: 62 additions & 0 deletions api/v4/clustermanager_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,28 @@ type ClusterManagerStatus struct {

// Telemetry App installation flag
TelAppInstalled bool `json:"telAppInstalled"`

// Information tracked by the provisioner.
Provisioning ProvisionStatus `json:"provisioning"`

// OperationHistory holds information about operations performed
// on this splunk instance.
OperationHistory OperationHistory `json:"operationHistory,omitempty"`

// OperationalStatus holds the status of the splunk operations in upgrade
// +kubebuilder:validation:Enum="";OK;discovered;error;delayed;detached
OperationalStatus OperationalStatus `json:"operationalStatus"`

// ErrorCount records how many times the splunk has encoutered an error since the last successful operation
// +kubebuilder:default:=0
ErrorCount int `json:"errorCount"`

// the last error message reported by the provisioning subsystem
ErrorMessage string `json:"errorMessage"`

// ErrorType indicates the type of failure encountered when the
// OperationalStatus is OperationalStatusError
ErrorType ErrorType `json:"errorType,omitempty"`
}

// BundlePushInfo Indicates if bundle push required
Expand Down Expand Up @@ -109,6 +131,46 @@ func init() {
SchemeBuilder.Register(&ClusterManager{}, &ClusterManagerList{})
}

// SetOperationalStatus updates the OperationalStatus field and returns
// true when a change is made or false when no change is made.
func (cmstr *ClusterManager) SetOperationalStatus(status OperationalStatus) bool {
if cmstr.Status.OperationalStatus != status {
cmstr.Status.OperationalStatus = status
return true
}
return false
}

// OperationMetricForState returns a pointer to the metric for the given
// provisioning state.
func (cmstr *ClusterManager) OperationMetricForState(operation ProvisioningState) (metric *OperationMetric) {
history := &cmstr.Status.OperationHistory
switch operation {

case StateClusterManagerPrepare:
metric = &history.Prepare

case StateClusterManagerRestore:
metric = &history.Restore

case StateClusterManagerBackup:
metric = &history.Backup

case StateClusterManagerUpgrade:
metric = &history.Upgrade

case StateClusterManagerVerification:
metric = &history.Verification

case StateClusterManagerReady:
metric = &history.Ready

case StateClusterManagerError:
metric = &history.Error
}
return
}

// NewEvent creates a new event associated with the object and ready
// to be published to the kubernetes API.
func (cmstr *ClusterManager) NewEvent(eventType, reason, message string) corev1.Event {
Expand Down
Loading