Feat: rollout controller is disabled by default (#3250)

* Feat: rollout controller is disabled by default

Signed-off-by: barnettZQG <barnett.zqg@gmail.com>

* Feat: change rollout image pull policy

Signed-off-by: barnettZQG <barnett.zqg@gmail.com>

* Fix: remove controller from the rollout addon in testdata

Signed-off-by: barnettZQG <barnett.zqg@gmail.com>

* Feat: rollout controller is disabled by default

Signed-off-by: barnettZQG <barnett.zqg@gmail.com>

* Fix: extended waiting time for the addon mock server

Signed-off-by: barnettZQG <barnett.zqg@gmail.com>
This commit is contained in:
barnettZQG 2022-02-16 14:25:04 +08:00 committed by GitHub
parent 4bae08c2e2
commit 3d0b9b7c71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 57 additions and 116 deletions

View File

@ -84,9 +84,8 @@ jobs:
- name: Cleanup for e2e tests
run: |
make e2e-cleanup
make e2e-setup-core
make vela-cli
make e2e-setup-core
bin/vela addon enable fluxcd
timeout 600s bash -c -- 'while true; do kubectl get ns flux-system; if [ $? -eq 0 ] ; then break; else sleep 5; fi;done'
kubectl wait --for=condition=Ready pod -l app.kubernetes.io/name=vela-core,app.kubernetes.io/instance=kubevela -n vela-system --timeout=600s

View File

@ -76,17 +76,13 @@ jobs:
- name: Load Image to kind cluster (Hub)
run: make kind-load
- name: Load Image to kind cluster (Worker)
run: |
make kind-load-runtime-cluster
- name: Cleanup for e2e tests
run: |
make e2e-cleanup
make vela-cli
make e2e-setup-core
make
make setup-runtime-e2e-cluster
make vela-cli
- name: Run e2e multicluster tests
run: |

View File

@ -83,7 +83,7 @@ endif
# load docker image to the kind cluster
kind-load:
kind-load: kind-load-runtime-cluster
docker build -t $(VELA_CORE_TEST_IMAGE) -f Dockerfile.e2e .
kind load docker-image $(VELA_CORE_TEST_IMAGE) || { echo >&2 "kind not installed or error loading image: $(VELA_CORE_TEST_IMAGE)"; exit 1; }
@ -91,6 +91,7 @@ kind-load-runtime-cluster:
/bin/sh hack/e2e/build_runtime_rollout.sh
docker build -t $(VELA_RUNTIME_ROLLOUT_TEST_IMAGE) -f runtime/rollout/e2e/Dockerfile.e2e runtime/rollout/e2e/
rm -rf runtime/rollout/e2e/tmp
kind load docker-image $(VELA_RUNTIME_ROLLOUT_TEST_IMAGE) || { echo >&2 "kind not installed or error loading image: $(VELA_RUNTIME_ROLLOUT_TEST_IMAGE)"; exit 1; }
kind load docker-image $(VELA_RUNTIME_ROLLOUT_TEST_IMAGE) --name=$(RUNTIME_CLUSTER_NAME) || { echo >&2 "kind not installed or error loading image: $(VELA_RUNTIME_ROLLOUT_TEST_IMAGE)"; exit 1; }
# Run tests

View File

@ -1,52 +0,0 @@
# Code generated by KubeVela templates. DO NOT EDIT. Please edit the original cue file.
# Definition source cue file: vela-templates/definitions/internal/rollout.cue
apiVersion: core.oam.dev/v1beta1
kind: TraitDefinition
metadata:
annotations:
definition.oam.dev/description: Rollout the component.
name: rollout
namespace: {{.Values.systemDefinitionNamespace}}
spec:
manageWorkload: true
schematic:
cue:
template: |
outputs: rollout: {
apiVersion: "standard.oam.dev/v1alpha1"
kind: "Rollout"
metadata: {
name: context.name
namespace: context.namespace
}
spec: {
if parameter.targetRevision != _|_ {
targetRevisionName: parameter.targetRevision
}
if parameter.targetRevision == _|_ {
targetRevisionName: context.revision
}
componentName: context.name
rolloutPlan: {
rolloutStrategy: "IncreaseFirst"
if parameter.rolloutBatches != _|_ {
rolloutBatches: parameter.rolloutBatches
}
targetSize: parameter.targetSize
if parameter["batchPartition"] != _|_ {
batchPartition: parameter.batchPartition
}
}
}
}
parameter: {
targetRevision?: string
targetSize: int
rolloutBatches?: [...rolloutBatch]
batchPartition?: int
}
rolloutBatch: replicas: int
status:
customStatus: 'message: context.outputs.rollout.status.rollingState'
healthPolicy: 'isHealth: context.outputs.rollout.status.batchRollingState == "batchReady"'

View File

@ -6,7 +6,7 @@ replicaCount: 1
# Valid applyOnceOnly values: true/false/on/off/force
applyOnceOnly: "off"
disableCaps: ""
disableCaps: "rollout"
imageRegistry: ""
image:

View File

@ -1,52 +0,0 @@
# Code generated by KubeVela templates. DO NOT EDIT. Please edit the original cue file.
# Definition source cue file: vela-templates/definitions/internal/rollout.cue
apiVersion: core.oam.dev/v1beta1
kind: TraitDefinition
metadata:
annotations:
definition.oam.dev/description: Rollout the component.
name: rollout
namespace: {{.Values.systemDefinitionNamespace}}
spec:
manageWorkload: true
schematic:
cue:
template: |
outputs: rollout: {
apiVersion: "standard.oam.dev/v1alpha1"
kind: "Rollout"
metadata: {
name: context.name
namespace: context.namespace
}
spec: {
if parameter.targetRevision != _|_ {
targetRevisionName: parameter.targetRevision
}
if parameter.targetRevision == _|_ {
targetRevisionName: context.revision
}
componentName: context.name
rolloutPlan: {
rolloutStrategy: "IncreaseFirst"
if parameter.rolloutBatches != _|_ {
rolloutBatches: parameter.rolloutBatches
}
targetSize: parameter.targetSize
if parameter["batchPartition"] != _|_ {
batchPartition: parameter.batchPartition
}
}
}
}
parameter: {
targetRevision?: string
targetSize: int
rolloutBatches?: [...rolloutBatch]
batchPartition?: int
}
rolloutBatch: replicas: int
status:
customStatus: 'message: context.outputs.rollout.status.rollingState'
healthPolicy: 'isHealth: context.outputs.rollout.status.batchRollingState == "batchReady"'

View File

@ -6,7 +6,7 @@ replicaCount: 1
# Valid applyOnceOnly values: true/false/on/off/force
applyOnceOnly: "off"
disableCaps: "manualscalertrait,containerizedwokrload,envbinding"
disableCaps: "manualscalertrait,containerizedwokrload,envbinding,rollout"
imageRegistry: ""
image:

View File

@ -44,9 +44,13 @@ template: {
}
parameter: {
// +usage=Specify the target revision, it should be set if you want to rollback. such as: componentname-v1
targetRevision?: string
targetSize: int
// +usage=Specify the count of replicas.
targetSize: int
// +usage=Specify the rollout batches, The total number of replicas of all batches needs to be equal to number of targetSize.
rolloutBatches?: [...rolloutBatch]
// +usage=Specify the batch partition in current deploying. It is used to control batch processes.
batchPartition?: int
}

View File

@ -0,0 +1,21 @@
name: rollout
version: 1.2.3
description: Provides basic batch publishing capability.
url: https://kubevela.io/docs/end-user/traits/rollout
tags:
- extended_workload
- rollout
deployTo:
runtimeCluster: true
dependencies:
# install controller by helm.
- name: fluxcd
# set invisible means this won't be list and will be enabled when depended on
# for example, terraform-alibaba depends on terraform which is invisible,
# when terraform-alibaba is enabled, terraform will be enabled automatically
# default: false
invisible: false

View File

@ -0,0 +1,7 @@
# Supported workload type
Rollout Trait supports following component types: webservice、worker and cloneset.
When using webservice/worker as Workload type with Rollout Trait, Workload's name will be controllerRevision's name. And when Workload's type is cloneset, because of clonset support in-place update Workload's name will always be component's name.

View File

@ -0,0 +1,10 @@
- jsonKey: batchPartition
sort: 1
- jsonKey: targetSize
sort: 3
- jsonKey: rolloutBatches
sort: 5
- jsonKey: targetRevision
sort: 7
validate:
pattern: ^[a-z0-9]+\-v\d{1,5}$

View File

@ -4,7 +4,10 @@ e2e-setup-core:
sh ./hack/e2e/modify_charts.sh
helm upgrade --install --create-namespace --namespace vela-system --set image.pullPolicy=IfNotPresent --set image.repository=vela-core-test --set applicationRevisionLimit=5 --set dependCheckWait=10s --set image.tag=$(GIT_COMMIT) --wait kubevela ./charts/vela-core
kubectl wait --for=condition=Available deployment/kubevela-vela-core -n vela-system --timeout=180s
helm upgrade --install --namespace vela-system --wait oam-rollout --set image.repository=vela-runtime-rollout-test --set image.tag=$(GIT_COMMIT) ./runtime/rollout/charts
go run ./e2e/addon/mock &
sleep 15
bin/vela addon enable rollout
.PHONY: setup-runtime-e2e-cluster
setup-runtime-e2e-cluster:
@ -16,10 +19,14 @@ e2e-setup:
sh ./hack/e2e/modify_charts.sh
helm upgrade --install --create-namespace --namespace vela-system --set image.pullPolicy=IfNotPresent --set image.repository=vela-core-test --set applicationRevisionLimit=5 --set dependCheckWait=10s --set image.tag=$(GIT_COMMIT) --wait kubevela ./charts/vela-core
helm upgrade --install --create-namespace --namespace oam-runtime-system --set image.pullPolicy=IfNotPresent --set image.repository=vela-core-test --set dependCheckWait=10s --set image.tag=$(GIT_COMMIT) --wait oam-runtime ./charts/oam-runtime
helm upgrade --install --namespace vela-system --wait oam-rollout --set image.repository=vela-runtime-rollout-test --set image.tag=$(GIT_COMMIT) ./runtime/rollout/charts
go run ./e2e/addon/mock &
sleep 15
bin/vela addon enable fluxcd
bin/vela addon enable terraform
bin/vela addon enable terraform-alibaba ALICLOUD_ACCESS_KEY=xxx ALICLOUD_SECRET_KEY=yyy ALICLOUD_REGION=cn-beijing
bin/vela addon enable rollout
ginkgo version
ginkgo -v -r e2e/setup

View File

@ -7,7 +7,7 @@ replicaCount: 1
image:
repository: oamdev/vela-rollout
tag: latest
pullPolicy: Always
pullPolicy: IfNotPresent
imagePullSecrets: []
nameOverride: ""