From 56206260afd9c1e86c1aa93170063d86f4339652 Mon Sep 17 00:00:00 2001 From: Michael Pleshakov Date: Fri, 15 Mar 2024 19:21:11 -0400 Subject: [PATCH] Enable Production Endpoint for Product Telemetry (#1699) Problem: Start sending product telemetry to the product F5 telemetry service. Solution: - Use the production telemetry endpoint in production NGF image, built using: - goreleaser - make commands from building the images doc - Introduce new targets in the Makefile for building prod images. Developer instructions for building NGF image remain unchanged, and such image will not send any telemetry, but will report it in the logs at the debug level. Testing: - Confirmed production NGF image built using make command sends telemetry. - Confirmed developer NGF image build using make command doesn't send any telemetry but reports it in the logs. CLOSES - https://github.com/nginxinc/nginx-gateway-fabric/issues/1563 --- .github/workflows/ci.yml | 2 +- Makefile | 27 ++++++++++++++----- .../ngf-images/building-the-images.md | 10 +++---- 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3c073c525d..ba03619638 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -156,7 +156,7 @@ jobs: AZURE_STORAGE_KEY: ${{ secrets.AZURE_STORAGE_KEY }} AZURE_BUCKET_NAME: ${{ secrets.AZURE_BUCKET_NAME }} SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_COMMUNITY }} - TELEMETRY_ENDPOINT: "" # disables sending telemetry + TELEMETRY_ENDPOINT: oss.edge.df.f5.com:443 TELEMETRY_ENDPOINT_INSECURE: "false" - name: Cache Artifacts diff --git a/Makefile b/Makefile index 2b625d4d81..36a1b9d5ce 100644 --- a/Makefile +++ b/Makefile @@ -8,14 +8,13 @@ NGINX_CONF_DIR = internal/mode/static/nginx/conf NJS_DIR = internal/mode/static/nginx/modules/src NGINX_DOCKER_BUILD_PLUS_ARGS = --secret id=nginx-repo.crt,src=nginx-repo.crt --secret id=nginx-repo.key,src=nginx-repo.key BUILD_AGENT=local -TELEMETRY_REPORT_PERIOD = 24h # also configured in goreleaser.yml -# FIXME(pleshakov) - TELEMETRY_ENDPOINT will have the default value of F5 telemetry service once we're ready -# to report. https://github.com/nginxinc/nginx-gateway-fabric/issues/1563 -# Also, we will need to set it in goreleaser.yml -TELEMETRY_ENDPOINT =# if empty, NGF will report telemetry in its logs at debug level. +PROD_TELEMETRY_ENDPOINT = oss.edge.df.f5.com:443 +# the telemetry related variables below are also configured in goreleaser.yml +TELEMETRY_REPORT_PERIOD = 24h +TELEMETRY_ENDPOINT=# if empty, NGF will report telemetry in its logs at debug level. +TELEMETRY_ENDPOINT_INSECURE = false -TELEMETRY_ENDPOINT_INSECURE = false # also configured in goreleaser.yml GW_API_VERSION = 1.0.0 INSTALL_WEBHOOK = false NODE_VERSION = $(shell cat .nvmrc) @@ -45,20 +44,36 @@ help: Makefile ## Display this help @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "; printf "Usage:\n\n make \033[36m\033[0m [VARIABLE=value...]\n\nTargets:\n\n"}; {printf " \033[36m%-30s\033[0m %s\n", $$1, $$2}' @grep -E '^(override )?[a-zA-Z_-]+ \??\+?= .*?## .*$$' $< | sort | awk 'BEGIN {FS = " \\??\\+?= .*?## "; printf "\nVariables:\n\n"}; {gsub(/override /, "", $$1); printf " \033[36m%-30s\033[0m %s\n", $$1, $$2}' +.PHONY: build-prod-images +build-prod-images: build-prod-ngf-image build-prod-nginx-image ## Build the NGF and nginx docker images for production + +.PHONY: build-prod-images-with-plus +build-prod-images-with-plus: build-prod-ngf-image build-prod-nginx-plus-image ## Build the NGF and NGINX Plus docker images for production + .PHONY: build-images build-images: build-ngf-image build-nginx-image ## Build the NGF and nginx docker images .PHONY: build-images-with-plus build-images-with-plus: build-ngf-image build-nginx-plus-image ## Build the NGF and NGINX Plus docker images +.PHONY: build-prod-ngf-image +build-prod-ngf-image: TELEMETRY_ENDPOINT=$(PROD_TELEMETRY_ENDPOINT) +build-prod-ngf-image: build-ngf-image ## Build the NGF docker image for production + .PHONY: build-ngf-image build-ngf-image: check-for-docker build ## Build the NGF docker image docker build --platform linux/$(GOARCH) --build-arg BUILD_AGENT=$(BUILD_AGENT) --target $(strip $(TARGET)) -f build/Dockerfile -t $(strip $(PREFIX)):$(strip $(TAG)) . +.PHONY: build-prod-nginx-image +build-prod-nginx-image: build-nginx-image ## Build the custom nginx image for production + .PHONY: build-nginx-image build-nginx-image: check-for-docker ## Build the custom nginx image docker build --platform linux/$(GOARCH) $(strip $(NGINX_DOCKER_BUILD_OPTIONS)) -f build/Dockerfile.nginx -t $(strip $(NGINX_PREFIX)):$(strip $(TAG)) . +.PHONY: build-prod-nginx-plus-image +build-prod-nginx-plus-image: build-nginx-plus-image ## Build the custom nginx plus image for production + .PHONY: build-nginx-plus-image build-nginx-plus-image: check-for-docker ## Build the custom nginx plus image docker build --platform linux/$(GOARCH) $(strip $(NGINX_DOCKER_BUILD_OPTIONS)) $(strip $(NGINX_DOCKER_BUILD_PLUS_ARGS)) -f build/Dockerfile.nginxplus -t $(strip $(NGINX_PLUS_PREFIX)):$(strip $(TAG)) . diff --git a/site/content/installation/ngf-images/building-the-images.md b/site/content/installation/ngf-images/building-the-images.md index 58b6975e6c..08d859b6b3 100644 --- a/site/content/installation/ngf-images/building-the-images.md +++ b/site/content/installation/ngf-images/building-the-images.md @@ -36,31 +36,31 @@ If building the NGINX Plus image, you will also need a valid NGINX Plus license - To build both the NGINX Gateway Fabric and NGINX images: ```makefile - make PREFIX=myregistry.example.com/nginx-gateway-fabric build-images + make PREFIX=myregistry.example.com/nginx-gateway-fabric build-prod-images ``` - To build both the NGINX Gateway Fabric and NGINX Plus images: ```makefile - make PREFIX=myregistry.example.com/nginx-gateway-fabric build-images-with-plus + make PREFIX=myregistry.example.com/nginx-gateway-fabric build-prod-images-with-plus ``` - To build just the NGINX Gateway Fabric image: ```makefile - make PREFIX=myregistry.example.com/nginx-gateway-fabric build-ngf-image + make PREFIX=myregistry.example.com/nginx-gateway-fabric build-prod-ngf-image ``` - To build just the NGINX image: ```makefile - make PREFIX=myregistry.example.com/nginx-gateway-fabric build-nginx-image + make PREFIX=myregistry.example.com/nginx-gateway-fabric build-prod-nginx-image ``` - To build just the NGINX Plus image: ```makefile - make PREFIX=/nginx-gateway-fabric/nginx-plus build-nginx-plus-image + make PREFIX=myregistry.example.com/nginx-gateway-fabric/nginx-plus build-prod-nginx-plus-image ``` Set the `PREFIX` variable to the name of the registry you'd like to push the image to. By default, the images will be