Skip to content

Commit

Permalink
Delete the wait-for-it.sh as the vineyardd already support the retry …
Browse files Browse the repository at this point in the history
…logic of connecting the etcd. (#1645)

Delete the wait-for-it.sh as the vineyardd already supports the retry
logic of connecting the etcd.

Signed-off-by: Ye Cao <[email protected]>
  • Loading branch information
dashanji authored Dec 18, 2023
1 parent 5072fd7 commit becb894
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 41 deletions.
4 changes: 0 additions & 4 deletions docker/Dockerfile.vineyardd
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ RUN export arch="$PLATFORM" && \
curl -LO https://github.com/Yelp/dumb-init/releases/download/v1.2.2/dumb-init_1.2.2_$arch && \
chmod +x dumb-init_1.2.2_$arch && \
mv /tmp/dumb-init_1.2.2_$arch /usr/bin/dumb-init && \
curl -LO https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh && \
chmod +x wait-for-it.sh && \
mv /tmp/wait-for-it.sh /usr/bin/wait-for-it.sh && \
curl -LO https://github.com/etcd-io/etcd/releases/download/v3.5.9/etcd-v3.5.9-linux-$arch.tar.gz && \
tar zxf etcd-v3.5.9-linux-$arch.tar.gz && \
mv /tmp/etcd-v3.5.9-linux-$arch/etcd /usr/bin/etcd && \
Expand Down Expand Up @@ -82,7 +79,6 @@ SHELL ["/bin/bash", "-c"]

COPY --from=builder /usr/bin/bash-linux /bin/bash
COPY --from=builder /usr/bin/dumb-init /usr/bin/dumb-init
COPY --from=builder /usr/bin/wait-for-it.sh /usr/bin/wait-for-it.sh
COPY --from=builder /usr/bin/etcd /usr/bin/etcd
COPY --from=builder /usr/bin/kubectl /usr/bin/kubectl
COPY --from=builder /work/v6d/build/bin/vineyardd /usr/local/bin/vineyardd
Expand Down
19 changes: 9 additions & 10 deletions docs/notes/cloud-native/vineyard-operator.rst
Original file line number Diff line number Diff line change
Expand Up @@ -149,19 +149,19 @@ Next, use the following YAML to inject the default sidecar into the pod.
apiVersion: apps/v1
kind: Deployment
metadata:
name: job-deployment-with-default-sidecar
name: job-deployment
namespace: vineyard-job
spec:
selector:
matchLabels:
app: job-deployment-with-default-sidecar
app: job-deployment
replicas: 2
template:
metadata:
annotations:
sidecar.v6d.io/name: "default"
labels:
app: job-deployment-with-default-sidecar
app: job-deployment
sidecar.v6d.io/enabled: "true"
spec:
containers:
Expand All @@ -179,20 +179,20 @@ Next, you could see the sidecar container injected into the pod.
.. code:: yaml
# get the default sidecar cr
$ kubectl get sidecar app-job-deployment-with-default-sidecar-default-sidecar -n vineyard-job -o yaml
$ kubectl get sidecar app-job-deployment-default-sidecar -n vineyard-job -o yaml
apiVersion: k8s.v6d.io/v1alpha1
kind: Sidecar
metadata:
# the default sidecar's name is your label selector + "-default-sidecar"
name: app-job-deployment-with-default-sidecar-default-sidecar
name: app-job-deployment-default-sidecar
namespace: vineyard-job
spec:
metric:
enable: false
image: vineyardcloudnative/vineyard-grok-exporter:latest
imagePullPolicy: IfNotPresent
replicas: 2
selector: app=job-deployment-with-default-sidecar
selector: app=job-deployment
service:
port: 9600
selector: rpc.vineyardd.v6d.io/rpc=vineyard-rpc
Expand All @@ -213,11 +213,11 @@ Next, you could see the sidecar container injected into the pod.
streamThreshold: 80
syncCRDs: true
# get the injected Pod, here we only show the important part of the Pod
$ kubectl get pod -l app=job-deployment-with-default-sidecar -n vineyard-job -o yaml
$ kubectl get pod -l app=job-deployment -n vineyard-job -o yaml
apiVersion: v1
kind: Pod
metadata:
name: job-deployment-with-default-sidecar-55664458f8-h4jzk
name: job-deployment-55664458f8-h4jzk
namespace: vineyard-job
spec:
containers:
Expand All @@ -238,8 +238,7 @@ Next, you could see the sidecar container injected into the pod.
- /bin/bash
- -c
- |
/usr/bin/wait-for-it.sh -t 60 etcd-for-vineyard.vineyard-job.svc.cluster.local:2379;
sleep 1; /usr/local/bin/vineyardd --sync_crds true --socket /var/run/vineyard.sock
/usr/local/bin/vineyardd --sync_crds true --socket /var/run/vineyard.sock
--stream_threshold 80 --etcd_cmd etcd --etcd_prefix /vineyard
--etcd_endpoint http://etcd-for-vineyard:2379
env:
Expand Down
6 changes: 2 additions & 4 deletions k8s/cmd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1512,8 +1512,7 @@ spec:
- /bin/bash
- -c
- |
/usr/bin/wait-for-it.sh -t 60 vineyard-sidecar-etcd-service..svc.cluster.local:2379; \
sleep 1; /usr/local/bin/vineyardd --sync_crds true --socket /var/run/vineyard.sock --size \
/usr/local/bin/vineyardd --sync_crds true --socket /var/run/vineyard.sock --size \
--stream_threshold 80 --etcd_cmd etcd --etcd_prefix /vineyard --etcd_endpoint http://vineyard-sidecar-etcd-service:2379
env:
- name: VINEYARDD_UID
Expand Down Expand Up @@ -1609,8 +1608,7 @@ template:
- /bin/bash
- -c
- |
/usr/bin/wait-for-it.sh -t 60 vineyard-sidecar-etcd-service.vineyard-job.svc.cluster.local:2379; \
sleep 1; /usr/local/bin/vineyardd --sync_crds true --socket /var/run/vineyard.sock \
/usr/local/bin/vineyardd --sync_crds true --socket /var/run/vineyard.sock \
--stream_threshold 80 --etcd_cmd etcd --etcd_prefix /vineyard \
--etcd_endpoint http://vineyard-sidecar-etcd-service:2379
env:
Expand Down
3 changes: 1 addition & 2 deletions k8s/cmd/commands/deploy/deploy_vineyard_deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,8 +406,7 @@ func TestGetVineyardDeploymentObjectsFromTemplate_third(t *testing.T) {
"command": []interface{}{
"/bin/bash",
"-c",
"/usr/bin/wait-for-it.sh -t 60 test-vineyardd-sample-etcd-service.test-vineyard-system." +
"svc.cluster.local:2379; sleep 1; /usr/local/bin/vineyardd --sync_crds true --socket " +
"/usr/local/bin/vineyardd --sync_crds true --socket " +
"/var/run/vineyard.sock --size --stream_threshold 80 --etcd_cmd etcd --etcd_prefix " +
"/vineyard --etcd_endpoint http://test-vineyardd-sample-etcd-service:2379\n",
},
Expand Down
6 changes: 2 additions & 4 deletions k8s/cmd/commands/inject/inject.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,7 @@ var (
- /bin/bash
- -c
- |
/usr/bin/wait-for-it.sh -t 60 vineyard-sidecar-etcd-service..svc.cluster.local:2379; \
sleep 1; /usr/local/bin/vineyardd --sync_crds true --socket /var/run/vineyard.sock --size \
/usr/local/bin/vineyardd --sync_crds true --socket /var/run/vineyard.sock --size \
--stream_threshold 80 --etcd_cmd etcd --etcd_prefix /vineyard --etcd_endpoint http://vineyard-sidecar-etcd-service:2379
env:
- name: VINEYARDD_UID
Expand Down Expand Up @@ -315,8 +314,7 @@ var (
- /bin/bash
- -c
- |
/usr/bin/wait-for-it.sh -t 60 vineyard-sidecar-etcd-service.vineyard-job.svc.cluster.local:2379; \
sleep 1; /usr/local/bin/vineyardd --sync_crds true --socket /var/run/vineyard.sock \
/usr/local/bin/vineyardd --sync_crds true --socket /var/run/vineyard.sock \
--stream_threshold 80 --etcd_cmd etcd --etcd_prefix /vineyard \
--etcd_endpoint http://vineyard-sidecar-etcd-service:2379
env:
Expand Down
4 changes: 2 additions & 2 deletions k8s/cmd/commands/inject/inject_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ spec:
- /bin/bash
- -c
- |
/usr/bin/wait-for-it.sh -t 60 vineyard-sidecar-etcd-service.vineyard-system.svc.cluster.local:2379; sleep 1; /usr/local/bin/vineyardd --sync_crds true --socket /var/run/vineyard.sock --size --stream_threshold 80 --etcd_cmd etcd --etcd_prefix /vineyard --etcd_endpoint http://vineyard-sidecar-etcd-service:2379
/usr/local/bin/vineyardd --sync_crds true --socket /var/run/vineyard.sock --size --stream_threshold 80 --etcd_cmd etcd --etcd_prefix /vineyard --etcd_endpoint http://vineyard-sidecar-etcd-service:2379
env:
- name: VINEYARDD_UID
value: null
Expand Down Expand Up @@ -285,7 +285,7 @@ spec:
- /bin/bash
- -c
- |
/usr/bin/wait-for-it.sh -t 60 vineyard-sidecar-etcd-service.vineyard-system.svc.cluster.local:2379; sleep 1; /usr/local/bin/vineyardd --sync_crds true --socket /var/run/vineyard.sock --size --stream_threshold 80 --etcd_cmd etcd --etcd_prefix /vineyard --etcd_endpoint http://vineyard-sidecar-etcd-service:2379
/usr/local/bin/vineyardd --sync_crds true --socket /var/run/vineyard.sock --size --stream_threshold 80 --etcd_cmd etcd --etcd_prefix /vineyard --etcd_endpoint http://vineyard-sidecar-etcd-service:2379
env:
- name: VINEYARDD_UID
value: null
Expand Down
2 changes: 0 additions & 2 deletions k8s/pkg/templates/sidecar/injection-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ spec:
- /bin/bash
- -c
- >
/usr/bin/wait-for-it.sh -t 60 {{ .Name }}-etcd-service.{{ .Namespace }}.svc.cluster.local:2379;
sleep 1;
/usr/local/bin/vineyardd
--sync_crds {{ .Spec.Vineyard.SyncCRDs }}
{{- if .Spec.Volume.MountPath }}
Expand Down
2 changes: 0 additions & 2 deletions k8s/pkg/templates/vineyardd/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ spec:
- /bin/bash
- -c
- >
/usr/bin/wait-for-it.sh -t 60 {{ .Name }}-etcd-service.{{ .Namespace }}.svc.cluster.local:2379;
sleep 1;
/usr/local/bin/vineyardd
--sync_crds {{ .Spec.Vineyard.SyncCRDs }}
{{- if .Spec.Volume.MountPath }}
Expand Down
8 changes: 4 additions & 4 deletions k8s/test/e2e/sidecar-demo/sidecar-with-custom-sidecar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,27 @@ metadata:
namespace: vineyard-job
spec:
replicas: 2
selector: app=job-deployment-with-custom-sidecar
selector: app=job-deployment
vineyard:
image: localhost:5001/vineyardd:latest
socket: /var/run/vineyard.sock
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: job-deployment-with-custom-sidecar
name: job-deployment
namespace: vineyard-job
spec:
selector:
matchLabels:
app: job-deployment-with-custom-sidecar
app: job-deployment
replicas: 2
template:
metadata:
annotations:
sidecar.v6d.io/name: "sidecar-sample"
labels:
app: job-deployment-with-custom-sidecar
app: job-deployment
sidecar.v6d.io/enabled: "true"
spec:
containers:
Expand Down
8 changes: 4 additions & 4 deletions k8s/test/e2e/sidecar-demo/sidecar-with-default-sidecar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: job-deployment-with-default-sidecar
name: job-deployment
namespace: vineyard-job
spec:
selector:
matchLabels:
app: job-deployment-with-default-sidecar
app: job-deployment
replicas: 2
template:
metadata:
annotations:
sidecar.v6d.io/name: "default"
labels:
app.kubernetes.io/instance: job-deployment-with-default-sidecar
app: job-deployment-with-default-sidecar
app.kubernetes.io/instance: job-deployment
app: job-deployment
sidecar.v6d.io/enabled: "true"
spec:
containers:
Expand Down
8 changes: 5 additions & 3 deletions k8s/test/e2e/sidecar/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,27 @@ setup:
--sidecar.image="localhost:5001/vineyardd:latest"| kubectl apply -f -
wait:
- namespace: vineyard-job
resource: deployment/job-deployment-with-default-sidecar
resource: deployment/job-deployment
for: condition=Available
- name: install app with default sidecar via kubectl
command: |
kubectl create namespace vineyard-job1
kubectl label namespace vineyard-job1 sidecar-injection=enabled
docker tag localhost:5001/vineyardd:latest vineyardcloudnative/vineyardd:latest
kind load docker-image vineyardcloudnative/vineyardd:latest
sed -e 's/vineyard-job/vineyard-job1/g' k8s/test/e2e/sidecar-demo/sidecar-with-default-sidecar.yaml | \
kubectl apply -f -
wait:
- namespace: vineyard-job1
resource: deployment/job-deployment-with-default-sidecar
resource: deployment/job-deployment
for: condition=Available
- name: install app with custom sidecar
command: |
kubectl label namespace vineyard-job sidecar-injection=enabled
kubectl apply -f k8s/test/e2e/sidecar-demo/sidecar-with-custom-sidecar.yaml
wait:
- namespace: vineyard-job
resource: deployment/job-deployment-with-custom-sidecar
resource: deployment/job-deployment
for: condition=Available
timeout: 20m

Expand Down

0 comments on commit becb894

Please sign in to comment.