Skip to content

Commit

Permalink
fix missed var names
Browse files Browse the repository at this point in the history
  • Loading branch information
celenechang committed Jan 31, 2024
1 parent bbbdd20 commit d532054
Show file tree
Hide file tree
Showing 38 changed files with 143 additions and 143 deletions.
14 changes: 7 additions & 7 deletions controllers/datadogagent/component/agent/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ func NewDefaultAgentPodTemplateSpec(dda metav1.Object, agentComponent feature.Re
requiredContainers := agentComponent.Containers

var agentContainers []corev1.Container
if agentComponent.MultiProcessContainerEnabled() {
agentContainers = agentMultiProcessContainer(dda)
if agentComponent.SingleContainerStrategyEnabled() {
agentContainers = agentSingleContainer(dda)
} else {
agentContainers = agentSingleProcessContainers(dda, requiredContainers)
agentContainers = agentOptimizedContainers(dda, requiredContainers)
}

return &corev1.PodTemplateSpec{
Expand Down Expand Up @@ -107,8 +107,8 @@ func initContainers(dda metav1.Object, requiredContainers []common.AgentContaine
return initContainers
}

func agentMultiProcessContainer(dda metav1.Object) []corev1.Container {
agentMultiProcessContainer := corev1.Container{
func agentSingleContainer(dda metav1.Object) []corev1.Container {
agentSingleContainer := corev1.Container{
Name: string(common.UnprivilegedSingleAgentContainerName),
Image: agentImage(),
Env: envVarsForCoreAgent(dda),
Expand All @@ -118,13 +118,13 @@ func agentMultiProcessContainer(dda metav1.Object) []corev1.Container {
}

containers := []corev1.Container{
agentMultiProcessContainer,
agentSingleContainer,
}

return containers
}

func agentSingleProcessContainers(dda metav1.Object, requiredContainers []common.AgentContainerName) []corev1.Container {
func agentOptimizedContainers(dda metav1.Object, requiredContainers []common.AgentContainerName) []corev1.Container {
containers := []corev1.Container{coreAgentContainer(dda)}

for _, containerName := range requiredContainers {
Expand Down
10 changes: 5 additions & 5 deletions controllers/datadogagent/controller_reconcile_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ func (r *Reconciler) reconcileV2Agent(logger logr.Logger, requiredComponents fea
disabledByOverride := false

agentEnabled := requiredComponents.Agent.IsEnabled()
multiProcessContainerEnabled := requiredComponents.Agent.MultiProcessContainerEnabled()
singleContainerStrategyEnabled := requiredComponents.Agent.SingleContainerStrategyEnabled()

if r.options.ExtendedDaemonsetOptions.Enabled {
// Start by creating the Default Agent extendeddaemonset
eds = componentagent.NewDefaultAgentExtendedDaemonset(dda, &r.options.ExtendedDaemonsetOptions, requiredComponents.Agent)
podManagers = feature.NewPodTemplateManagers(&eds.Spec.Template)

// Set Global setting on the default extendeddaemonset
eds.Spec.Template = *override.ApplyGlobalSettingsNodeAgent(logger, podManagers, dda, resourcesManager, multiProcessContainerEnabled)
eds.Spec.Template = *override.ApplyGlobalSettingsNodeAgent(logger, podManagers, dda, resourcesManager, singleContainerStrategyEnabled)

// Apply features changes on the Deployment.Spec.Template
for _, feat := range features {
Expand Down Expand Up @@ -113,12 +113,12 @@ func (r *Reconciler) reconcileV2Agent(logger logr.Logger, requiredComponents fea
daemonset = componentagent.NewDefaultAgentDaemonset(dda, requiredComponents.Agent)
podManagers = feature.NewPodTemplateManagers(&daemonset.Spec.Template)
// Set Global setting on the default daemonset
daemonset.Spec.Template = *override.ApplyGlobalSettingsNodeAgent(logger, podManagers, dda, resourcesManager, multiProcessContainerEnabled)
daemonset.Spec.Template = *override.ApplyGlobalSettingsNodeAgent(logger, podManagers, dda, resourcesManager, singleContainerStrategyEnabled)

// Apply features changes on the Deployment.Spec.Template
for _, feat := range features {
if multiProcessContainerEnabled {
if errFeat := feat.ManageMultiProcessNodeAgent(podManagers, provider); errFeat != nil {
if singleContainerStrategyEnabled {
if errFeat := feat.ManageSingleContainerNodeAgent(podManagers, provider); errFeat != nil {
return result, errFeat
}
} else {
Expand Down
8 changes: 4 additions & 4 deletions controllers/datadogagent/controller_v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func TestReconcileDatadogAgentV2_Reconcile(t *testing.T) {
},
},
{
name: "[multi-process container] DatadogAgent default, create Daemonset with a multi-process container",
name: "[single container] DatadogAgent default, create Daemonset with a single container",
fields: fields{
client: fake.NewFakeClient(),
scheme: s,
Expand Down Expand Up @@ -185,7 +185,7 @@ func TestReconcileDatadogAgentV2_Reconcile(t *testing.T) {
},
},
{
name: "[multi-process container] DatadogAgent with APM enabled, create Daemonset with a multi-process container",
name: "[single container] DatadogAgent with APM enabled, create Daemonset with a single container",
fields: fields{
client: fake.NewFakeClient(),
scheme: s,
Expand Down Expand Up @@ -244,7 +244,7 @@ func TestReconcileDatadogAgentV2_Reconcile(t *testing.T) {
},
},
{
name: "[multi-process container] DatadogAgent with APM and CWS enables, create Daemonset with all five agents",
name: "[single container] DatadogAgent with APM and CWS enables, create Daemonset with all five agents",
fields: fields{
client: fake.NewFakeClient(),
scheme: s,
Expand Down Expand Up @@ -308,7 +308,7 @@ func TestReconcileDatadogAgentV2_Reconcile(t *testing.T) {
},
},
{
name: "[multi-process container] DatadogAgent with APM and OOMKill enabled, create Daemonset with core, trace, process and system-probe",
name: "[single container] DatadogAgent with APM and OOMKill enabled, create Daemonset with core, trace, process and system-probe",
fields: fields{
client: fake.NewFakeClient(),
scheme: s,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,10 @@ func (f *admissionControllerFeature) ManageClusterAgent(managers feature.PodTemp
return nil
}

// ManageMultiProcessNodeAgent allows a feature to configure the multi-process container for the Node Agent's corev1.PodTemplateSpec
// if multi-process container usage is enabled and can be used with the current feature set.
// ManageSingleContainerNodeAgent allows a feature to configure the Agent container for the Node Agent's corev1.PodTemplateSpec
// if SingleContainerStrategy is enabled and can be used with the configured feature set..
// It should do nothing if the feature doesn't need to configure it.
func (f *admissionControllerFeature) ManageMultiProcessNodeAgent(managers feature.PodTemplateManagers, provider string) error {
func (f *admissionControllerFeature) ManageSingleContainerNodeAgent(managers feature.PodTemplateManagers, provider string) error {
return nil
}

Expand Down
6 changes: 3 additions & 3 deletions controllers/datadogagent/feature/apm/feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,10 @@ func (f *apmFeature) ManageClusterAgent(managers feature.PodTemplateManagers) er
return nil
}

// ManageMultiProcessNodeAgent allows a feature to configure the multi-process container for Node Agent's corev1.PodTemplateSpec
// if multi-process container usage is enabled and can be used with the current feature set
// ManageSingleContainerNodeAgent allows a feature to configure the Agent container for the Node Agent's corev1.PodTemplateSpec
// if SingleContainerStrategy is enabled and can be used with the configured feature set.
// It should do nothing if the feature doesn't need to configure it.
func (f *apmFeature) ManageMultiProcessNodeAgent(managers feature.PodTemplateManagers, provider string) error {
func (f *apmFeature) ManageSingleContainerNodeAgent(managers feature.PodTemplateManagers, provider string) error {
f.manageNodeAgent(apicommonv1.UnprivilegedSingleAgentContainerName, managers, provider)
return nil
}
Expand Down
6 changes: 3 additions & 3 deletions controllers/datadogagent/feature/apm/feature_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func TestAPMFeature(t *testing.T) {
WantConfigure: false,
},
{
Name: "v2alpha1 apm not enabled with multi-process container",
Name: "v2alpha1 apm not enabled with single container strategy",
DDAv2: v2alpha1test.NewDatadogAgentBuilder().
WithAPMEnabled(false).
WithSingleContainerStrategy(true).
Expand All @@ -79,7 +79,7 @@ func TestAPMFeature(t *testing.T) {
Agent: testAgentUDSOnly(apicommonv1.TraceAgentContainerName),
},
{
Name: "v2alpha1 apm enabled, use uds with multi-process container",
Name: "v2alpha1 apm enabled, use uds with single container strategy",
DDAv2: v2alpha1test.NewDatadogAgentBuilder().
WithAPMEnabled(true).
WithAPMHostPortEnabled(false, 8126).
Expand All @@ -100,7 +100,7 @@ func TestAPMFeature(t *testing.T) {
Agent: testAgentHostPortUDS(apicommonv1.TraceAgentContainerName),
},
{
Name: "v2alpha1 apm enabled, use uds and host port with multi-process container",
Name: "v2alpha1 apm enabled, use uds and host port with single container strategy",
DDAv2: v2alpha1test.NewDatadogAgentBuilder().
WithAPMEnabled(true).
WithAPMHostPortEnabled(true, 8126).
Expand Down
6 changes: 3 additions & 3 deletions controllers/datadogagent/feature/clusterchecks/feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,10 @@ func (f *clusterChecksFeature) ManageClusterAgent(managers feature.PodTemplateMa
return nil
}

// ManageMultiProcessNodeAgent allows a feature to configure the multi-process container for Node Agent's corev1.PodTemplateSpec
// if multi-process container usage is enabled and can be used with the current feature set
// ManageSingleContainerNodeAgent allows a feature to configure the Agent container for the Node Agent's corev1.PodTemplateSpec
// if SingleContainerStrategy is enabled and can be used with the configured feature set.
// It should do nothing if the feature doesn't need to configure it.
func (f *clusterChecksFeature) ManageMultiProcessNodeAgent(managers feature.PodTemplateManagers, provider string) error {
func (f *clusterChecksFeature) ManageSingleContainerNodeAgent(managers feature.PodTemplateManagers, provider string) error {
f.manageNodeAgent(common.UnprivilegedSingleAgentContainerName, managers, provider)
return nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func TestClusterChecksFeature(t *testing.T) {
Agent: testAgentHasExpectedEnvsWithNoRunners(apicommonv1.CoreAgentContainerName),
},
{
Name: "v2alpha1 cluster checks enabled and runners not enabled with multi-process container",
Name: "v2alpha1 cluster checks enabled and runners not enabled with single container strategy",
DDAv2: v2alpha1test.NewDatadogAgentBuilder().
WithClusterChecksEnabled(true).
WithClusterChecksUseCLCEnabled(false).
Expand All @@ -123,7 +123,7 @@ func TestClusterChecksFeature(t *testing.T) {
Agent: testAgentHasExpectedEnvsWithRunners(apicommonv1.CoreAgentContainerName),
},
{
Name: "v2alpha1 cluster checks enabled and runners enabled with multi-process container",
Name: "v2alpha1 cluster checks enabled and runners enabled with single container strategy",
DDAv2: v2alpha1test.NewDatadogAgentBuilder().
WithClusterChecksEnabled(true).
WithClusterChecksUseCLCEnabled(true).
Expand Down
6 changes: 3 additions & 3 deletions controllers/datadogagent/feature/cspm/feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,10 @@ func (f *cspmFeature) ManageClusterAgent(managers feature.PodTemplateManagers) e
return nil
}

// ManageMultiProcessNodeAgent allows a feature to configure the multi-process container for Node Agent's corev1.PodTemplateSpec
// if multi-process container usage is enabled and can be used with the current feature set
// ManageSingleContainerNodeAgent allows a feature to configure the Agent container for the Node Agent's corev1.PodTemplateSpec
// if SingleContainerStrategy is enabled and can be used with the configured feature set.
// It should do nothing if the feature doesn't need to configure it.
func (f *cspmFeature) ManageMultiProcessNodeAgent(managers feature.PodTemplateManagers, provider string) error {
func (f *cspmFeature) ManageSingleContainerNodeAgent(managers feature.PodTemplateManagers, provider string) error {
return nil
}

Expand Down
6 changes: 3 additions & 3 deletions controllers/datadogagent/feature/cws/feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,10 @@ func (f *cwsFeature) ManageClusterAgent(managers feature.PodTemplateManagers) er
return nil
}

// ManageMultiProcessNodeAgent allows a feature to configure the multi-process container for Node Agent's corev1.PodTemplateSpec
// if multi-process container usage is enabled and can be used with the current feature set
// ManageSingleContainerNodeAgent allows a feature to configure the Agent container for the Node Agent's corev1.PodTemplateSpec
// if SingleContainerStrategy is enabled and can be used with the configured feature set.
// It should do nothing if the feature doesn't need to configure it.
func (f *cwsFeature) ManageMultiProcessNodeAgent(managers feature.PodTemplateManagers, provider string) error {
func (f *cwsFeature) ManageSingleContainerNodeAgent(managers feature.PodTemplateManagers, provider string) error {
return nil
}

Expand Down
6 changes: 3 additions & 3 deletions controllers/datadogagent/feature/dogstatsd/feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,10 @@ func (f *dogstatsdFeature) ManageClusterAgent(managers feature.PodTemplateManage
return nil
}

// ManageMultiProcessNodeAgent allows a feature to configure the multi-process container for Node Agent's corev1.PodTemplateSpec
// if multi-process container usage is enabled and can be used with the current feature set
// ManageSingleContainerNodeAgent allows a feature to configure the Agent container for the Node Agent's corev1.PodTemplateSpec
// if SingleContainerStrategy is enabled and can be used with the configured feature set.
// It should do nothing if the feature doesn't need to configure it.
func (f *dogstatsdFeature) ManageMultiProcessNodeAgent(managers feature.PodTemplateManagers, provider string) error {
func (f *dogstatsdFeature) ManageSingleContainerNodeAgent(managers feature.PodTemplateManagers, provider string) error {
f.manageNodeAgent(apicommonv1.UnprivilegedSingleAgentContainerName, managers, provider)
return nil
}
Expand Down
6 changes: 3 additions & 3 deletions controllers/datadogagent/feature/dummy/feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ func (f *dummyFeature) ManageClusterAgent(managers feature.PodTemplateManagers)
return nil
}

// ManageMultiProcessNodeAgent allows a feature to configure the multi-process container for Node Agent's corev1.PodTemplateSpec
// if multi-process container usage is enabled and can be used with the current feature set
// ManageSingleContainerNodeAgent allows a feature to configure the Agent container for the Node Agent's corev1.PodTemplateSpec
// if SingleContainerStrategy is enabled and can be used with the configured feature set.
// It should do nothing if the feature doesn't need to configure it.
func (f *dummyFeature) ManageMultiProcessNodeAgent(managers feature.PodTemplateManagers, provider string) error {
func (f *dummyFeature) ManageSingleContainerNodeAgent(managers feature.PodTemplateManagers, provider string) error {
return nil
}

Expand Down
6 changes: 3 additions & 3 deletions controllers/datadogagent/feature/ebpfcheck/feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ func (f *ebpfCheckFeature) ManageNodeAgent(managers feature.PodTemplateManagers,
return nil
}

// ManageMultiProcessNodeAgent allows a feature to configure the multi-process container for Node Agent's corev1.PodTemplateSpec
// if multi-process container usage is enabled and can be used with the current feature set
// ManageSingleContainerNodeAgent allows a feature to configure the Agent container for the Node Agent's corev1.PodTemplateSpec
// if SingleContainerStrategy is enabled and can be used with the configured feature set.
// It should do nothing if the feature doesn't need to configure it.
func (f *ebpfCheckFeature) ManageMultiProcessNodeAgent(managers feature.PodTemplateManagers, provider string) error {
func (f *ebpfCheckFeature) ManageSingleContainerNodeAgent(managers feature.PodTemplateManagers, provider string) error {
return nil
}

Expand Down
6 changes: 3 additions & 3 deletions controllers/datadogagent/feature/enabledefault/feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,10 @@ func (f *defaultFeature) ManageClusterAgent(managers feature.PodTemplateManagers
return nil
}

// ManageMultiProcessNodeAgent allows a feature to configure the multi-process container for Node Agent's corev1.PodTemplateSpec
// if multi-process container usage is enabled and can be used with the current feature set
// ManageSingleContainerNodeAgent allows a feature to configure the Agent container for the Node Agent's corev1.PodTemplateSpec
// if SingleContainerStrategy is enabled and can be used with the configured feature set.
// It should do nothing if the feature doesn't need to configure it.
func (f *defaultFeature) ManageMultiProcessNodeAgent(managers feature.PodTemplateManagers, provider string) error {
func (f *defaultFeature) ManageSingleContainerNodeAgent(managers feature.PodTemplateManagers, provider string) error {
f.ManageNodeAgent(managers, provider)

return nil
Expand Down
6 changes: 3 additions & 3 deletions controllers/datadogagent/feature/eventcollection/feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ func (f *eventCollectionFeature) ManageClusterAgent(managers feature.PodTemplate
return nil
}

// ManageMultiProcessNodeAgent allows a feature to configure the multi-process container for Node Agent's corev1.PodTemplateSpec
// if multi-process container usage is enabled and can be used with the current feature set
// ManageSingleContainerNodeAgent allows a feature to configure the Agent container for the Node Agent's corev1.PodTemplateSpec
// if SingleContainerStrategy is enabled and can be used with the configured feature set.
// It should do nothing if the feature doesn't need to configure it.
func (f *eventCollectionFeature) ManageMultiProcessNodeAgent(managers feature.PodTemplateManagers, provider string) error {
func (f *eventCollectionFeature) ManageSingleContainerNodeAgent(managers feature.PodTemplateManagers, provider string) error {
f.manageNodeAgent(apicommonv1.UnprivilegedSingleAgentContainerName, managers, provider)
return nil
}
Expand Down
6 changes: 3 additions & 3 deletions controllers/datadogagent/feature/externalmetrics/feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,10 +402,10 @@ func (f *externalMetricsFeature) ManageClusterAgent(managers feature.PodTemplate
return nil
}

// ManageMultiProcessNodeAgent allows a feature to configure the multi-process container for Node Agent's corev1.PodTemplateSpec
// if multi-process container usage is enabled and can be used with the current feature set
// ManageSingleContainerNodeAgent allows a feature to configure the Agent container for the Node Agent's corev1.PodTemplateSpec
// if SingleContainerStrategy is enabled and can be used with the configured feature set.
// It should do nothing if the feature doesn't need to configure it.
func (f *externalMetricsFeature) ManageMultiProcessNodeAgent(managers feature.PodTemplateManagers, provider string) error {
func (f *externalMetricsFeature) ManageSingleContainerNodeAgent(managers feature.PodTemplateManagers, provider string) error {
return nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,10 @@ func (f *ksmFeature) ManageClusterAgent(managers feature.PodTemplateManagers) er
return nil
}

// ManageMultiProcessNodeAgent allows a feature to configure the multi-process container for Node Agent's corev1.PodTemplateSpec
// if multi-process container usage is enabled and can be used with the current feature set
// ManageSingleContainerNodeAgent allows a feature to configure the Agent container for the Node Agent's corev1.PodTemplateSpec
// if SingleContainerStrategy is enabled and can be used with the configured feature set.
// It should do nothing if the feature doesn't need to configure it.
func (f *ksmFeature) ManageMultiProcessNodeAgent(managers feature.PodTemplateManagers, provider string) error {
func (f *ksmFeature) ManageSingleContainerNodeAgent(managers feature.PodTemplateManagers, provider string) error {
// Remove ksm v1 conf if the cluster checks are enabled and the ksm core is enabled
ignoreAutoConf := &corev1.EnvVar{
Name: apicommon.DDIgnoreAutoConf,
Expand Down
Loading

0 comments on commit d532054

Please sign in to comment.