Skip to content

Commit

Permalink
fix: initialize as empty arrays (#51)
Browse files Browse the repository at this point in the history
- secretsAsVolumes, volumeMounts, requiredDuringSchedulingIgnoredDuringExecution, preferredDuringSchedulingIgnoredDuringExecution initialize as empty arrays
  • Loading branch information
ishanarya0 authored Jul 28, 2023
1 parent 178e82c commit aac1e7f
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions modules/firehose/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func (fd *firehoseDriver) getHelmRelease(res resource.Resource, conf Config,
}

tolerationKey := fmt.Sprintf("firehose_%s", conf.EnvVariables["SINK_TYPE"])
var tolerations []map[string]any
var tolerations = []map[string]any{}
for _, t := range kubeOut.Tolerations[tolerationKey] {
tolerations = append(tolerations, map[string]any{
"key": t.Key,
Expand All @@ -220,13 +220,17 @@ func (fd *firehoseDriver) getHelmRelease(res resource.Resource, conf Config,
})
}

var secretsAsVolumes []map[string]any
var volumeMounts []map[string]any
var requiredDuringSchedulingIgnoredDuringExecution []Preference
var preferredDuringSchedulingIgnoredDuringExecution []WeightedPreference
var secretsAsVolumes = []map[string]any{}
var volumeMounts = []map[string]any{}
var requiredDuringSchedulingIgnoredDuringExecution = []Preference{}
var preferredDuringSchedulingIgnoredDuringExecution = []WeightedPreference{}

requiredDuringSchedulingIgnoredDuringExecution = fd.conf.NodeAffinityMatchExpressions.RequiredDuringSchedulingIgnoredDuringExecution
preferredDuringSchedulingIgnoredDuringExecution = fd.conf.NodeAffinityMatchExpressions.PreferredDuringSchedulingIgnoredDuringExecution
if fd.conf.NodeAffinityMatchExpressions.RequiredDuringSchedulingIgnoredDuringExecution != nil {
requiredDuringSchedulingIgnoredDuringExecution = fd.conf.NodeAffinityMatchExpressions.RequiredDuringSchedulingIgnoredDuringExecution
}
if fd.conf.NodeAffinityMatchExpressions.PreferredDuringSchedulingIgnoredDuringExecution != nil {
preferredDuringSchedulingIgnoredDuringExecution = fd.conf.NodeAffinityMatchExpressions.PreferredDuringSchedulingIgnoredDuringExecution
}

newVolume := func(name string) map[string]any {
const mountMode = 420
Expand Down

0 comments on commit aac1e7f

Please sign in to comment.