mirror of
https://github.com/onepanelio/onepanel.git
synced 2025-10-05 13:46:51 +08:00
Added helper function to add ENVs to a Template.
This commit is contained in:

committed by
rushtehrani

parent
616069005b
commit
a7ce4bd1ae
@@ -174,6 +174,23 @@ func (c *Client) injectAutomatedFields(namespace string, wf *wfv1.Workflow, opts
|
||||
return
|
||||
}
|
||||
|
||||
func addEnvToTemplate(template *wfv1.Template, key string, value string) {
|
||||
//Flag to prevent over-writing user's envs
|
||||
overwriteUserEnv := true
|
||||
for _, templateEnv := range template.Container.Env {
|
||||
if templateEnv.Name == key {
|
||||
overwriteUserEnv = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if overwriteUserEnv {
|
||||
template.Container.Env = append(template.Container.Env, corev1.EnvVar{
|
||||
Name: key,
|
||||
Value: value,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Client) create(namespace string, wf *wfv1.Workflow, opts *WorkflowExecutionOptions) (createdWorkflow *wfv1.Workflow, err error) {
|
||||
if opts == nil {
|
||||
opts = &WorkflowExecutionOptions{}
|
||||
|
Reference in New Issue
Block a user