Skip to content
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
9 changes: 7 additions & 2 deletions pkg/k8sutil/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,18 @@ func SetCommonAnnotations(annotations map[string]string) {
CustomAnnotations = annotations
}

func getCommonLabels(name string) map[string]string {
defaultLabels := map[string]string{
func getSelectorLabels(name string) map[string]string {
selectorLabels := map[string]string{
"app.kubernetes.io/name": "marklogic",
"app.kubernetes.io/instance": name,
"app.kubernetes.io/managed-by": "marklogic-operator",
"app.kubernetes.io/component": "database",
}
return selectorLabels
}

func getCommonLabels(name string) map[string]string {
defaultLabels := getSelectorLabels(name)
mergedLabels := map[string]string{}
if len(CustomLabels) > 0 {
for k, v := range defaultLabels {
Expand Down
2 changes: 2 additions & 0 deletions pkg/k8sutil/marklogicServer.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ func (cc *ClusterContext) ReconsileMarklogicCluster() (reconcile.Result, error)
logger.Info("MarkLogic statefulSet spec is different from the MarkLogicGroup spec, updating the statefulSet")
logger.Info(patchDiff.String())
currentMlg.Spec = markLogicGroupDef.Spec
currentMlg.ObjectMeta.Labels = markLogicGroupDef.ObjectMeta.Labels
currentMlg.ObjectMeta.Annotations = markLogicGroupDef.ObjectMeta.Annotations
err := cc.Client.Update(cc.Ctx, currentMlg)
if err != nil {
logger.Error(err, "Error updating MakrLogicGroup")
Expand Down
3 changes: 1 addition & 2 deletions pkg/k8sutil/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ func (oc *OperatorContext) ReconcileStatefulset() (reconcile.Result, error) {
} else {
logger.Info("MarkLogic statefulSet spec is the same as the MarkLogicGroup spec")
}
logger.Info("MarkLogic statefulSet is updated to " + strconv.Itoa(int(*cr.Spec.Replicas)))
logger.Info("Operator Status:", "Stage", cr.Status.Stage)
if cr.Status.Stage == "STS_CREATED" {
logger.Info("MarkLogic statefulSet created successfully, waiting for pods to be ready")
Expand Down Expand Up @@ -191,7 +190,7 @@ func generateStatefulSetsDef(stsMeta metav1.ObjectMeta, params statefulSetParame
TypeMeta: generateTypeMeta("StatefulSet", "apps/v1"),
ObjectMeta: stsMeta,
Spec: appsv1.StatefulSetSpec{
Selector: LabelSelectors(stsMeta.GetLabels()),
Selector: LabelSelectors(getSelectorLabels(params.Name)),
ServiceName: stsMeta.Name,
Replicas: params.Replicas,
PodManagementPolicy: appsv1.ParallelPodManagement,
Expand Down