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

Add nil check for controller when agent is shutting down #357

Merged
merged 3 commits into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ oss-image: ## Build agent container image for NGINX OSS
@echo Building image with $(CONTAINER_CLITOOL); \
$(CONTAINER_BUILDENV) $(CONTAINER_CLITOOL) build -t ${IMAGE_TAG} . \
--no-cache -f ./scripts/docker/nginx-oss/${CONTAINER_OS_TYPE}/Dockerfile \
--target install-agent-local
--target install-agent-local \
--build-arg PACKAGE_NAME=${PACKAGE_NAME} \
--build-arg PACKAGES_REPO=${OSS_PACKAGES_REPO} \
--build-arg BASE_IMAGE=${BASE_IMAGE} \
Expand Down
6 changes: 4 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,10 @@ func handleSignals(
log.Errorf("Error sending AgentStopped event to command channel: %v", err)
}

if err := controller.Close(); err != nil {
log.Errorf("Unable to close controller: %v", err)
if controller != nil {
if err := controller.Close(); err != nil {
log.Errorf("Unable to close controller: %v", err)
dhurley marked this conversation as resolved.
Show resolved Hide resolved
}
}

log.Warn("NGINX Agent exiting")
Expand Down