Skip to content

Commit

Permalink
Merge branch 'main' into support/qdrant-enhancement
Browse files Browse the repository at this point in the history
  • Loading branch information
iziang committed Jun 24, 2023
2 parents d5e0fcd + bddd6e7 commit efebb19
Show file tree
Hide file tree
Showing 170 changed files with 7,129 additions and 4,028 deletions.
17 changes: 7 additions & 10 deletions .github/workflows/cicd-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,45 +95,42 @@ jobs:
name: check image
needs: trigger-mode
if: contains(needs.trigger-mode.outputs.trigger-mode, '[docker]')
uses: apecloud/apecloud-cd/.github/workflows/release-image.yml@v0.1.0
uses: apecloud/apecloud-cd/.github/workflows/release-image-check.yml@v0.1.2
with:
MAKE_OPS_PRE: "generate"
MAKE_OPS: "build-manager-image"
IMG: "apecloud/kubeblocks"
VERSION: "check"
GO_VERSION: "1.20"
BUILDX_PLATFORMS: "linux/amd64"
SYNC_ENABLE: false
APECD_REF: "v0.1.0"
APECD_REF: "v0.1.2"
secrets: inherit

check-tools-image:
name: check image
needs: trigger-mode
if: contains(needs.trigger-mode.outputs.trigger-mode, '[docker]')
uses: apecloud/apecloud-cd/.github/workflows/release-image.yml@v0.1.0
uses: apecloud/apecloud-cd/.github/workflows/release-image-check.yml@v0.1.2
with:
MAKE_OPS_PRE: "generate"
MAKE_OPS: "build-tools-image"
IMG: "apecloud/kubeblocks-tools"
VERSION: "check"
GO_VERSION: "1.20"
BUILDX_PLATFORMS: "linux/amd64"
SYNC_ENABLE: false
APECD_REF: "v0.1.0"
APECD_REF: "v0.1.2"
secrets: inherit

check-helm:
name: check helm
needs: trigger-mode
if: contains(needs.trigger-mode.outputs.trigger-mode, '[deploy]')
uses: apecloud/apecloud-cd/.github/workflows/release-charts.yml@v0.1.0
uses: apecloud/apecloud-cd/.github/workflows/release-charts-check.yml@v0.1.4
with:
MAKE_OPS: "bump-chart-ver"
VERSION: "v0.4.0-check"
CHART_NAME: "kubeblocks"
CHART_DIR: "deploy/helm"
PUSH_ENABLE: false
DEP_REPO: "helm dep update deploy/delphic"
APECD_REF: "v0.1.0"
DEP_REPO: "delphic"
APECD_REF: "v0.1.4"
secrets: inherit
18 changes: 8 additions & 10 deletions .github/workflows/cicd-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
trigger-mode: ${{ steps.get_trigger_mode.outputs.trigger_mode }}
steps:
- name: Cancel Previous Runs
if: github.ref_name != 'main'
uses: styfle/cancel-workflow-action@0.11.0
with:
all_but_latest: true
Expand Down Expand Up @@ -187,45 +188,42 @@ jobs:
check-image:
needs: trigger-mode
if: ${{ contains(needs.trigger-mode.outputs.trigger-mode, '[docker]') }}
uses: apecloud/apecloud-cd/.github/workflows/release-image.yml@v0.1.0
uses: apecloud/apecloud-cd/.github/workflows/release-image-check.yml@v0.1.2
with:
MAKE_OPS_PRE: "generate"
MAKE_OPS: "build-manager-image"
IMG: "apecloud/kubeblocks"
VERSION: "check"
GO_VERSION: "1.20"
BUILDX_PLATFORMS: "linux/amd64"
SYNC_ENABLE: false
APECD_REF: "v0.1.0"
APECD_REF: "v0.1.2"
secrets: inherit

check-tools-image:
needs: trigger-mode
if: ${{ contains(needs.trigger-mode.outputs.trigger-mode, '[docker]') }}
uses: apecloud/apecloud-cd/.github/workflows/release-image.yml@v0.1.0
uses: apecloud/apecloud-cd/.github/workflows/release-image-check.yml@v0.1.2
with:
MAKE_OPS_PRE: "generate"
MAKE_OPS: "build-tools-image"
IMG: "apecloud/kubeblocks-tools"
VERSION: "check"
GO_VERSION: "1.20"
BUILDX_PLATFORMS: "linux/amd64"
SYNC_ENABLE: false
APECD_REF: "v0.1.0"
APECD_REF: "v0.1.2"
secrets: inherit

check-helm:
needs: trigger-mode
if: ${{ contains(needs.trigger-mode.outputs.trigger-mode, '[deploy]') }}
uses: apecloud/apecloud-cd/.github/workflows/release-charts.yml@v0.1.0
uses: apecloud/apecloud-cd/.github/workflows/release-charts-check.yml@v0.1.4
with:
MAKE_OPS: "bump-chart-ver"
VERSION: "v0.4.0-check"
CHART_NAME: "kubeblocks"
CHART_DIR: "deploy/helm"
PUSH_ENABLE: false
DEP_REPO: "helm dep update deploy/delphic"
APECD_REF: "v0.1.0"
DEP_REPO: "delphic"
APECD_REF: "v0.1.4"
secrets: inherit

deploy-kubeblocks-io:
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ on:
- cron: '0 0 * * *'
push:
branches: [ "main", release-*, releasing-* ]
pull_request:
branches: [ "main", release-*, releasing-* ]

env:
BASE_BRANCH: origin/main
Expand All @@ -18,6 +16,13 @@ jobs:
outputs:
trigger-mode: ${{ steps.get_trigger_mode.outputs.trigger_mode }}
steps:
- name: Cancel Previous Runs
if: ${{ github.event_name == 'pull_request' || github.event_name == 'push' }}
uses: styfle/cancel-workflow-action@0.11.0
with:
all_but_latest: true
access_token: ${{ github.token }}

- uses: actions/checkout@v3
with:
fetch-depth: 0
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/e2e-kbcli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: E2E Test KBCLI

on:
workflow_dispatch:
inputs:
CLUSTER_VERSION:
description: 'eks cluster version (e.g. 1.25)'
required: false
default: '1.25'
INSTANCE_TYPE:
description: 'node instance types (e.g. amd64/arm64)'
required: false
default: 'amd64'
VERSION:
description: 'kubeblocks release version'
required: false
default: 'latest'
BRANCH_NAME:
description: 'testinfra branch name'
required: false
default: 'main'

run-name: kbcli:${{ inputs.KB_VERSION }} k8s:${{ inputs.CLUSTER_VERSION }}:${{ inputs.INSTANCE_TYPE }}

jobs:
eks:
uses: apecloud/apecloud-cd/.github/workflows/kbcli-test-eks.yml@v0.1.3
with:
CLUSTER_VERSION: "${{ inputs.KB_VERSION }}"
INSTANCE_TYPE: "${{ inputs.INSTANCE_TYPE }}"
KB_VERSION: "${{ inputs.VERSION }}"
BRANCH_NAME: "${{ inputs.BRANCH_NAME }}"
APECD_REF: "v0.1.3"
secrets: inherit
16 changes: 16 additions & 0 deletions .github/workflows/release-helm-chart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,18 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: send message
id: send_message
run: |
release_result="${{ env.RELEASE_VERSION }}-chart"
touch ${release_result}
echo 'release-result='${release_result} >> $GITHUB_OUTPUT
CONTENT="release\u00a0${{ env.RELEASE_VERSION }}\u00a0chart\u00a0error"
if [[ "${{ needs.release-chart.result }}" == "success" ]]; then
CONTENT="release\u00a0${{ env.RELEASE_VERSION }}\u00a0chart\u00a0success"
echo "success" > ${release_result}
else
echo "error" > ${release_result}
fi
bash .github/utils/utils.sh --type 12 \
Expand All @@ -63,4 +71,12 @@ jobs:
--bot-webhook ${{ env.RELEASE_BOT_WEBHOOK }} \
--run-url "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
- name: Save Artifact
id: cache-artifact-save
uses: actions/cache/save@v3
with:
path: |
${{ steps.send_message.outputs.release-result }}
key: ${{ steps.send_message.outputs.release-result }}


50 changes: 50 additions & 0 deletions .github/workflows/release-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,64 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: send message
id: send_message
run: |
release_result="${{ env.RELEASE_VERSION }}-image"
touch ${release_result}
echo 'release-result='${release_result} >> $GITHUB_OUTPUT
CONTENT="release\u00a0${{ env.RELEASE_VERSION }}\u00a0image\u00a0error"
if [[ "${{ needs.release-image.result }}" == "success" && "${{ needs.release-tools-image.result }}" == "success" ]]; then
CONTENT="release\u00a0${{ env.RELEASE_VERSION }}\u00a0image\u00a0success"
echo "success" > ${release_result}
else
echo "error" > ${release_result}
fi
bash .github/utils/utils.sh --type 12 \
--tag-name ${{ env.RELEASE_VERSION }} \
--content "${CONTENT}"\
--bot-webhook ${{ env.RELEASE_BOT_WEBHOOK }} \
--run-url "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
- name: Save Artifact
id: cache-artifact-save
uses: actions/cache/save@v3
with:
path: |
${{ steps.send_message.outputs.release-result }}
key: ${{ steps.send_message.outputs.release-result }}

release-result:
if: github.event.action == 'published'
needs: [ send-message ]
runs-on: ubuntu-latest
strategy:
matrix:
type: [image, kbcli, chart]
steps:
- name: Restore ${{ matrix.type }} Artifact
id: cache-artifact-restore
uses: actions/cache/restore@v3
with:
path: |
${{ env.RELEASE_VERSION }}-${{ matrix.type }}
key: ${{ env.RELEASE_VERSION }}-${{ matrix.type }}

- name: check release result
run: |
release_result=$( cat ${{ env.RELEASE_VERSION }}-${{ matrix.type }} )
if [[ "$release_result" != "success" ]]; then
exit 1
fi
e2e-kbcli:
needs: [ image-tag, release-result ]
uses: apecloud/apecloud-cd/.github/workflows/trigger-workflow.yml@v0.1.4
with:
GITHUB_REPO: "apecloud/kubeblocks"
BRANCH_NAME: "main"
WORKFLOW_ID: "e2e-kbcli.yml"
APECD_REF: "v0.1.4"
VERSION: "${{ needs.image-tag.outputs.tag-name }}"
secrets: inherit
17 changes: 17 additions & 0 deletions .github/workflows/release-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,30 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: send message
id: send_message
run: |
release_result="${{ env.TAG_NAME }}-kbcli"
touch ${release_result}
echo 'release-result='${release_result} >> $GITHUB_OUTPUT
CONTENT="release\u00a0${{ env.TAG_NAME }}\u00a0kbcli\u00a0error"
if [[ "${{ needs.upload-release-assert.result }}" == "success" ]]; then
CONTENT="release\u00a0${{ env.TAG_NAME }}\u00a0kbcli\u00a0success"
echo "success" > ${release_result}
else
echo "error" > ${release_result}
fi
bash .github/utils/utils.sh --type 12 \
--tag-name ${{ env.TAG_NAME }} \
--content "${CONTENT}"\
--bot-webhook ${{ env.RELEASE_BOT_WEBHOOK }} \
--run-url "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
- name: Save Artifact
id: cache-artifact-save
uses: actions/cache/save@v3
with:
path: |
${{ steps.send_message.outputs.release-result }}
key: ${{ steps.send_message.outputs.release-result }}
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ VERSION ?= 0.5.0-alpha.0
GITHUB_PROXY ?=
GIT_COMMIT = $(shell git rev-list -1 HEAD)
GIT_VERSION = $(shell git describe --always --abbrev=0 --tag)

GENERATED_CLIENT_PKG = "pkg/client"
# Setting SHELL to bash allows bash commands to be executed by recipes.
# This is a requirement for 'setup-envtest.sh' in the test target.
# Options are set to exit when a recipe line exits non-zero or a piped command fails.
Expand Down Expand Up @@ -156,7 +156,7 @@ test-go-generate: ## Run go generate against test code.

.PHONY: fmt
fmt: ## Run go fmt against code.
$(GOFMT) -l -w -s $$(git ls-files --exclude-standard | grep "\.go$$")
$(GOFMT) -l -w -s $$(git ls-files --exclude-standard | grep "\.go$$" | grep -v $(GENERATED_CLIENT_PKG))

.PHONY: vet
vet: ## Run go vet against code.
Expand Down Expand Up @@ -247,7 +247,7 @@ endif

.PHONY: goimports
goimports: goimportstool ## Run goimports against code.
$(GOIMPORTS) -local github.com/apecloud/kubeblocks -w $$(git ls-files|grep "\.go$$")
$(GOIMPORTS) -local github.com/apecloud/kubeblocks -w $$(git ls-files|grep "\.go$$" | grep -v $(GENERATED_CLIENT_PKG))


##@ CLI
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# KubeBlocks

[![Build status](https://github.com/apecloud/kubeblocks/workflows/CICD-PUSH/badge.svg)](https://github.com/apecloud/kubeblocks/actions/workflows/cicd-push.yml)
[![Documentation status](https://github.com/apecloud/kubeblocks.io/workflows/Documentation/badge.svg)](https://kubeblocks.io)
[![Go Report Card](https://goreportcard.com/badge/github.com/apecloud/kubeblocks)](https://goreportcard.com/report/github.com/apecloud/kubeblocks)
[![Docker Pulls](https://img.shields.io/docker/pulls/apecloud/kubeblocks)](https://hub.docker.com/r/apecloud/kubeblocks)
[![codecov](https://codecov.io/gh/apecloud/kubeblocks/branch/main/graph/badge.svg?token=GEH4I1C80Y)](https://codecov.io/gh/apecloud/kubeblocks)
[![LICENSE](https://img.shields.io/github/license/apecloud/kubeblocks.svg?style=flat-square)](/LICENSE)
[![Releases](https://img.shields.io/github/v/release/apecloud/kubeblocks)](https://github.com/apecloud/kubeblocks/releases/latest)
[![Artifact HUB](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/apecloud)](https://artifacthub.io/packages/search?repo=apecloud)
![maturity](https://img.shields.io/static/v1?label=maturity&message=alpha&color=red)

![image](./docs/img/banner-readme.png)

Expand Down
9 changes: 7 additions & 2 deletions apis/apps/v1alpha1/backuppolicytemplate_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,14 @@ type BackupStatusUpdate struct {
// +optional
Script string `json:"script,omitempty"`

// when to update the backup status, pre: before backup, post: after backup
// useTargetPodServiceAccount defines whether this job requires the service account of the backup target pod.
// if true, will use the service account of the backup target pod. otherwise, will use the system service account.
// +optional
UpdateStage BackupStatusUpdateStage `json:"updateStage,omitempty"`
UseTargetPodServiceAccount bool `json:"useTargetPodServiceAccount,omitempty"`

// when to update the backup status, pre: before backup, post: after backup
// +kubebuilder:validation:Required
UpdateStage BackupStatusUpdateStage `json:"updateStage"`
}

// BackupPolicyTemplateStatus defines the observed state of BackupPolicyTemplate
Expand Down
30 changes: 16 additions & 14 deletions apis/apps/v1alpha1/opsrequest_conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,22 @@ const (

// condition and event reasons

ReasonReconfigureMerging = "ReconfigureMerging"
ReasonReconfigureMerged = "ReconfigureMerged"
ReasonReconfigureFailed = "ReconfigureFailed"
ReasonReconfigureNoChanged = "ReconfigureNoChanged"
ReasonReconfigureSucceed = "ReconfigureSucceed"
ReasonReconfigureRunning = "ReconfigureRunning"
ReasonClusterPhaseMismatch = "ClusterPhaseMismatch"
ReasonOpsTypeNotSupported = "OpsTypeNotSupported"
ReasonValidateFailed = "ValidateFailed"
ReasonClusterNotFound = "ClusterNotFound"
ReasonOpsRequestFailed = "OpsRequestFailed"
ReasonOpsCanceling = "Canceling"
ReasonOpsCancelFailed = "CancelFailed"
ReasonOpsCancelSucceed = "CancelSucceed"
ReasonReconfigureMerging = "ReconfigureMerging"
ReasonReconfigureMerged = "ReconfigureMerged"
ReasonReconfigureFailed = "ReconfigureFailed"
ReasonReconfigureRestartFailed = "ReconfigureRestartFailed"
ReasonReconfigureRestart = "ReconfigureRestarted"
ReasonReconfigureNoChanged = "ReconfigureNoChanged"
ReasonReconfigureSucceed = "ReconfigureSucceed"
ReasonReconfigureRunning = "ReconfigureRunning"
ReasonClusterPhaseMismatch = "ClusterPhaseMismatch"
ReasonOpsTypeNotSupported = "OpsTypeNotSupported"
ReasonValidateFailed = "ValidateFailed"
ReasonClusterNotFound = "ClusterNotFound"
ReasonOpsRequestFailed = "OpsRequestFailed"
ReasonOpsCanceling = "Canceling"
ReasonOpsCancelFailed = "CancelFailed"
ReasonOpsCancelSucceed = "CancelSucceed"
)

func (r *OpsRequest) SetStatusCondition(condition metav1.Condition) {
Expand Down
Loading

0 comments on commit efebb19

Please sign in to comment.