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

K8SPSMDB-1061: Refactor reconcileStatefulSet #1386

Merged
merged 14 commits into from
Mar 27, 2024
24 changes: 24 additions & 0 deletions pkg/apis/psmdb/v1/psmdb_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ type MultiCluster struct {
type AppState string

const (
AppStateNone AppState = ""
AppStateInit AppState = "initializing"
AppStateStopping AppState = "stopping"
AppStatePaused AppState = "paused"
Expand Down Expand Up @@ -551,6 +552,29 @@ func (r ReplsetSpec) CustomReplsetName() (string, error) {
return cfg.Replication.ReplSetName, nil
}

func (r *ReplsetSpec) MongodLabels(cr *PerconaServerMongoDB) map[string]string {
return map[string]string{
"app.kubernetes.io/name": "percona-server-mongodb",
"app.kubernetes.io/instance": cr.Name,
"app.kubernetes.io/replset": r.Name,
"app.kubernetes.io/managed-by": "percona-server-mongodb-operator",
"app.kubernetes.io/part-of": "percona-server-mongodb",
"app.kubernetes.io/component": "mongod",
}
}

func (r *ReplsetSpec) ArbiterLabels(cr *PerconaServerMongoDB) map[string]string {
ls := r.MongodLabels(cr)
ls["app.kubernetes.io/component"] = "arbiter"
return ls
}

func (r *ReplsetSpec) NonVotingLabels(cr *PerconaServerMongoDB) map[string]string {
ls := r.MongodLabels(cr)
ls["app.kubernetes.io/component"] = "nonVoting"
return ls
}

type LivenessProbeExtended struct {
corev1.Probe `json:",inline"`
StartupDelaySeconds int `json:"startupDelaySeconds,omitempty"`
Expand Down
Loading
Loading