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

update active standby image references and timeout #3205

Merged
merged 5 commits into from
Jul 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ CHART_TESTING_VERSION = v3.6.0
KIND_IMAGE = kindest/node:v1.23.6@sha256:b1fa224cc6c7ff32455e0b1fd9cbfd3d3bc87ecaa8fcb06961ed1afb3db0f9ae
TESTS = [nginx,api,features-kubernetes,bulk-deployment,features-kubernetes-2,features-api-variables,active-standby-kubernetes,tasks,drush,drupal-php80,drupal-postgres,python,gitlab,github,bitbucket,node-mongodb,elasticsearch,workflows]
CHARTS_TREEISH = "main"
TASK_IMAGES = task-activestandby

# Symlink the installed kubectl client if the correct version is already
# installed, otherwise downloads it.
Expand Down Expand Up @@ -643,6 +644,7 @@ kind/test: kind/cluster helm/repos $(addprefix local-dev/,$(KIND_TOOLS)) $(addpr
HELM=$$(realpath ../local-dev/helm) KUBECTL=$$(realpath ../local-dev/kubectl) \
JQ=$$(realpath ../local-dev/jq) \
OVERRIDE_BUILD_DEPLOY_DIND_IMAGE=$$IMAGE_REGISTRY/kubectl-build-deploy-dind:$(SAFE_BRANCH_NAME) \
OVERRIDE_ACTIVE_STANDBY_TASK_IMAGE=$$IMAGE_REGISTRY/task-activestandby:$(SAFE_BRANCH_NAME) \
IMAGE_REGISTRY=$$IMAGE_REGISTRY \
SKIP_INSTALL_REGISTRY=true \
LAGOON_FEATURE_FLAG_DEFAULT_ISOLATION_NETWORK_POLICY=enabled \
Expand Down Expand Up @@ -674,6 +676,7 @@ kind/setup: kind/cluster helm/repos $(addprefix local-dev/,$(KIND_TOOLS)) $(addp
HELM=$$(realpath ../local-dev/helm) KUBECTL=$$(realpath ../local-dev/kubectl) \
JQ=$$(realpath ../local-dev/jq) \
OVERRIDE_BUILD_DEPLOY_DIND_IMAGE=$$IMAGE_REGISTRY/kubectl-build-deploy-dind:$(SAFE_BRANCH_NAME) \
OVERRIDE_ACTIVE_STANDBY_TASK_IMAGE=$$IMAGE_REGISTRY/task-activestandby:$(SAFE_BRANCH_NAME) \
IMAGE_REGISTRY=$$IMAGE_REGISTRY

# kind/local-dev-patch will build the services in LOCAL_DEV_SERVICES on your machine, and then use kubectl patch to mount the folders into Kubernetes
Expand Down Expand Up @@ -726,10 +729,11 @@ kind/dev: $(addprefix build/,$(KIND_SERVICES))
HELM=$$(realpath ../local-dev/helm) KUBECTL=$$(realpath ../local-dev/kubectl) \
JQ=$$(realpath ../local-dev/jq) \
OVERRIDE_BUILD_DEPLOY_DIND_IMAGE=$$IMAGE_REGISTRY/kubectl-build-deploy-dind:$(SAFE_BRANCH_NAME) \
OVERRIDE_ACTIVE_STANDBY_TASK_IMAGE=$$IMAGE_REGISTRY/task-activestandby:$(SAFE_BRANCH_NAME) \
IMAGE_REGISTRY=$$IMAGE_REGISTRY

# kind/push-images pushes locally build images into the kind cluster registry.
IMAGES = $(KIND_SERVICES) $(LOCAL_DEV_SERVICES)
IMAGES = $(KIND_SERVICES) $(LOCAL_DEV_SERVICES) $(TASK_IMAGES)
.PHONY: kind/push-images
kind/push-images:
export KUBECONFIG="$$(pwd)/kubeconfig.kind.$(CI_BUILD_TAG)" && \
Expand Down Expand Up @@ -767,6 +771,7 @@ kind/retest:
HELM=$$(realpath ../local-dev/helm) KUBECTL=$$(realpath ../local-dev/kubectl) \
JQ=$$(realpath ../local-dev/jq) \
OVERRIDE_BUILD_DEPLOY_DIND_IMAGE=$$IMAGE_REGISTRY/kubectl-build-deploy-dind:$(SAFE_BRANCH_NAME) \
OVERRIDE_ACTIVE_STANDBY_TASK_IMAGE=$$IMAGE_REGISTRY/task-activestandby:$(SAFE_BRANCH_NAME) \
IMAGE_REGISTRY=$$IMAGE_REGISTRY \
SKIP_ALL_DEPS=true \
LAGOON_FEATURE_FLAG_DEFAULT_ISOLATION_NETWORK_POLICY=enabled \
Expand Down
5 changes: 1 addition & 4 deletions node-packages/commons/src/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1182,11 +1182,8 @@ export const createMiscTask = async function(taskData: any) {
} else if (overwriteActiveStandbyTaskImage) {
// allow to overwrite the image we use via OVERWRITE_ACTIVESTANDBY_TASK_IMAGE env variable
taskImage = overwriteActiveStandbyTaskImage
} else if (lagoonEnvironmentType == 'production') {
taskImage = `amazeeio/task-activestandby:${lagoonVersion}`
} else {
// we are a development enviornment, use the amazeeiolagoon image with the same branch name
taskImage = `amazeeiolagoon/task-activestandby:${lagoonGitSafeBranch}`
taskImage = `uselagoon/task-activestandby:${lagoonVersion}`
}
miscTaskData.advancedTask.runnerImage = taskImage
// miscTaskData.advancedTask.runnerImage = "shreddedbacon/runner:latest"
Expand Down
11 changes: 6 additions & 5 deletions taskimages/activestandby/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ func main() {
}

// check the status of the crd until we have the status conditions.
// otherwise give up after 10 minutes. 60 retries, 10 seconds apart.
try.MaxRetries = 60
// otherwise give up after 30 minutes. 180 retries, 10 seconds apart.
try.MaxRetries = 180
err = try.Do(func(attempt int) (bool, error) {
var err error
if err := c.Get(context.Background(), types.NamespacedName{
Expand Down Expand Up @@ -211,16 +211,17 @@ Provide a copy of this entire log to the team.`, err)
fmt.Printf("Task failed, error was: no spec found in resource")
os.Exit(1)
}
fmt.Printf("Task current status is %s, retrying check", mapval["type"].(string))
}
}
}
// sleep for 5 seconds up to a maximum of 60 times (5 minutes) before finally giving up
// sleep for 10 seconds up to a maximum of 180 times (30 minutes) before finally giving up
time.Sleep(10 * time.Second)
err = fmt.Errorf("status condition not met yet")
return attempt < 60, err
return attempt < 180, err
})
if err != nil {
fmt.Printf("Task failed, timed out after 10 minutes waiting for the job to start: %v", err)
fmt.Printf("Task failed, timed out after 30 minutes waiting for the job to start: %v", err)
os.Exit(1)
}
}