You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by mi...@apache.org on 2023/04/14 02:17:34 UTC
[shardingsphere-on-cloud] branch main updated: change docker images and push,change images for job (#311)
This is an automated email from the ASF dual-hosted git repository.
miaoliyao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/shardingsphere-on-cloud.git
The following commit(s) were added to refs/heads/main by this push:
new 58b140e change docker images and push,change images for job (#311)
58b140e is described below
commit 58b140e4926bb4949dc19c3bcac141cd8848eb25
Author: moomman <85...@users.noreply.github.com>
AuthorDate: Fri Apr 14 10:17:27 2023 +0800
change docker images and push,change images for job (#311)
Co-authored-by: moonman <ag...@163.com>
---
shardingsphere-operator/build/tools/Dockerfile | 5 ++---
shardingsphere-operator/build/tools/start.sh | 20 --------------------
.../pkg/reconcile/shardingspherechaos/job.go | 12 ++++++++----
3 files changed, 10 insertions(+), 27 deletions(-)
diff --git a/shardingsphere-operator/build/tools/Dockerfile b/shardingsphere-operator/build/tools/Dockerfile
index d78336f..17f3e4d 100644
--- a/shardingsphere-operator/build/tools/Dockerfile
+++ b/shardingsphere-operator/build/tools/Dockerfile
@@ -23,9 +23,8 @@ ENV ZOOKEEPER_VERSION 3.7.1
ENV ZOOKEEPER_DOWNLOAD_URL https://dlcdn.apache.org/zookeeper/zookeeper-3.7.1/apache-zookeeper-3.7.1-bin.tar.gz
ENV ZOOKEEPER_DIR /app/zookeeper
WORKDIR /app
-COPY start.sh .
-RUN chmod +x start.sh
-CMD ["./start.sh"]
+RUN mkdir -p "/app/start" && chmod -R 777 /app/start
+CMD ["tail -f /dev/null"]
ENTRYPOINT ["sh","-c"]
RUN set -eux; \
\
diff --git a/shardingsphere-operator/build/tools/start.sh b/shardingsphere-operator/build/tools/start.sh
deleted file mode 100644
index fb9686b..0000000
--- a/shardingsphere-operator/build/tools/start.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-#!/bin/sh
-
-tail -f /dev/null
diff --git a/shardingsphere-operator/pkg/reconcile/shardingspherechaos/job.go b/shardingsphere-operator/pkg/reconcile/shardingspherechaos/job.go
index c7c6866..06a3bfc 100644
--- a/shardingsphere-operator/pkg/reconcile/shardingspherechaos/job.go
+++ b/shardingsphere-operator/pkg/reconcile/shardingspherechaos/job.go
@@ -32,10 +32,12 @@ import (
const (
DefaultImageName = "agoiyanzsa/tools-runtime:1.0"
DefaultContainerName = "tools-runtime"
- DefaultWorkPath = "/app"
+ DefaultWorkPath = "/app/start"
DefaultConfigName = "cmd-conf"
)
+var DefaultFileMode int32 = 493
+
const (
completions = "jobs.batch/completions"
activeDeadlineSeconds = "jobs.batch/activeDeadlineSeconds"
@@ -110,6 +112,7 @@ func NewJob(ssChaos *v1alpha1.ShardingSphereChaos, requirement InjectRequirement
v.ConfigMap = &corev1.ConfigMapVolumeSource{}
v.ConfigMap.LocalObjectReference.Name = ssChaos.Name
+ v.ConfigMap.DefaultMode = &DefaultFileMode
jbd.SetVolumes(v)
vm := &corev1.VolumeMount{Name: DefaultConfigName, MountPath: DefaultWorkPath}
@@ -118,8 +121,9 @@ func NewJob(ssChaos *v1alpha1.ShardingSphereChaos, requirement InjectRequirement
cbd.SetImage(DefaultImageName)
cbd.SetName(DefaultContainerName)
cbd.SetVolumeMount(vm)
- cbd.SetCommand(NewCmds(requirement))
+ cbd.SetCommand([]string{"sh", "-c"})
container := cbd.Build()
+ container.Args = NewCmds(requirement)
jbd.SetContainers(container)
rjob := jbd.Build()
return rjob, nil
@@ -128,10 +132,10 @@ func NewJob(ssChaos *v1alpha1.ShardingSphereChaos, requirement InjectRequirement
func NewCmds(requirement InjectRequirement) (cmds []string) {
if requirement == Experimental {
- cmds = append(cmds, fmt.Sprintf("./%s", configExperimental))
+ cmds = append(cmds, fmt.Sprintf("%s/%s", DefaultWorkPath, configExperimental))
}
if requirement == Pressure {
- cmds = append(cmds, fmt.Sprintf("./%s", configExperimental), fmt.Sprintf("./%s", configPressure))
+ cmds = append(cmds, fmt.Sprintf("%s/%s", DefaultWorkPath, configExperimental), fmt.Sprintf("%s/%s", DefaultWorkPath, configPressure))
}
return
}