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

Add Updated Conditon in Status #546

Merged
merged 1 commit into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
35 changes: 6 additions & 29 deletions api/v1beta1/mysqlcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ type MySQLClusterStatus struct {

// Conditions is an array of conditions.
// +optional
Conditions []MySQLClusterCondition `json:"conditions,omitempty"`
Conditions []metav1.Condition `json:"conditions,omitempty"`

// CurrentPrimaryIndex is the index of the current primary Pod in StatefulSet.
// Initially, this is zero.
Expand Down Expand Up @@ -287,35 +287,12 @@ type MySQLClusterStatus struct {
ReconcileInfo ReconcileInfo `json:"reconcileInfo"`
}

// MySQLClusterCondition defines the condition of MySQLCluster.
type MySQLClusterCondition struct {
// Type is the type of the condition.
Type MySQLClusterConditionType `json:"type"`

// Status is the status of the condition.
Status corev1.ConditionStatus `json:"status"`

// Reason is a one-word CamelCase reason for the condition's last transition.
// +optional
Reason string `json:"reason,omitempty"`

// Message is a human-readable message indicating details about last transition.
// +optional
Message string `json:"message,omitempty"`

// LastTransitionTime is the last time the condition transits from one status to another.
LastTransitionTime metav1.Time `json:"lastTransitionTime"`
}

// MySQLClusterConditionType is the type of MySQLCluster condition.
// +kubebuilder:validation:Enum=Initialized;Available;Healthy
type MySQLClusterConditionType string

// Valid values for MySQLClusterConditionType
const (
ConditionInitialized MySQLClusterConditionType = "Initialized"
ConditionAvailable MySQLClusterConditionType = "Available"
ConditionHealthy MySQLClusterConditionType = "Healthy"
ConditionInitialized string = "Initialized"
ConditionAvailable string = "Available"
ConditionHealthy string = "Healthy"
ConditionStatefulSetReady string = "StatefulSetReady"
ConditionReconcileSuccess string = "ReconcileSuccess"
)

// BackupStatus represents the status of the last successful backup.
Expand Down
42 changes: 2 additions & 40 deletions api/v1beta1/zz_generated.conversion.go

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

19 changes: 2 additions & 17 deletions api/v1beta1/zz_generated.deepcopy.go

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

35 changes: 6 additions & 29 deletions api/v1beta2/mysqlcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ type MySQLClusterStatus struct {

// Conditions is an array of conditions.
// +optional
Conditions []MySQLClusterCondition `json:"conditions,omitempty"`
Conditions []metav1.Condition `json:"conditions,omitempty"`

// CurrentPrimaryIndex is the index of the current primary Pod in StatefulSet.
// Initially, this is zero.
Expand Down Expand Up @@ -601,35 +601,12 @@ type MySQLClusterStatus struct {
ReconcileInfo ReconcileInfo `json:"reconcileInfo"`
}

// MySQLClusterCondition defines the condition of MySQLCluster.
type MySQLClusterCondition struct {
// Type is the type of the condition.
Type MySQLClusterConditionType `json:"type"`

// Status is the status of the condition.
Status corev1.ConditionStatus `json:"status"`

// Reason is a one-word CamelCase reason for the condition's last transition.
// +optional
Reason string `json:"reason,omitempty"`

// Message is a human-readable message indicating details about last transition.
// +optional
Message string `json:"message,omitempty"`

// LastTransitionTime is the last time the condition transits from one status to another.
LastTransitionTime metav1.Time `json:"lastTransitionTime"`
}

// MySQLClusterConditionType is the type of MySQLCluster condition.
// +kubebuilder:validation:Enum=Initialized;Available;Healthy
type MySQLClusterConditionType string

// Valid values for MySQLClusterConditionType
const (
ConditionInitialized MySQLClusterConditionType = "Initialized"
ConditionAvailable MySQLClusterConditionType = "Available"
ConditionHealthy MySQLClusterConditionType = "Healthy"
ConditionInitialized string = "Initialized"
ConditionAvailable string = "Available"
ConditionHealthy string = "Healthy"
ConditionStatefulSetReady string = "StatefulSetReady"
ConditionReconcileSuccess string = "ReconcileSuccess"
)

// BackupStatus represents the status of the last successful backup.
Expand Down
19 changes: 2 additions & 17 deletions api/v1beta2/zz_generated.deepcopy.go

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

66 changes: 46 additions & 20 deletions charts/moco/templates/generated/crds/moco_crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9596,30 +9596,43 @@ spec:
conditions:
description: Conditions is an array of conditions.
items:
description: MySQLClusterCondition defines the condition of MyS
description: Condition contains details for one aspect of the c
properties:
lastTransitionTime:
description: 'LastTransitionTime is the last time the condition '
description: 'lastTransitionTime is the last time the condition '
format: date-time
type: string
message:
description: Message is a human-readable message indicating det
description: message is a human readable message indicating det
maxLength: 32768
type: string
observedGeneration:
description: observedGeneration represents the .metadata.
format: int64
minimum: 0
type: integer
reason:
description: Reason is a one-word CamelCase reason for the cond
description: reason contains a programmatic identifier indicati
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
type: string
status:
description: Status is the status of the condition.
description: status of the condition, one of True, False, Unkno
enum:
- "True"
- "False"
- Unknown
type: string
type:
description: Type is the type of the condition.
enum:
- Initialized
- Available
- Healthy
description: type of condition in CamelCase or in foo.example.
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
required:
- lastTransitionTime
- message
- reason
- status
- type
type: object
Expand Down Expand Up @@ -15339,30 +15352,43 @@ spec:
conditions:
description: Conditions is an array of conditions.
items:
description: MySQLClusterCondition defines the condition of MyS
description: Condition contains details for one aspect of the c
properties:
lastTransitionTime:
description: 'LastTransitionTime is the last time the condition '
description: 'lastTransitionTime is the last time the condition '
format: date-time
type: string
message:
description: Message is a human-readable message indicating det
description: message is a human readable message indicating det
maxLength: 32768
type: string
observedGeneration:
description: observedGeneration represents the .metadata.
format: int64
minimum: 0
type: integer
reason:
description: Reason is a one-word CamelCase reason for the cond
description: reason contains a programmatic identifier indicati
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
type: string
status:
description: Status is the status of the condition.
description: status of the condition, one of True, False, Unkno
enum:
- "True"
- "False"
- Unknown
type: string
type:
description: Type is the type of the condition.
enum:
- Initialized
- Available
- Healthy
description: type of condition in CamelCase or in foo.example.
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
required:
- lastTransitionTime
- message
- reason
- status
- type
type: object
Expand Down
Loading