Skip to content

Commit 234d597

Browse files
author
Peng Zhou
committed
fix group level label not prompt to services
1 parent 798a754 commit 234d597

File tree

8 files changed

+34
-5
lines changed

8 files changed

+34
-5
lines changed

api/v1/marklogicgroup_types.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ import (
2828
// MarklogicGroupSpec defines the desired state of MarklogicGroup
2929
type MarklogicGroupSpec struct {
3030
// +kubebuilder:default:=1
31-
Replicas *int32 `json:"replicas,omitempty"`
32-
Name string `json:"name,omitempty"`
31+
Replicas *int32 `json:"replicas,omitempty"`
32+
Name string `json:"name,omitempty"`
33+
Labels map[string]string `json:"labels,omitempty"`
34+
Annotations map[string]string `json:"annotations,omitempty"`
3335
// +kubebuilder:default:="cluster.local"
3436
ClusterDomain string `json:"clusterDomain,omitempty"`
3537
// +kubebuilder:default:="progressofficial/marklogic-db:11.3.0-ubi-rootless"

api/v1/zz_generated.deepcopy.go

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/marklogic.progress.com_marklogicgroups.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3250,6 +3250,10 @@ spec:
32503250
x-kubernetes-list-type: atomic
32513251
type: object
32523252
type: object
3253+
annotations:
3254+
additionalProperties:
3255+
type: string
3256+
type: object
32533257
auth:
32543258
properties:
32553259
adminPassword:
@@ -3317,6 +3321,10 @@ spec:
33173321
type: object
33183322
x-kubernetes-map-type: atomic
33193323
type: array
3324+
labels:
3325+
additionalProperties:
3326+
type: string
3327+
type: object
33203328
license:
33213329
properties:
33223330
key:

pkg/k8sutil/ingress.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ func (cc *ClusterContext) ReconcileIngress() result.ReconcileResult {
114114
}
115115
if !patchDiff.IsEmpty() {
116116
logger.Info("MarkLogic Ingress spec is different from the input Ingress spec, updating the Ingress")
117-
logger.Info(patchDiff.String())
118117
err := cc.Client.Update(cc.Ctx, ingressDef)
119118
if err != nil {
120119
logger.Error(err, "Error updating Ingress")

pkg/k8sutil/marklogicServer.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ func GenerateMarkLogicGroupDef(cr *marklogicv1.MarklogicCluster, index int, para
125125
Auth: params.Auth,
126126
ServiceAccountName: params.ServiceAccountName,
127127
Image: params.Image,
128+
Labels: params.Labels,
129+
Annotations: params.Annotations,
128130
ImagePullSecrets: params.ImagePullSecrets,
129131
License: params.License,
130132
TerminationGracePeriodSeconds: params.TerminationGracePeriodSeconds,

pkg/k8sutil/networkPolicy.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ func (cc *ClusterContext) ReconcileNetworkPolicy() result.ReconcileResult {
8585
}
8686
if !patchDiff.IsEmpty() {
8787
logger.Info("MarkLogic NetworkPolicy spec is different from the input NetworkPolicy spec, updating the NetworkPolicy")
88-
logger.Info(patchDiff.String())
8988
err := cc.Client.Update(cc.Ctx, networkPolicyDef)
9089
if err != nil {
9190
logger.Error(err, "Error updating NetworkPolicy")

pkg/k8sutil/service.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,12 @@ func generateServiceDef(serviceMeta metav1.ObjectMeta, ownerRef metav1.OwnerRefe
9797

9898
func generateService(svcName string, cr *marklogicv1.MarklogicGroup) *corev1.Service {
9999
labels := getCommonLabels(cr.Spec.Name)
100+
groupLabels := cr.Spec.Labels
101+
if groupLabels != nil {
102+
for key, value := range groupLabels {
103+
labels[key] = value
104+
}
105+
}
100106
var svcParams serviceParameters = serviceParameters{}
101107
svcParams = generateServiceParams(cr)
102108
svcObjectMeta := generateObjectMeta(svcName, cr.Namespace, labels, svcParams.Annotations)

pkg/k8sutil/statefulset.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ func (oc *OperatorContext) ReconcileStatefulset() (reconcile.Result, error) {
132132
}
133133
if !patchDiff.IsEmpty() {
134134
logger.Info("MarkLogic statefulSet spec is different from the MarkLogicGroup spec, updating the statefulSet")
135-
logger.Info(patchDiff.String())
136135
currentSts.Spec = statefulSetDef.Spec
137136
currentSts.ObjectMeta.Annotations = statefulSetDef.ObjectMeta.Annotations
138137
currentSts.ObjectMeta.Labels = statefulSetDef.ObjectMeta.Labels

0 commit comments

Comments
 (0)