feat(endpoints): enable env vars on kube edge deploy [EE-2542] (#6620)

pull/6774/head
Chaim Lev-Ari 3 years ago committed by GitHub
parent da9ef7dfcf
commit 7efdae5eee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -55,21 +55,19 @@ export function EdgePropertiesForm({
</div>
</div>
{values.platform !== 'k8s' && (
<FormControl
label="Environment variables"
tooltip="Comma separated list of environment variables that will be sourced from the host where the agent is deployed."
inputId="env-vars-input"
>
<Input
type="text"
name="envVars"
value={values.envVars}
id="env-vars-input"
onChange={(e) => setFieldValue(e.target.name, e.target.value)}
/>
</FormControl>
)}
<FormControl
label="Environment variables"
tooltip="Comma separated list of environment variables that will be sourced from the host where the agent is deployed."
inputId="env-vars-input"
>
<Input
type="text"
name="envVars"
value={values.envVars}
id="env-vars-input"
onChange={(e) => setFieldValue(e.target.name, e.target.value)}
/>
</FormControl>
</form>
);
}

@ -262,7 +262,7 @@ function buildKubernetesCommand(
edgeIdScript: string,
edgeKey: string,
allowSelfSignedCerts: boolean,
_envVars: string,
envVars: string,
edgeId?: string,
agentSecret = ''
) {
@ -270,11 +270,13 @@ function buildKubernetesCommand(
const idEnvVar = edgeIdScript
? `PORTAINER_EDGE_ID=$(${edgeIdScript}) \n\n`
: '';
const edgeIdVar = !edgeIdScript && edgeId ? edgeId : '$PORTAINER_EDGE_ID';
const selfSigned = allowSelfSignedCerts ? '1' : '0';
return `${idEnvVar}curl https://downloads.portainer.io/ce${agentShortVersion}/portainer-edge-agent-setup.sh |
bash -s -- "${
!edgeIdScript && edgeId ? edgeId : '$PORTAINER_EDGE_ID'
}" "${edgeKey}" "${allowSelfSignedCerts ? '1' : '0'}" "${agentSecret}"`;
bash -s -- "${edgeIdVar}" \\
"${edgeKey}" \\
"${selfSigned}" "${agentSecret}" "${envVars}"`;
}
function buildDefaultEnvVars(

Loading…
Cancel
Save