Skip to content

Commit

Permalink
Fix panic in case of missing ClusterChecksEnabled property in the CR (
Browse files Browse the repository at this point in the history
  • Loading branch information
L3n41c committed Apr 7, 2020
1 parent c9305e2 commit 7cd3b32
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pkg/controller/datadogagent/clusteragent.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ func getEnvVarsForClusterAgent(dda *datadoghqv1alpha1.DatadogAgent) []corev1.Env
},
{
Name: datadoghqv1alpha1.DDClusterChecksEnabled,
Value: strconv.FormatBool(*spec.ClusterAgent.Config.ClusterChecksEnabled),
Value: datadoghqv1alpha1.BoolToString(spec.ClusterAgent.Config.ClusterChecksEnabled),
},
{
Name: datadoghqv1alpha1.DDClusterAgentKubeServiceName,
Expand Down Expand Up @@ -484,7 +484,7 @@ func getEnvVarsForClusterAgent(dda *datadoghqv1alpha1.DatadogAgent) []corev1.Env
}

// Cluster Checks config
if *spec.ClusterAgent.Config.ClusterChecksEnabled {
if datadoghqv1alpha1.BoolValue(spec.ClusterAgent.Config.ClusterChecksEnabled) {
envVars = append(envVars, []corev1.EnvVar{
{
Name: datadoghqv1alpha1.DDExtraConfigProviders,
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/datadogagent/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ func getEnvVarsForAgent(dda *datadoghqv1alpha1.DatadogAgent) ([]corev1.EnvVar, e
ValueFrom: getClusterAgentAuthToken(dda),
},
}
if *spec.ClusterAgent.Config.ClusterChecksEnabled {
if datadoghqv1alpha1.BoolValue(spec.ClusterAgent.Config.ClusterChecksEnabled) {
if spec.ClusterChecksRunner == nil {
clusterEnv = append(clusterEnv, corev1.EnvVar{
Name: datadoghqv1alpha1.DDExtraConfigProviders,
Expand Down

0 comments on commit 7cd3b32

Please sign in to comment.