Skip to content

Commit

Permalink
Merge pull request #37 from Al-assad/dev_main
Browse files Browse the repository at this point in the history
Improve makefile: docker, kustomize, helm package build publish tasks
  • Loading branch information
Al-assad authored Dec 20, 2023
2 parents a4c9b7f + 22a2038 commit 746030e
Show file tree
Hide file tree
Showing 8 changed files with 126 additions and 9 deletions.
63 changes: 60 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,25 @@ $(ENVTEST): $(LOCALBIN)

##@ Generate deployment resources under /deploy

# doris-operator version
OPR_VER ?=

# Generate deploy/kustomize
.PHONY: gen-deploy-kustomize
gen-deploy-kustomize: manifests kustomize
gen-deploy-kustomize: __check_opr_ver manifests kustomize
sed -i '' "s/newTag:.*/newTag: $(OPR_VER)/g" deploy/kustomize/kustomization.yaml
$(KUSTOMIZE) build config/crd > deploy/kustomize/crds.yaml
$(KUSTOMIZE) build config/rbac > deploy/kustomize/rbac.yaml
$(KUSTOMIZE) build config/manager > deploy/kustomize/manager.yaml
cp config/default/manager_auth_proxy_patch.yaml deploy/kustomize/manager_auth_proxy.yaml
$(KUSTOMIZE) build deploy/kustomize > deploy/kustomize/kustomized.yaml

__check_opr_ver:
@if [ -z "$(OPR_VER)" ]; then \
echo "ERROR: OPR_VER(doris operator version) is not specified."; \
exit 1; \
fi


HELMIFY ?= $(LOCALBIN)/helmify

Expand All @@ -192,12 +202,59 @@ init-deploy-helm: manifests kustomize helmify

# Generate Helm chart from Kustomize
.PHONY: gen-deploy-helm
gen-deploy-helm: manifests kustomize helmify
gen-deploy-helm: __check_opr_ver manifests kustomize helmify
sed -i '' "s/image: ghcr\.io\/linsoss\/doris-operator:.*/image: ghcr\.io\/linsoss\/doris-operator:$(OPR_VER)/g" deploy/helm/doris-operator/values.yaml
sed -i '' "s/version:.*/version: $(OPR_VER)/g" deploy/helm/doris-operator/Chart.yaml
sed -i '' "s/appVersion:.*/appVersion: v$(OPR_VER)/g" deploy/helm/doris-operator/Chart.yaml
mkdir -p deploy/helm/tmp/
$(KUSTOMIZE) build config/default | $(HELMIFY) -crd-dir deploy/helm/tmp
rsync -a --delete deploy/helm/tmp/crds deploy/helm/doris-operator/
rm -rf deploy/helm/tmp

##@ Publish packages, Need to log in to ghcr.io in advance:
## docker login ghcr.io -u xxx -p xxx
## helm registry login -u xxx -p xxx ghcr.io

# Build and publish Doris component images
.PHONY: publish-doris-img
DORIS_VER ?=
publish-doris-img:
@if [ -z "$(DORIS_VER)" ]; then \
echo "ERROR: DORIS_VER is not specified."; \
exit 1; \
fi
@echo "begin to publish doris:$(DORIS_VER) to ghcr.io"
docker buildx create --name doris-builder --use --platform linux/amd64,linux/arm64
@cd images && \
echo "building doris-fe:$(DORIS_VER)" && \
docker buildx build --platform linux/amd64,linux/arm64 -t ghcr.io/linsoss/doris-fe:$(DORIS_VER) -f fe/Dockerfile . --push && \
echo "building doris-broker:$(DORIS_VER)" && \
docker buildx build --platform linux/amd64,linux/arm64 -t ghcr.io/linsoss/doris-broker:$(DORIS_VER) -f broker/Dockerfile . --push $$ \
echo "building doris-be:$(DORIS_VER)" && \
docker buildx build --platform linux/amd64,linux/arm64 -t ghcr.io/linsoss/doris-be:$(DORIS_VER) -f be/Dockerfile . --push && \
echo "building doris-cn:$(DORIS_VER)" && \
docker buildx build --platform linux/amd64,linux/arm64 -t ghcr.io/linsoss/doris-cn:$(DORIS_VER) -f cn/Dockerfile . --push
docker buildx rm doris-builder


# Build and publish Doris operator packages
.PHONY: publish-operator
OPR_VER ?=
publish-operator: __check_opr_ver gen-deploy-kustomize gen-deploy-helm
@echo "build doris-operator:$(OPR_VER) image"
@$(MAKE) docker-buildx IMG=ghcr.io/linsoss/doris-operator:$(OPR_VER)
@echo "publish kustomize package"
flux push artifact oci://ghcr.io/linsoss/kustomize/doris-operator:$(OPR_VER) \
--path="./deploy/kustomize" \
--source="https://github.com/linsoss/doris-operator.git" \
--revision="$(git branch --show-current)@sha1:$(git rev-parse HEAD)"
@echo "publish helm package"
cd deploy/helm && \
helm package --version $(OPR_VER) doris-operator && \
helm push doris-operator-$(OPR_VER).tgz oci://ghcr.io/linsoss/helm && \
rm -f doris-operator-$(OPR_VER).tgz


##@ Website development
WEBSITE_DIR ?= website

Expand All @@ -220,4 +277,4 @@ website-dev: website-sync
# Clean website build resources
.PHONY: website-clean
website-clean:
cd ${WEBSITE_DIR} && pnpm run clean
cd ${WEBSITE_DIR} && pnpm run clean
4 changes: 2 additions & 2 deletions deploy/helm/doris-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.0.3
version: 1.0.4
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "v1.0.3"
appVersion: v1.0.4
20 changes: 20 additions & 0 deletions deploy/helm/doris-operator/crds/doriscluster-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,10 @@ spec:
type: array
type: object
type: object
annotations:
additionalProperties:
type: string
type: object
be:
properties:
additionalContainers:
Expand Down Expand Up @@ -2172,6 +2176,10 @@ spec:
type: array
type: object
type: object
annotations:
additionalProperties:
type: string
type: object
baseImage:
type: string
claims:
Expand Down Expand Up @@ -4058,6 +4066,10 @@ spec:
type: array
type: object
type: object
annotations:
additionalProperties:
type: string
type: object
baseImage:
type: string
claims:
Expand Down Expand Up @@ -5921,6 +5933,10 @@ spec:
type: array
type: object
type: object
annotations:
additionalProperties:
type: string
type: object
baseImage:
type: string
claims:
Expand Down Expand Up @@ -7782,6 +7798,10 @@ spec:
type: array
type: object
type: object
annotations:
additionalProperties:
type: string
type: object
baseImage:
type: string
claims:
Expand Down
2 changes: 1 addition & 1 deletion deploy/helm/doris-operator/values.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# doris operator controller main container configuration
manager:
# controller container image
image: ghcr.io/linsoss/doris-operator:1.0.3
image: ghcr.io/linsoss/doris-operator:1.0.4
# controller container resources
resources: { }

Expand Down
20 changes: 20 additions & 0 deletions deploy/kustomize/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1081,6 +1081,10 @@ spec:
type: array
type: object
type: object
annotations:
additionalProperties:
type: string
type: object
be:
properties:
additionalContainers:
Expand Down Expand Up @@ -2861,6 +2865,10 @@ spec:
type: array
type: object
type: object
annotations:
additionalProperties:
type: string
type: object
baseImage:
type: string
claims:
Expand Down Expand Up @@ -4747,6 +4755,10 @@ spec:
type: array
type: object
type: object
annotations:
additionalProperties:
type: string
type: object
baseImage:
type: string
claims:
Expand Down Expand Up @@ -6610,6 +6622,10 @@ spec:
type: array
type: object
type: object
annotations:
additionalProperties:
type: string
type: object
baseImage:
type: string
claims:
Expand Down Expand Up @@ -8471,6 +8487,10 @@ spec:
type: array
type: object
type: object
annotations:
additionalProperties:
type: string
type: object
baseImage:
type: string
claims:
Expand Down
2 changes: 1 addition & 1 deletion deploy/kustomize/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: Kustomization
images:
- name: controller
newName: ghcr.io/linsoss/doris-operator
newTag: 1.0.3
newTag: 1.0.4

namespace: doris-operator-system
namePrefix: doris-operator-
Expand Down
22 changes: 21 additions & 1 deletion deploy/kustomize/kustomized.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1094,6 +1094,10 @@ spec:
type: array
type: object
type: object
annotations:
additionalProperties:
type: string
type: object
be:
properties:
additionalContainers:
Expand Down Expand Up @@ -2874,6 +2878,10 @@ spec:
type: array
type: object
type: object
annotations:
additionalProperties:
type: string
type: object
baseImage:
type: string
claims:
Expand Down Expand Up @@ -4760,6 +4768,10 @@ spec:
type: array
type: object
type: object
annotations:
additionalProperties:
type: string
type: object
baseImage:
type: string
claims:
Expand Down Expand Up @@ -6623,6 +6635,10 @@ spec:
type: array
type: object
type: object
annotations:
additionalProperties:
type: string
type: object
baseImage:
type: string
claims:
Expand Down Expand Up @@ -8484,6 +8500,10 @@ spec:
type: array
type: object
type: object
annotations:
additionalProperties:
type: string
type: object
baseImage:
type: string
claims:
Expand Down Expand Up @@ -9898,7 +9918,7 @@ spec:
- --leader-elect
command:
- /manager
image: ghcr.io/linsoss/doris-operator:1.0.3
image: ghcr.io/linsoss/doris-operator:1.0.4
livenessProbe:
httpGet:
path: /healthz
Expand Down
2 changes: 1 addition & 1 deletion website/config/_default/params.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# last doris images version
last_doris_image_version: "2.0.3"
# last doris operator version
last_doris_operator_version: "1.0.3"
last_doris_operator_version: "1.0.4"


# Images (@hyas/images)
Expand Down

0 comments on commit 746030e

Please sign in to comment.