-
Notifications
You must be signed in to change notification settings - Fork 1k
Improving Postgres CR Status with Additional Details #2714
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
base: master
Are you sure you want to change the base?
Changes from 2 commits
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 |
---|---|---|
|
@@ -3,6 +3,7 @@ package v1 | |
// Postgres CRD definition, please use CamelCase for field names. | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/api/equality" | ||
"time" | ||
|
||
v1 "k8s.io/api/core/v1" | ||
|
@@ -225,9 +226,48 @@ type Sidecar struct { | |
// UserFlags defines flags (such as superuser, nologin) that could be assigned to individual users | ||
type UserFlags []string | ||
|
||
type Conditions []Condition | ||
|
||
type ConditionType string | ||
FxKu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
type VolatileTime struct { | ||
Inner metav1.Time `json:",inline"` | ||
} | ||
|
||
// MarshalJSON implements the json.Marshaler interface. | ||
func (t VolatileTime) MarshalJSON() ([]byte, error) { | ||
return t.Inner.MarshalJSON() | ||
} | ||
|
||
// UnmarshalJSON implements the json.Unmarshaller interface. | ||
func (t *VolatileTime) UnmarshalJSON(b []byte) error { | ||
return t.Inner.UnmarshalJSON(b) | ||
} | ||
|
||
func init() { | ||
equality.Semantic.AddFunc( | ||
// Always treat VolatileTime fields as equivalent. | ||
func(VolatileTime, VolatileTime) bool { | ||
return true | ||
}, | ||
) | ||
} | ||
|
||
// Condition contains the conditions of the PostgreSQL cluster | ||
type Condition struct { | ||
RavinaChidambaram marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Type ConditionType `json:"type" description:"type of status condition"` | ||
Status v1.ConditionStatus `json:"status" description:"status of the condition, one of True, False, Unknown"` | ||
LastTransitionTime VolatileTime `json:"lastTransitionTime,omitempty" description:"last time the condition transit from one status to another"` | ||
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. why use an extra type and not just metav1.Time? 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. Mostly to avoid semantic check inequality with 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. @FxKu , Is this okay? |
||
Reason string `json:"reason,omitempty" description:"one-word CamelCase reason for the condition's last transition"` | ||
Message string `json:"message,omitempty" description:"human-readable message indicating details about last transition"` | ||
} | ||
|
||
// PostgresStatus contains status of the PostgreSQL cluster (running, creation failed etc.) | ||
type PostgresStatus struct { | ||
PostgresClusterStatus string `json:"PostgresClusterStatus"` | ||
PostgresClusterStatus string `json:"postgresClusterStatus"` | ||
NumberOfInstances int32 `json:"numberOfInstances"` | ||
LabelSelector string `json:"labelSelector"` | ||
ObservedGeneration int64 `json:"observedGeneration,omitempty"` | ||
Conditions Conditions `json:"conditions,omitempty"` | ||
} | ||
|
||
// ConnectionPooler Options for connection pooler | ||
|
Uh oh!
There was an error while loading. Please reload this page.