Skip to content

Commit

Permalink
add automatic forwarding of base64 config override env var to k8s
Browse files Browse the repository at this point in the history
  • Loading branch information
Tofel committed Jan 3, 2024
1 parent f6dd557 commit 09bda72
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions k8s/config/overrides.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ const (
EnvVarLocalCharts = "LOCAL_CHARTS"
EnvVarLocalChartsUserDescription = "Use local charts from the CTF repository directly"
EnvVarLocalChartsExample = "true"

EnvBase64ConfigOverride = "BASE64_CONFIG_OVERRIDE"
EnvBase64ConfigOverriderDescription = "Base64-encoded TOML config (should contain at least chainlink image and version)"
EnvBase64ConfigOverrideExample = "W0NoYWlubGlua0ltYWdlXQppbWFnZT0icHVibGljLmVjci5hd3MvY2hhaW5saW5rL2NoYWlubGluayIKdmVyc2lvbj0iMi43LjEtYXV0b21hdGlvbi0yMDIzMTEyNyIKCltBdXRvbWF0aW9uXQpbQXV0b21hdGlvbi5HZW5lcmFsXQpkdXJhdGlvbj0yMDAK"
)

var (
Expand Down
2 changes: 2 additions & 0 deletions k8s/environment/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ func jobEnvVars(props *Props) *[]*k8s.EnvVar {
config.EnvVarEVMUrls,
config.EnvVarEVMHttpUrls,
config.EnvVarLocalCharts,
config.EnvBase64ConfigOverride,
}
for _, k := range lookups {
v, success := os.LookupEnv(k)
Expand All @@ -229,6 +230,7 @@ func jobEnvVars(props *Props) *[]*k8s.EnvVar {
if i := strings.Index(e, "="); i >= 0 {
if strings.HasPrefix(e[:i], config.EnvVarPrefix) {
withoutPrefix := strings.Replace(e[:i], config.EnvVarPrefix, "", 1)
log.Debug().Str(e[:i], e[i+1:]).Msg("Forwarding generic Env Var")
env[withoutPrefix] = e[i+1:]
}
}
Expand Down

0 comments on commit 09bda72

Please sign in to comment.