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
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ export E2E_CONTROLLER_TOOLS_VERSION ?= $(CONTROLLER_TOOLS_VERSION)
export E2E_MARKLOGIC_IMAGE_VERSION ?= progressofficial/marklogic-db:11.3.1-ubi-rootless-2.1.0
export E2E_KUBERNETES_VERSION ?= v1.30.4

# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.31.0


# CHANNELS define the bundle channels used in the bundle.
# Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable")
Expand Down Expand Up @@ -62,8 +65,7 @@ OPERATOR_SDK_VERSION ?= v1.34.2

# Image URL to use all building/pushing image targets
IMG ?= ml-marklogic-operator-dev.bed-artifactory.bedford.progress.com/marklogic-kubernetes-operator:1.0.0-ea2
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.28.3


# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
Expand Down Expand Up @@ -195,8 +197,8 @@ run: manifests generate fmt vet ## Run a controller from your host.
# (i.e. docker build --platform linux/arm64). However, you must enable docker buildKit for it.
# More info: https://docs.docker.com/develop/develop-images/build_enhancements/
.PHONY: docker-build
docker-build: ## Build docker image with the manager.
$(CONTAINER_TOOL) build --platform="linux/amd64" -t ${IMG} .
docker-build: ## Build docker image with the manager. to build for linux, add --platform="linux/amd64"
$(CONTAINER_TOOL) buildx build -t ${IMG} .

.PHONY: docker-push
docker-push: ## Push docker image with the manager.
Expand Down Expand Up @@ -257,9 +259,7 @@ ENVTEST ?= $(LOCALBIN)/setup-envtest

## Tool Versions
KUSTOMIZE_VERSION ?= v5.5.0
CONTROLLER_TOOLS_VERSION ?= v0.16.4


CONTROLLER_TOOLS_VERSION ?= v0.17.1

.PHONY: kustomize
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. If wrong version is installed, it will be removed before downloading.
Expand Down
3 changes: 3 additions & 0 deletions api/v1alpha1/marklogiccluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ type MarklogicClusterSpec struct {
HAProxy *HAProxy `json:"haproxy,omitempty"`
Tls *Tls `json:"tls,omitempty"`

// +kubebuilder:validation:MaxItems=100
// +kubebuilder:validation:XValidation:rule="size(self) == 1 || (size(self) == size(self.map(x, x.groupConfig.name).filter(y, self.map(x, x.groupConfig.name).filter(z, z == y).size() == 1)))", message="MarkLogicGroups must have unique groupConfig names"
// +kubebuilder:validation:XValidation:rule="size(self) == size(self.map(x, x.name).filter(y, self.map(x, x.name).filter(z, z == y).size() == 1))", message="MarkLogicGroups must have unique names"
MarkLogicGroups []*MarklogicGroups `json:"markLogicGroups,omitempty"`
}

Expand Down
1 change: 1 addition & 0 deletions api/v1alpha1/marklogicgroup_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ func (status *MarklogicGroupStatus) GetConditionStatus(conditionType string) met
}

type GroupConfig struct {
// +kubebuilder:default:="Default"
Name string `json:"name,omitempty"`
EnableXdqpSsl bool `json:"enableXdqpSsl,omitempty"`
}
Expand Down
11 changes: 10 additions & 1 deletion config/crd/bases/database.marklogic.com_marklogicclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.4
controller-gen.kubebuilder.io/version: v0.17.1
name: marklogicclusters.database.marklogic.com
spec:
group: database.marklogic.com
Expand Down Expand Up @@ -3345,6 +3345,7 @@ spec:
enableXdqpSsl:
type: boolean
name:
default: Default
type: string
type: object
haproxy:
Expand Down Expand Up @@ -6929,7 +6930,15 @@ spec:
type: object
type: array
type: object
maxItems: 100
type: array
x-kubernetes-validations:
- message: MarkLogicGroups must have unique groupConfig names
rule: size(self) == 1 || (size(self) == size(self.map(x, x.groupConfig.name).filter(y,
self.map(x, x.groupConfig.name).filter(z, z == y).size() == 1)))
- message: MarkLogicGroups must have unique names
rule: size(self) == size(self.map(x, x.name).filter(y, self.map(x,
x.name).filter(z, z == y).size() == 1))
networkPolicy:
properties:
egress:
Expand Down
3 changes: 2 additions & 1 deletion config/crd/bases/database.marklogic.com_marklogicgroups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.4
controller-gen.kubebuilder.io/version: v0.17.1
name: marklogicgroups.database.marklogic.com
spec:
group: database.marklogic.com
Expand Down Expand Up @@ -985,6 +985,7 @@ spec:
enableXdqpSsl:
type: boolean
name:
default: Default
type: string
type: object
hugePages:
Expand Down
10 changes: 8 additions & 2 deletions internal/controller/marklogiccluster_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,17 @@ var policy = []networkingv1.PolicyType{networkingv1.PolicyTypeIngress, networkin

var marklogicGroups = []*databasev1alpha1.MarklogicGroups{
{
Name: "dnode",
Name: "dnode",
GroupConfig: &databasev1alpha1.GroupConfig{
Name: "dnode",
},
Replicas: &dnodeReplicas,
},
{
Name: "enode",
Name: "enode",
GroupConfig: &databasev1alpha1.GroupConfig{
Name: "enode",
},
Replicas: &enodeReplicas,
},
}
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/3_ml_cluster_ednode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,12 @@ func TestMlClusterWithEdnode(t *testing.T) {

// Assessment to check for MarkLogic groups are created
feature.Assess("MarkLogic groups created", func(ctx context.Context, t *testing.T, c *envconf.Config) context.Context {
t.Log("Checking MarkLogic groups")
podName := "dnode-0"
containerName := "marklogic-server"
url := "http://localhost:8002/manage/v2/groups"
curlCommand := fmt.Sprintf("curl %s --anyauth -u %s:%s", url, adminUsername, adminPassword)

output, err := utils.ExecCmdInPod(podName, mlClusterNs, containerName, curlCommand)
output, err := utils.ExecCmdInPod(podName, mlClusterNs, mlContainerName, curlCommand)
if err != nil {
t.Fatalf("Failed to execute curl command in pod: %v", err)
}
Expand Down