Skip to content

Commit

Permalink
overwrite cr by incoming data instead of appending to the old data
Browse files Browse the repository at this point in the history
  • Loading branch information
kangyili committed Oct 18, 2024
1 parent c32a8ce commit 436e9c2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/remoteconfig/orchestrator_k8s_crd.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,12 @@ func (r *RemoteConfigUpdater) crdUpdateInstanceStatus(dda v2alpha1.DatadogAgent,
}

// Orchestrator Explorer
if cfg.ClusterAgent != nil && cfg.ClusterAgent.CRDs != nil && len(*cfg.ClusterAgent.CRDs.Crds) > 0 {
newddaStatus.RemoteConfigConfiguration.Features.OrchestratorExplorer.CustomResources = append(newddaStatus.RemoteConfigConfiguration.Features.OrchestratorExplorer.CustomResources, *cfg.ClusterAgent.CRDs.Crds...)
if cfg.ClusterAgent != nil && cfg.ClusterAgent.CRDs != nil {
newddaStatus.RemoteConfigConfiguration.Features.OrchestratorExplorer.CustomResources = []string{}
// Overwrite custom resources by the new ones
if cfg.ClusterAgent.CRDs.Crds != nil {
newddaStatus.RemoteConfigConfiguration.Features.OrchestratorExplorer.CustomResources = *cfg.ClusterAgent.CRDs.Crds
}
newddaStatus.RemoteConfigConfiguration.Features.OrchestratorExplorer.CustomResources = removeDuplicateStr(newddaStatus.RemoteConfigConfiguration.Features.OrchestratorExplorer.CustomResources)
}

Expand Down

0 comments on commit 436e9c2

Please sign in to comment.