Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add secret key #37

Merged
merged 2 commits into from
Apr 21, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions modules/firehose/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func (fd *firehoseDriver) getHelmRelease(res resource.Resource, conf Config,
return nil, err
}

var volumes []map[string]any
var secretsAsVolumes []map[string]any
var volumeMounts []map[string]any
var requiredDuringSchedulingIgnoredDuringExecution []Preference
var preferredDuringSchedulingIgnoredDuringExecution []WeightedPreference
Expand All @@ -188,18 +188,20 @@ func (fd *firehoseDriver) getHelmRelease(res resource.Resource, conf Config,
newVolume := func(name string) map[string]any {
const mountMode = 420
return map[string]any{
"name": name,
"items": []map[string]any{{"key": "token", "path": "auth.json"}},
"secretName": name,
"defaultMode": mountMode,
"name": name,
"secret": map[string]any{
"items": []map[string]any{{"key": "token", "path": "auth.json"}},
spy16 marked this conversation as resolved.
Show resolved Hide resolved
"secretName": name,
"defaultMode": mountMode,
},
}
}

if fd.conf.GCSSinkCredential != "" {
const mountPath = "/etc/secret/blob-gcs-sink"
const credentialPath = mountPath + "/auth.json"

volumes = append(volumes, newVolume(fd.conf.GCSSinkCredential))
secretsAsVolumes = append(secretsAsVolumes, newVolume(fd.conf.GCSSinkCredential))
volumeMounts = append(volumeMounts, map[string]any{
"name": fd.conf.GCSSinkCredential,
"mountPath": mountPath,
Expand All @@ -211,7 +213,7 @@ func (fd *firehoseDriver) getHelmRelease(res resource.Resource, conf Config,
const mountPath = "/etc/secret/dlq-gcs"
const credentialPath = mountPath + "/auth.json"

volumes = append(volumes, newVolume(fd.conf.DLQGCSSinkCredential))
secretsAsVolumes = append(secretsAsVolumes, newVolume(fd.conf.DLQGCSSinkCredential))
volumeMounts = append(volumeMounts, map[string]any{
"name": fd.conf.DLQGCSSinkCredential,
"mountPath": mountPath,
Expand All @@ -223,7 +225,7 @@ func (fd *firehoseDriver) getHelmRelease(res resource.Resource, conf Config,
const mountPath = "/etc/secret/bigquery-sink"
const credentialPath = mountPath + "/auth.json"

volumes = append(volumes, newVolume(fd.conf.BigQuerySinkCredential))
secretsAsVolumes = append(secretsAsVolumes, newVolume(fd.conf.BigQuerySinkCredential))
volumeMounts = append(volumeMounts, map[string]any{
"name": fd.conf.BigQuerySinkCredential,
"mountPath": mountPath,
Expand Down Expand Up @@ -260,8 +262,8 @@ func (fd *firehoseDriver) getHelmRelease(res resource.Resource, conf Config,
},
"volumeMounts": volumeMounts,
},
"volumes": volumes,
"tolerations": tolerations,
"secretsAsVolumes": secretsAsVolumes,
"tolerations": tolerations,
"nodeAffinityMatchExpressions": map[string]any{
"requiredDuringSchedulingIgnoredDuringExecution": requiredDuringSchedulingIgnoredDuringExecution,
"preferredDuringSchedulingIgnoredDuringExecution": preferredDuringSchedulingIgnoredDuringExecution,
Expand Down