Skip to content

Commit

Permalink
feat(singleNode): Support running single node. radondb#361
Browse files Browse the repository at this point in the history
  • Loading branch information
acekingke committed Aug 10, 2022
1 parent fa20f80 commit 37808e2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion api/v1alpha1/mysqlcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type MysqlClusterSpec struct {

// Replicas is the number of pods.
// +optional
// +kubebuilder:validation:Enum=0;2;3;5
// +kubebuilder:validation:Enum=0;1;2;3;5
// +kubebuilder:default:=3
Replicas *int32 `json:"replicas,omitempty"`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1259,6 +1259,7 @@ spec:
description: Replicas is the number of pods.
enum:
- 0
- 1
- 2
- 3
- 5
Expand Down
1 change: 1 addition & 0 deletions config/crd/bases/mysql.radondb.com_mysqlclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1259,6 +1259,7 @@ spec:
description: Replicas is the number of pods.
enum:
- 0
- 1
- 2
- 3
- 5
Expand Down
6 changes: 5 additions & 1 deletion mysqlcluster/container/xenon.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ func (c *xenon) getImage() string {

// getCommand get the container command.
func (c *xenon) getCommand() []string {
return nil
if *c.Spec.Replicas == 1 {
return []string{"xenon", "-c", "/etc/xenon/xenon.json", "-r", "LEADER"}
}
// If return nil, statefulset never update command , And I don't know why.
return []string{"xenon", "-c", "/etc/xenon/xenon.json"}
}

// getEnvVars get the container env.
Expand Down

0 comments on commit 37808e2

Please sign in to comment.