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

pull/6774/head
Chaim Lev-Ari 2022-04-17 10:34:20 +03:00 committed by GitHub
parent da9ef7dfcf
commit 7efdae5eee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 19 deletions

View File

@ -55,7 +55,6 @@ export function EdgePropertiesForm({
</div> </div>
</div> </div>
{values.platform !== 'k8s' && (
<FormControl <FormControl
label="Environment variables" label="Environment variables"
tooltip="Comma separated list of environment variables that will be sourced from the host where the agent is deployed." tooltip="Comma separated list of environment variables that will be sourced from the host where the agent is deployed."
@ -69,7 +68,6 @@ export function EdgePropertiesForm({
onChange={(e) => setFieldValue(e.target.name, e.target.value)} onChange={(e) => setFieldValue(e.target.name, e.target.value)}
/> />
</FormControl> </FormControl>
)}
</form> </form>
); );
} }

View File

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