Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deploy): remove useless result-uploader container #1043

Merged
merged 1 commit into from
Aug 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public V1Job renderJob(String template, String name, String coreContainerName, S
V1PodSpec podSpec = jobSpec.getTemplate().getSpec();
Objects.requireNonNull(podSpec, "can not get pod spec");

V1Container coreContainer = podSpec.getInitContainers().stream().filter(c -> c.getName().equals(coreContainerName)).findFirst().orElse(null);
V1Container coreContainer = podSpec.getContainers().stream().filter(c -> c.getName().equals(coreContainerName)).findFirst().orElse(null);
Objects.requireNonNull(coreContainer, "can not get coreContainer by name " + coreContainerName);

if (!image.isEmpty()) {
Expand All @@ -142,7 +142,6 @@ public V1Job renderJob(String template, String name, String coreContainerName, S

if (!coreEnv.isEmpty()) {
List<V1EnvVar> ee = new ArrayList<>();
coreEnv.putAll(env);
coreEnv.forEach((k, v) -> ee.add(new V1EnvVar().name(k).value(v)));
coreContainer.env(ee);
}
Expand Down Expand Up @@ -192,7 +191,6 @@ public String logOfJob(String jobName) throws ApiException, IOException {
appendLog(pod, logBuilder,"data-provider");
appendLog(pod, logBuilder,"untar");
appendLog(pod, logBuilder,"worker");
appendLog(pod, logBuilder,"result-uploader");
return logBuilder.toString();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,17 +174,6 @@ private void deployTaskToK8s(K8sClient client, String image, Task task, Map<Stri
// set result upload path

log.debug("deploying k8sJob to k8s :{}", JSONUtil.toJsonStr(k8sJob));
// TODO:remove dst
k8sJob.getSpec().getTemplate().getSpec().getContainers().get(0).env(List.of(new V1EnvVar().name("DST").value(prefix + "")
, new V1EnvVar().name("ENDPOINT_URL").value(storageProperties.getS3Config().getEndpoint())
, new V1EnvVar().name("AWS_ACCESS_KEY_ID").value(storageProperties.getS3Config().getAccessKey())
, new V1EnvVar().name("AWS_S3_REGION").value(storageProperties.getS3Config().getRegion())
, new V1EnvVar().name("AWS_SECRET_ACCESS_KEY").value(storageProperties.getS3Config().getSecretKey())
, new V1EnvVar().name("SW_PYPI_INDEX_URL").value(runTimeProperties.getPypi().getIndexUrl())
, new V1EnvVar().name("SW_PYPI_EXTRA_INDEX_URL").value(runTimeProperties.getPypi().getExtraIndexUrl())
, new V1EnvVar().name("SW_PYPI_TRUSTED_HOST").value(runTimeProperties.getPypi().getTrustedHost())
)
);
// update node selector
if (nodeSelector != null) {
var selector = k8sJob.getSpec().getTemplate().getSpec().getNodeSelector();
Expand Down
13 changes: 1 addition & 12 deletions server/controller/src/main/resources/template/job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ spec:
- -c
- >-
cd /opt/starwhale && find ./ -type f \( -name \*.swmp -o -name \*.swrt \) -exec tar -C swmp/ -xf {} \;
containers:
- name: 'worker'
image: 'docker.io/library/busybox'
imagePullPolicy: IfNotPresent
Expand All @@ -47,18 +48,6 @@ spec:
value: pypi.doubanio.com
- name: SW_PIP_CACHE_DIR
value: /root/.cache/pip
containers:
- name: result-uploader
imagePullPolicy: IfNotPresent
image: amazon/aws-cli:2.7.25
volumeMounts:
- mountPath: /opt/starwhale
name: data
command:
- sh
- -c
- >-
aws --endpoint-url=$ENDPOINT_URL --region=$AWS_S3_REGION s3 cp /opt/starwhale/result/current $DST
volumes:
- name: pip-cache
hostPath:
Expand Down