Skip to content

Commit 1ad4710

Browse files
pengzhoumlPeng Zhou
andauthored
MLE-11461 single group update (#8)
* update poststart-hook.sh * add new package for comparing calculate the difference for update * add reconcile to updateStrategy * temp fix for demo * update dockerfile * add sample for demo * reconcile update * update namespace name and namePrefix * update golang version in Dockerfile * update rbac for docker image * generate bundle * update docker repo * add go version * update postStart hook script * add unit test for update * remove samples * update controller tools version --------- Co-authored-by: Peng Zhou <peng.zhou@progress.com>
1 parent 06fc0e9 commit 1ad4710

23 files changed

+9300
-266
lines changed

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build the manager binary
2-
FROM golang:1.20 AS builder
2+
FROM golang:1.22 AS builder
33
ARG TARGETOS
44
ARG TARGETARCH
55

@@ -15,6 +15,7 @@ RUN go mod download
1515
COPY cmd/main.go cmd/main.go
1616
COPY api/ api/
1717
COPY internal/controller/ internal/controller/
18+
COPY pkg/ pkg/
1819

1920
# Build
2021
# the GOARCH has not a default value to allow the binary be built according to the host where the command

Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)
2929
#
3030
# For example, running 'make bundle-build bundle-push catalog-build catalog-push' will build and push both
3131
# marklogic.com/marklogic-kubernetes-operator-bundle:$VERSION and marklogic.com/marklogic-kubernetes-operator-catalog:$VERSION.
32-
IMAGE_TAG_BASE ?= marklogic.com/marklogic-kubernetes-operator
32+
IMAGE_TAG_BASE ?= ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/ml-marklogic-operator-dev/marklogic-kubernetes-operator
3333

3434
# BUNDLE_IMG defines the image:tag used for the bundle.
3535
# You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=<some-registry>/<project-name-bundle>:<tag>)
@@ -51,7 +51,7 @@ endif
5151
OPERATOR_SDK_VERSION ?= v1.34.2
5252

5353
# Image URL to use all building/pushing image targets
54-
IMG ?= controller:latest
54+
IMG ?= ml-marklogic-operator-dev.bed-artifactory.bedford.progress.com/marklogic-kubernetes-operator:0.0.1
5555
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
5656
ENVTEST_K8S_VERSION = 1.28.3
5757

@@ -140,6 +140,7 @@ lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes
140140

141141
.PHONY: build
142142
build: manifests generate fmt vet ## Build manager binary.
143+
go version
143144
go build -o bin/manager cmd/main.go
144145

145146
.PHONY: run
@@ -212,7 +213,7 @@ ENVTEST ?= $(LOCALBIN)/setup-envtest
212213

213214
## Tool Versions
214215
KUSTOMIZE_VERSION ?= v5.2.1
215-
CONTROLLER_TOOLS_VERSION ?= v0.13.0
216+
CONTROLLER_TOOLS_VERSION ?= v0.14.0
216217

217218
.PHONY: kustomize
218219
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. If wrong version is installed, it will be removed before downloading.

api/v1alpha1/marklogicgroup_types.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package v1alpha1
1818

1919
import (
20+
appsv1 "k8s.io/api/apps/v1"
2021
corev1 "k8s.io/api/core/v1"
2122
networkingv1 "k8s.io/api/networking/v1"
2223
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -46,10 +47,10 @@ type MarklogicGroupSpec struct {
4647
TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"`
4748
// +kubebuilder:validation:Enum=OnDelete;RollingUpdate
4849
// +kubebuilder:default:="OnDelete"
49-
UpdateStrategy string `json:"updateStrategy,omitempty"`
50-
NetworkPolicy *networkingv1.NetworkPolicy `json:"networkPolicy,omitempty"`
51-
PodSecurityContext *corev1.PodSecurityContext `json:"securityContext,omitempty"`
52-
ContainerSecurityContext *corev1.SecurityContext `json:"containerSecurityContext,omitempty"`
50+
UpdateStrategy appsv1.StatefulSetUpdateStrategyType `json:"updateStrategy,omitempty"`
51+
NetworkPolicy *networkingv1.NetworkPolicy `json:"networkPolicy,omitempty"`
52+
PodSecurityContext *corev1.PodSecurityContext `json:"securityContext,omitempty"`
53+
ContainerSecurityContext *corev1.SecurityContext `json:"containerSecurityContext,omitempty"`
5354

5455
Affinity *corev1.Affinity `json:"affinity,omitempty"`
5556
NodeSelector map[string]string `json:"nodeSelector,omitempty"`

bundle.Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM scratch
2+
3+
# Core bundle labels.
4+
LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
5+
LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
6+
LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
7+
LABEL operators.operatorframework.io.bundle.package.v1=marklogic-kubernetes-operator
8+
LABEL operators.operatorframework.io.bundle.channels.v1=alpha
9+
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.34.2
10+
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
11+
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v4
12+
13+
# Labels for testing.
14+
LABEL operators.operatorframework.io.test.mediatype.v1=scorecard+v1
15+
LABEL operators.operatorframework.io.test.config.v1=tests/scorecard/
16+
17+
# Copy files to locations specified by labels.
18+
COPY bundle/manifests /manifests/
19+
COPY bundle/metadata /metadata/
20+
COPY bundle/tests/scorecard /tests/scorecard/

bundle/manifests/database.marklogic.com_marklogicclusters.yaml

Lines changed: 4414 additions & 0 deletions
Large diffs are not rendered by default.

bundle/manifests/database.marklogic.com_marklogicgroups.yaml

Lines changed: 3985 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)