Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(controller): add canary steps plugin #3521

Merged
merged 50 commits into from
Aug 8, 2024
Merged
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
031a885
making code for step plugin
agaudreault Apr 5, 2024
78b42de
Merge remote-tracking branch 'upstream/master' into step-plugin
agaudreault Apr 5, 2024
0d4da53
Merge remote-tracking branch 'upstream/master' into step-plugin
agaudreault Apr 9, 2024
fc18d4b
codegen
agaudreault Apr 10, 2024
2d0513d
unit tests
agaudreault Apr 10, 2024
da408a0
rpc tests
agaudreault Apr 10, 2024
2169e35
add rpc plugin tests
agaudreault Apr 10, 2024
c76da2d
better message
agaudreault Apr 10, 2024
e61ca78
add order test
agaudreault Apr 10, 2024
129ff0c
implement terminate
agaudreault Apr 10, 2024
b610112
Terminate tests
agaudreault Apr 12, 2024
0db60ea
aborted logic + some unit test
agaudreault Apr 12, 2024
67e1f32
unit test
agaudreault Apr 15, 2024
37171bd
abort test
agaudreault Apr 15, 2024
c6e2a98
load plugin
agaudreault Apr 15, 2024
790bc1b
more tests
agaudreault Apr 15, 2024
c25ce26
dont use newStatus
agaudreault Apr 15, 2024
5ed7955
codegen preserve fields
agaudreault Apr 15, 2024
a0c30c9
some test before full promote problem
agaudreault Apr 18, 2024
db17cb5
fix full promotion
agaudreault Apr 18, 2024
5dedcc2
fix plugins
agaudreault Apr 18, 2024
ce17794
codegen
agaudreault Apr 18, 2024
0cc4d71
add disabled rollout
agaudreault Apr 19, 2024
c007efa
codegen
agaudreault Apr 19, 2024
dfeab0b
fix duration cast
agaudreault Apr 19, 2024
bcb39ad
refactor to use context object
agaudreault Apr 20, 2024
dcc9d93
adding debug logs.
agaudreault Apr 20, 2024
628237c
need to adjust the backoff on each reconcile
agaudreault Apr 20, 2024
13e8829
fix e2e
agaudreault Apr 20, 2024
e3a1a3d
unit test
agaudreault Apr 22, 2024
3b58d77
fix abort and promote logic
agaudreault Apr 29, 2024
97b8a8e
fix aborted rollout do not retry
agaudreault Apr 30, 2024
5761697
add event
agaudreault Apr 30, 2024
ae4e504
change enabled to status
agaudreault May 1, 2024
9d81110
unit tests
agaudreault May 1, 2024
c776330
more test
agaudreault May 1, 2024
aa37238
cleanup
agaudreault May 1, 2024
4866c0c
add docs
agaudreault May 1, 2024
d8b5171
docs
agaudreault May 1, 2024
2a05ea0
Merge remote-tracking branch 'upstream/master' into step-plugin
agaudreault May 1, 2024
a4331ab
makefile for e2e
agaudreault May 1, 2024
ee5195b
disable e2e when not configured
agaudreault May 1, 2024
b1d0963
Add some UI for the extension
agaudreault May 2, 2024
1fda169
Merge branch 'master' into step-plugin
agaudreault May 7, 2024
1a20837
Merge branch 'master' of github.com:argoproj/argo-rollouts into step-…
zachaller Jul 25, 2024
8bb0feb
Merge branch 'master' of github.com:argoproj/argo-rollouts into step-…
zachaller Jul 25, 2024
ef48f19
Merge branch 'master' of github.com:argoproj/argo-rollouts into step-…
zachaller Jul 29, 2024
941e8e0
Merge branch 'master' of github.com:argoproj/argo-rollouts into step-…
zachaller Aug 5, 2024
be995fb
Merge branch 'master' of github.com:argoproj/argo-rollouts into step-…
zachaller Aug 7, 2024
7459514
codegen
zachaller Aug 7, 2024
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
Prev Previous commit
Next Next commit
makefile for e2e
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
  • Loading branch information
agaudreault committed May 1, 2024
commit a4331ab9ab5d127a58662d4b1d6aeb29a90366b8
3 changes: 3 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -12,9 +12,12 @@ FROM gcr.io/distroless/static-debian11

COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY rollouts-controller-linux-amd64 /bin/rollouts-controller
COPY step-plugin-e2e-linux-amd64 /bin/plugin-files/step-plugin-e2e

# Use numeric user, allows kubernetes to identify this user as being
# non-root when we use a security context with runAsNonRoot: true
USER 999

WORKDIR /home/argo-rollouts

ENTRYPOINT [ "/bin/rollouts-controller" ]
25 changes: 13 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -12,9 +12,12 @@ GIT_TREE_STATE=$(shell if [ -z "`git status --porcelain`" ]; then echo "clean" ;
GIT_REMOTE_REPO=upstream
VERSION=$(shell if [ ! -z "${GIT_TAG}" ] ; then echo "${GIT_TAG}" | sed -e "s/^v//" ; else cat VERSION ; fi)


TARGET_ARCH?=linux/amd64

# docker image publishing options
DOCKER_PUSH=false
IMAGE_TAG=latest
DOCKER_PUSH ?= false
IMAGE_TAG ?= latest
# build development images
DEV_IMAGE ?= false

@@ -204,10 +207,11 @@ builder-image: ## build builder image
.PHONY: image
image:
ifeq ($(DEV_IMAGE), true)
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -ldflags '${LDFLAGS}' -o ${DIST_DIR}/step-plugin-e2e-linux-amd64 ./test/cmd/step-plugin-e2e
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -ldflags '${LDFLAGS}' -o ${DIST_DIR}/rollouts-controller-linux-amd64 ./cmd/rollouts-controller
DOCKER_BUILDKIT=1 docker build -t $(IMAGE_PREFIX)argo-rollouts:$(IMAGE_TAG) -f Dockerfile.dev ${DIST_DIR}
DOCKER_BUILDKIT=1 docker build --platform=$(TARGET_ARCH) -t $(IMAGE_PREFIX)argo-rollouts:$(IMAGE_TAG) -f Dockerfile.dev ${DIST_DIR}
else
DOCKER_BUILDKIT=1 docker build -t $(IMAGE_PREFIX)argo-rollouts:$(IMAGE_TAG) .
DOCKER_BUILDKIT=1 docker build --platform=$(TARGET_ARCH) -t $(IMAGE_PREFIX)argo-rollouts:$(IMAGE_TAG) .
endif
@if [ "$(DOCKER_PUSH)" = "true" ] ; then docker push $(IMAGE_PREFIX)argo-rollouts:$(IMAGE_TAG) ; fi

@@ -228,7 +232,7 @@ build-sample-step-plugin-debug: ## build sample traffic plugin with debug info

.PHONY: plugin-image
plugin-image: ## build plugin image
DOCKER_BUILDKIT=1 docker build --target kubectl-argo-rollouts -t $(IMAGE_PREFIX)kubectl-argo-rollouts:$(IMAGE_TAG) .
DOCKER_BUILDKIT=1 docker build --platform=$(TARGET_ARCH) --target kubectl-argo-rollouts -t $(IMAGE_PREFIX)kubectl-argo-rollouts:$(IMAGE_TAG) .
if [ "$(DOCKER_PUSH)" = "true" ] ; then docker push $(IMAGE_PREFIX)kubectl-argo-rollouts:$(IMAGE_TAG) ; fi

##@ Test
@@ -241,14 +245,11 @@ test: test-kustomize ## run all tests
test-kustomize: ## run kustomize tests
./test/kustomize/test.sh

step-plugin-e2e-setup:
@rm -rf plugin-bin
@go build -gcflags="all=-N -l" -o plugin-bin/e2e-step-plugin test/cmd/step-plugin-e2e/main.go
setup-e2e:
@kubectl apply --context='${E2E_K8S_CONTEXT}' -f manifests/crds/rollout-crd.yaml
@kubectl apply --context='${E2E_K8S_CONTEXT}' -n argo-rollouts -f test/e2e/step-plugin/argo-rollouts-config.yaml

step-plugin-e2e-run:
${DIST_DIR}/gotestsum --rerun-fails-report=rerunreport.txt --junitfile=junit.xml --format=testname --packages="./test/e2e" --rerun-fails=0 -- -timeout 60m -count 1 --tags e2e -p ${E2E_PARALLEL} -parallel ${E2E_PARALLEL} -v --short ./test/e2e -run 'TestStepPluginSuite'
@rm -rf plugin-bin
@go build -gcflags="all=-N -l" -o plugin-bin/e2e-step-plugin test/cmd/step-plugin-e2e/main.go

.PHONY: start-e2e
start-e2e: ## start e2e test environment
@@ -259,7 +260,7 @@ test-e2e: install-devtools-local
${DIST_DIR}/gotestsum --rerun-fails-report=rerunreport.txt --junitfile=junit.xml --format=testname --packages="./test/e2e" --rerun-fails=5 -- -timeout 60m -count 1 --tags e2e -p ${E2E_PARALLEL} -parallel ${E2E_PARALLEL} -v --short ./test/e2e ${E2E_TEST_OPTIONS}

.PHONY: test-unit
test-unit: install-devtools-local ## run unit tests
test-unit: install-devtools-local ## run unit tests
${DIST_DIR}/gotestsum --junitfile=junit.xml --format=testname -- -covermode=count -coverprofile=coverage.out `go list ./... | grep -v ./test/cmd/metrics-plugin-sample`


4 changes: 3 additions & 1 deletion rollout/steps/plugin/plugin.go
Original file line number Diff line number Diff line change
@@ -41,7 +41,6 @@
defaultErrorBackoff = time.Second * 30
)

// Run exectues a plugin
func (p *stepPlugin) Run(rollout *v1alpha1.Rollout) (*v1alpha1.StepPluginStatus, error) {
stepStatus := p.getStepStatus(rollout, v1alpha1.StepPluginOperationRun)
if stepStatus == nil || stepStatus.Disabled {
@@ -56,17 +55,20 @@
}

if stepStatus.Phase == v1alpha1.StepPluginPhaseSuccessful || stepStatus.Phase == v1alpha1.StepPluginPhaseFailed {
// Already completed
return nil, nil

Check warning on line 59 in rollout/steps/plugin/plugin.go

Codecov / codecov/patch

rollout/steps/plugin/plugin.go#L59

Added line #L59 was not covered by tests
}

if stepStatus.Executions > 0 {
// If status existed, check the backoff to know if we are ready to retry.
// If we are not, return the status without modifying it.
backoff, err := stepStatus.Backoff.Duration()
if err != nil {
return nil, fmt.Errorf("could not parse backoff duration: %w", err)

Check warning on line 67 in rollout/steps/plugin/plugin.go

Codecov / codecov/patch

rollout/steps/plugin/plugin.go#L65-L67

Added lines #L65 - L67 were not covered by tests
}
if stepStatus.UpdatedAt.Add(backoff).After(metatime.Now()) {
p.log.Debug("skipping plugin Run due to backoff")
return stepStatus, nil

Check warning on line 71 in rollout/steps/plugin/plugin.go

Codecov / codecov/patch

rollout/steps/plugin/plugin.go#L69-L71

Added lines #L69 - L71 were not covered by tests
}
}

@@ -88,7 +90,7 @@
if resp.Phase != "" {
stepStatus.Phase = v1alpha1.StepPluginPhase(resp.Phase)
if err := stepStatus.Phase.Validate(); err != nil {
return nil, fmt.Errorf("could not validate rpc phase: %w", err)

Check warning on line 93 in rollout/steps/plugin/plugin.go

Codecov / codecov/patch

rollout/steps/plugin/plugin.go#L93

Added line #L93 was not covered by tests
}
}

@@ -148,7 +150,7 @@
if resp.Phase != "" {
terminateStatus.Phase = v1alpha1.StepPluginPhase(resp.Phase)
if err := terminateStatus.Phase.Validate(); err != nil {
return nil, fmt.Errorf("could not validate rpc phase: %w", err)

Check warning on line 153 in rollout/steps/plugin/plugin.go

Codecov / codecov/patch

rollout/steps/plugin/plugin.go#L153

Added line #L153 was not covered by tests
}
}

@@ -198,7 +200,7 @@
if resp.Phase != "" {
abortStatus.Phase = v1alpha1.StepPluginPhase(resp.Phase)
if err := abortStatus.Phase.Validate(); err != nil {
return nil, fmt.Errorf("could not validate rpc phase: %w", err)

Check warning on line 203 in rollout/steps/plugin/plugin.go

Codecov / codecov/patch

rollout/steps/plugin/plugin.go#L203

Added line #L203 was not covered by tests
}
}

Loading