Skip to content

Commit

Permalink
Merge pull request #546 from YZ775/add-statefulset-condition
Browse files Browse the repository at this point in the history
Add Updated Conditon in Status
  • Loading branch information
masa213f authored Aug 24, 2023
2 parents d91dc27 + b7d6985 commit 6b953a6
Show file tree
Hide file tree
Showing 24 changed files with 682 additions and 336 deletions.
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

0 comments on commit 6b953a6

Please sign in to comment.