-
Notifications
You must be signed in to change notification settings - Fork 79
K8SPG-777 Fix the crash in ShouldCheckStandbyLag #1652
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
Changes from all commits
0e52d77
ed73169
e9b2244
4901a83
4199c53
3d0d8c1
79cbede
7a7d341
132d3f8
87074bd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,6 +60,7 @@ type PerconaPGClusterSpec struct { | |
| // upgrade to apply changes to Kubernetes objects. Default is the latest | ||
| // version. | ||
| // +optional | ||
| // +kubebuilder:validation:XValidation:rule="self == \"\" || self.matches('^[0-9]+\\\\.[0-9]+\\\\.[0-9]+([-+][a-zA-Z0-9.+-]+)?$')",message="CRVersion must be a valid semantic version" | ||
| CRVersion string `json:"crVersion,omitempty"` | ||
|
|
||
| InitContainer *crunchyv1beta1.InitContainerSpec `json:"initContainer,omitempty"` | ||
|
|
@@ -517,7 +518,11 @@ func (cr *PerconaPGCluster) ToCrunchy(ctx context.Context, postgresCluster *crun | |
| } | ||
|
|
||
| func (cr *PerconaPGCluster) Version() *gover.Version { | ||
| return gover.Must(gover.NewVersion(cr.Spec.CRVersion)) | ||
| crVersion := cr.Spec.CRVersion | ||
| if crVersion == "" { | ||
| crVersion = version.Version() | ||
| } | ||
|
Comment on lines
+521
to
+524
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test case would only work on e2e tests
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we don't need to test ShouldCheckStandbyLag regression but it'd be great to add a simple unit test that covers |
||
| return gover.Must(gover.NewVersion(crVersion)) | ||
|
Comment on lines
+521
to
+525
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, this only falls back with the assumption that the opeator will reconcile the cluster and set the version asynchronously. Falling back to version.Version() on non empty can introduce hard to find bugs. But a way to do it, would actually be a validation pattern on the CRD
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i agree |
||
| } | ||
|
|
||
| func (cr *PerconaPGCluster) CompareVersion(ver string) int { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed