From da9ef7dfcf0228a3ee382c47fa0a782840dc8d8d Mon Sep 17 00:00:00 2001 From: sunportainer <93502624+sunportainer@users.noreply.github.com> Date: Sun, 17 Apr 2022 11:04:04 +0800 Subject: [PATCH] fix(download):update the downloads files directory EE-2473 (#6734) * update the downloads files directory --- .../components/EdgeScriptForm/EdgeScriptForm.tsx | 2 +- app/edge/components/EdgeScriptForm/Scripts.tsx | 14 +++++++------- .../endpoints/create/createEndpointController.js | 4 ++-- app/portainer/views/endpoints/helpers.js | 2 +- .../wizard-docker.controller.js | 4 ++-- .../wizard-kubernetes.controller.js | 4 ++-- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/edge/components/EdgeScriptForm/EdgeScriptForm.tsx b/app/edge/components/EdgeScriptForm/EdgeScriptForm.tsx index 737f235e7..aa3d33c65 100644 --- a/app/edge/components/EdgeScriptForm/EdgeScriptForm.tsx +++ b/app/edge/components/EdgeScriptForm/EdgeScriptForm.tsx @@ -19,7 +19,7 @@ export function EdgeScriptForm({ edgeKey, edgeId }: Props) { envVars: '', edgeIdGenerator: '', os: 'linux', - platform: 'swarm', + platform: 'k8s', }); const settingsQuery = useSettings((settings) => settings.AgentSecret); diff --git a/app/edge/components/EdgeScriptForm/Scripts.tsx b/app/edge/components/EdgeScriptForm/Scripts.tsx index 75f6a0627..96fb653e6 100644 --- a/app/edge/components/EdgeScriptForm/Scripts.tsx +++ b/app/edge/components/EdgeScriptForm/Scripts.tsx @@ -10,6 +10,11 @@ import { EdgeProperties, Platform } from './types'; const commandsByOs = { linux: [ + { + id: 'k8s', + label: 'Kubernetes', + command: buildKubernetesCommand, + }, { id: 'swarm', label: 'Docker Swarm', @@ -20,11 +25,6 @@ const commandsByOs = { label: 'Docker Standalone', command: buildLinuxStandaloneCommand, }, - { - id: 'k8s', - label: 'Kubernetes', - command: buildKubernetesCommand, - }, ], win: [ { @@ -67,7 +67,7 @@ export function Scripts({ useEffect(() => { if (!commandsByOs[os].find((p) => p.id === platform)) { - onPlatformChange('standalone'); + onPlatformChange('swarm'); } }, [os, platform, onPlatformChange]); @@ -271,7 +271,7 @@ function buildKubernetesCommand( ? `PORTAINER_EDGE_ID=$(${edgeIdScript}) \n\n` : ''; - return `${idEnvVar}curl https://downloads.portainer.io/portainer-ee${agentShortVersion}-edge-agent-setup.sh | + 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}"`; diff --git a/app/portainer/views/endpoints/create/createEndpointController.js b/app/portainer/views/endpoints/create/createEndpointController.js index 7da101aad..e2f1f3eb3 100644 --- a/app/portainer/views/endpoints/create/createEndpointController.js +++ b/app/portainer/views/endpoints/create/createEndpointController.js @@ -55,8 +55,8 @@ angular $scope.agentSecret = ''; $scope.deployCommands = { - kubeLoadBalancer: `curl -L https://downloads.portainer.io/portainer-agent-ce${agentShortVersion}-k8s-lb.yaml -o portainer-agent-k8s.yaml; kubectl apply -f portainer-agent-k8s.yaml`, - kubeNodePort: `curl -L https://downloads.portainer.io/portainer-agent-ce${agentShortVersion}-k8s-nodeport.yaml -o portainer-agent-k8s.yaml; kubectl apply -f portainer-agent-k8s.yaml`, + kubeLoadBalancer: `curl -L https://downloads.portainer.io/ce${agentShortVersion}/portainer-agent-k8s-lb.yaml -o portainer-agent-k8s.yaml; kubectl apply -f portainer-agent-k8s.yaml`, + kubeNodePort: `curl -L https://downloads.portainer.io/ce${agentShortVersion}/portainer-agent-k8s-nodeport.yaml -o portainer-agent-k8s.yaml; kubectl apply -f portainer-agent-k8s.yaml`, agentLinux: agentLinuxSwarmCommand, agentWindows: agentWindowsSwarmCommand, }; diff --git a/app/portainer/views/endpoints/helpers.js b/app/portainer/views/endpoints/helpers.js index 6aaaff31e..45c7bae85 100644 --- a/app/portainer/views/endpoints/helpers.js +++ b/app/portainer/views/endpoints/helpers.js @@ -1,4 +1,4 @@ export function getAgentShortVersion(agentVersion) { const numbers = agentVersion.split('.'); - return numbers[0] + numbers[1]; + return numbers[0] + '-' + numbers[1]; } diff --git a/app/portainer/views/wizard/wizard-endpoints/wizard-endpoint-docker/wizard-docker.controller.js b/app/portainer/views/wizard/wizard-endpoints/wizard-endpoint-docker/wizard-docker.controller.js index e00aad575..ce489f21f 100644 --- a/app/portainer/views/wizard/wizard-endpoints/wizard-endpoint-docker/wizard-docker.controller.js +++ b/app/portainer/views/wizard/wizard-endpoints/wizard-endpoint-docker/wizard-docker.controller.js @@ -227,8 +227,8 @@ export default class WizardDockerController { const agentShortVersion = getAgentShortVersion(agentVersion); this.command = { - linuxCommand: `curl -L https://downloads.portainer.io/agent-stack-ce${agentShortVersion}.yml -o agent-stack.yml && docker stack deploy --compose-file=agent-stack.yml portainer-agent `, - winCommand: `curl -L https://downloads.portainer.io/agent-stack-ce${agentShortVersion}-windows.yml -o agent-stack-windows.yml && docker stack deploy --compose-file=agent-stack-windows.yml portainer-agent `, + linuxCommand: `curl -L https://downloads.portainer.io/ce${agentShortVersion}/agent-stack.yml -o agent-stack.yml && docker stack deploy --compose-file=agent-stack.yml portainer-agent `, + winCommand: `curl -L https://downloads.portainer.io/ce${agentShortVersion}/agent-stack-windows.yml -o agent-stack-windows.yml && docker stack deploy --compose-file=agent-stack-windows.yml portainer-agent `, linuxSocket: `-v "/var/run/docker.sock:/var/run/docker.sock" `, winSocket: `-v \.\pipe\docker_engine:\.\pipe\docker_engine `, }; diff --git a/app/portainer/views/wizard/wizard-endpoints/wizard-endpoint-kubernetes/wizard-kubernetes.controller.js b/app/portainer/views/wizard/wizard-endpoints/wizard-endpoint-kubernetes/wizard-kubernetes.controller.js index 8bec2c9ee..5de350d2d 100644 --- a/app/portainer/views/wizard/wizard-endpoints/wizard-endpoint-kubernetes/wizard-kubernetes.controller.js +++ b/app/portainer/views/wizard/wizard-endpoints/wizard-endpoint-kubernetes/wizard-kubernetes.controller.js @@ -106,8 +106,8 @@ export default class WizardKubernetesController { const agentShortVersion = getAgentShortVersion(agentVersion); this.command = { - loadBalancer: `curl -L https://downloads.portainer.io/portainer-agent-ce${agentShortVersion}-k8s-lb.yaml -o portainer-agent-k8s.yaml; kubectl apply -f portainer-agent-k8s.yaml `, - nodePort: `curl -L https://downloads.portainer.io/portainer-agent-ce${agentShortVersion}-k8s-nodeport.yaml -o portainer-agent-k8s.yaml; kubectl apply -f portainer-agent-k8s.yaml `, + loadBalancer: `curl -L https://downloads.portainer.io/ce${agentShortVersion}/portainer-agent-k8s-lb.yaml -o portainer-agent-k8s.yaml; kubectl apply -f portainer-agent-k8s.yaml `, + nodePort: `curl -L https://downloads.portainer.io/ce${agentShortVersion}/portainer-agent-k8s-nodeport.yaml -o portainer-agent-k8s.yaml; kubectl apply -f portainer-agent-k8s.yaml `, }; }); }