Skip to content

Commit

Permalink
Set Registry to Azure if using us3 (#1438)
Browse files Browse the repository at this point in the history
  • Loading branch information
AliDatadog authored Oct 1, 2024
1 parent a798a7a commit 4befe2a
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 1 deletion.
1 change: 1 addition & 0 deletions api/datadoghq/v2alpha1/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ const (
DefaultAgentImageName string = "agent"
DefaultClusterAgentImageName string = "cluster-agent"
DefaultImageRegistry string = "gcr.io/datadoghq"
DefaultAzureImageRegistry string = "datadoghq.azurecr.io"
DefaultEuropeImageRegistry string = "eu.gcr.io/datadoghq"
DefaultAsiaImageRegistry string = "asia.gcr.io/datadoghq"
DefaultGovImageRegistry string = "public.ecr.aws/datadog"
Expand Down
3 changes: 3 additions & 0 deletions api/datadoghq/v2alpha1/datadogagent_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const (
defaultSite string = "datadoghq.com"
defaultEuropeSite string = "datadoghq.eu"
defaultAsiaSite string = "ap1.datadoghq.com"
defaultAzureSite string = "us3.datadoghq.com"
defaultGovSite string = "ddog-gov.com"
defaultLogLevel string = "info"

Expand Down Expand Up @@ -140,6 +141,8 @@ func defaultGlobalConfig(ddaSpec *DatadogAgentSpec) {
ddaSpec.Global.Registry = apiutils.NewStringPointer(DefaultEuropeImageRegistry)
case defaultAsiaSite:
ddaSpec.Global.Registry = apiutils.NewStringPointer(DefaultAsiaImageRegistry)
case defaultAzureSite:
ddaSpec.Global.Registry = apiutils.NewStringPointer(DefaultAzureImageRegistry)
case defaultGovSite:
ddaSpec.Global.Registry = apiutils.NewStringPointer(DefaultGovImageRegistry)
default:
Expand Down
15 changes: 15 additions & 0 deletions api/datadoghq/v2alpha1/datadogagent_default_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,21 @@ func Test_defaultGlobal(t *testing.T) {
},
},
},
{
name: "test registry defaulting based on site - Azure",
ddaSpec: &DatadogAgentSpec{
Global: &GlobalConfig{
Site: apiutils.NewStringPointer(defaultAzureSite),
},
},
want: &DatadogAgentSpec{
Global: &GlobalConfig{
Site: apiutils.NewStringPointer(defaultAzureSite),
Registry: apiutils.NewStringPointer(DefaultAzureImageRegistry),
LogLevel: apiutils.NewStringPointer(defaultLogLevel),
},
},
},
{
name: "test registry defaulting based on site - Gov",
ddaSpec: &DatadogAgentSpec{
Expand Down
4 changes: 4 additions & 0 deletions api/datadoghq/v2alpha1/datadogagent_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1158,6 +1158,10 @@ type GlobalConfig struct {

// Registry is the image registry to use for all Agent images.
// Use 'public.ecr.aws/datadog' for AWS ECR.
// Use 'datadoghq.azurecr.io' for Azure Container Registry.
// Use 'gcr.io/datadoghq' for Google Container Registry.
// Use 'eu.gcr.io/datadoghq' for Google Container Registry in the EU region.
// Use 'asia.gcr.io/datadoghq' for Google Container Registry in the Asia region.
// Use 'docker.io/datadog' for DockerHub.
// Default: 'gcr.io/datadoghq'
// +optional
Expand Down
4 changes: 4 additions & 0 deletions config/crd/bases/v1/datadoghq.com_datadogagents.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2050,6 +2050,10 @@ spec:
description: |-
Registry is the image registry to use for all Agent images.
Use 'public.ecr.aws/datadog' for AWS ECR.
Use 'datadoghq.azurecr.io' for Azure Container Registry.
Use 'gcr.io/datadoghq' for Google Container Registry.
Use 'eu.gcr.io/datadoghq' for Google Container Registry in the EU region.
Use 'asia.gcr.io/datadoghq' for Google Container Registry in the Asia region.
Use 'docker.io/datadog' for DockerHub.
Default: 'gcr.io/datadoghq'
type: string
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration.v2alpha1.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ spec:
| global.originDetectionUnified.enabled | Enabled enables unified mechanism for origin detection. Default: false |
| global.podAnnotationsAsTags | Provide a mapping of Kubernetes Annotations to Datadog Tags. <KUBERNETES_ANNOTATIONS>: <DATADOG_TAG_KEY> |
| global.podLabelsAsTags | Provide a mapping of Kubernetes Labels to Datadog Tags. <KUBERNETES_LABEL>: <DATADOG_TAG_KEY> |
| global.registry | Registry is the image registry to use for all Agent images. Use 'public.ecr.aws/datadog' for AWS ECR. Use 'docker.io/datadog' for DockerHub. Default: 'gcr.io/datadoghq' |
| global.registry | Registry is the image registry to use for all Agent images. Use 'public.ecr.aws/datadog' for AWS ECR. Use 'datadoghq.azurecr.io' for Azure Container Registry. Use 'gcr.io/datadoghq' for Google Container Registry. Use 'eu.gcr.io/datadoghq' for Google Container Registry in the EU region. Use 'asia.gcr.io/datadoghq' for Google Container Registry in the Asia region. Use 'docker.io/datadog' for DockerHub. Default: 'gcr.io/datadoghq' |
| global.site | Site is the Datadog intake site Agent data are sent to. Set to 'datadoghq.com' to send data to the US1 site (default). Set to 'datadoghq.eu' to send data to the EU site. Set to 'us3.datadoghq.com' to send data to the US3 site. Set to 'us5.datadoghq.com' to send data to the US5 site. Set to 'ddog-gov.com' to send data to the US1-FED site. Set to 'ap1.datadoghq.com' to send data to the AP1 site. Default: 'datadoghq.com' |
| global.tags | Tags contains a list of tags to attach to every metric, event and service check collected. Learn more about tagging: https://docs.datadoghq.com/tagging/ |
| override | Override the default configurations of the agents |
Expand Down

0 comments on commit 4befe2a

Please sign in to comment.