Skip to content
Open
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
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ mutationDiff/
source/
target/
xdcrDiffer
go.mod
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think go.mod and go.sum should be included
Otherwise, I'm getting

------
 > [builder 3/6] RUN make all:
0.169 go build -o xdcrDiffer -v
0.175 go: cannot find main module, but found .git/config in /go
0.175 	to create a module there, run:
0.175 	go mod init
0.176 make: *** [Makefile:17: build] Error 1
------

go.sum
xdcrDiffer.log

8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@

ARG BUILDER_IMAGE=docker.io/golang:1.23
ARG FINAL_IMAGE=docker.io/redhat/ubi9:9.4

ARG http_proxy
ARG https_proxy
ARG no_proxy

FROM $BUILDER_IMAGE as builder

ENV http_proxy=${http_proxy}
ENV https_proxy=${https_proxy}
ENV no_proxy=${no_proxy}

ENV LANG=en_US.utf8
ENV LC_ALL=en_US.utf8

Expand All @@ -20,6 +26,7 @@ COPY . .

RUN echo "myuser:x:1001:1001::/:/xdcrDiffer" > /passwd


RUN go build -ldflags='-s -w -extldflags "-static"' -v \
-o xdcrDiffer main.go

Expand All @@ -33,3 +40,4 @@ COPY --from=builder /passwd /etc/passwd

ENTRYPOINT ["/runDiffer.sh"]


12 changes: 9 additions & 3 deletions runDiffer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function findExec() {
function printHelp() {
findExec

cat <<EOF
cat <<GG
This script will set up the necessary environment variable to allow the XDCR diff tool to connect to the metakv service in the
specified source cluster (NOTE: over http://) and retrieve the specified replication spec and run the difftool on it.

Expand Down Expand Up @@ -57,7 +57,7 @@ Example usage:
${BASH_SOURCE[0]} -h 127.0.0.1:8091 -u admin -p password -s sourceBucket -t targetBucket -r remoteCluster -c
${BASH_SOURCE[0]} --hostname=127.0.0.1:8091 --username=admin --password=password --sourceBucket=sourceBucketName --targetBucket=targetBucketName --remoteClusterName=RemoteRefName --clear
${BASH_SOURCE[0]} -y ./sampleConfig.yaml
EOF
GG
}

function waitForBgJobs {
Expand All @@ -67,7 +67,6 @@ function waitForBgJobs {
echo "Usage: wait_for_pid <pid>"
return 1
fi

# Loop until the process no longer exists
while kill -0 "$pid" 2>/dev/null; do
echo "Waiting for PID $pid to terminate..."
Expand Down Expand Up @@ -135,6 +134,9 @@ while getopts ":h:p:u:r:s:t:cm:e:w:d:o:y:-:" opt; do
debugMode)
debugMode=1
;;
enforceTLS)
enforceTLS=1
;;
username=*)
username=${OPTARG#*=}
;;
Expand Down Expand Up @@ -296,6 +298,10 @@ function setupFromCmdLine {
execString="${execString} -targetUrl"
execString="${execString} $targetUrl"
fi
if [[ ! -z "$enforceTLS" ]]; then
execString="${execString} -enforceTLS"
execString="${execString} $enforceTLS"
fi
if [[ ! -z "$maxFileDescs" ]]; then
execString="${execString} -numberOfFileDesc"
execString="${execString} $maxFileDescs"
Expand Down
21 changes: 21 additions & 0 deletions xdcr-differ-pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: v1
kind: Pod
metadata:
name: xdcr-differ-pod
labels:
app: xdcr-differ
spec:
containers:
- name: xdcr-differ
imagePullPolicy: IfNotPresent
image: my-repo/xdcr-differ:1.0.3
command: ["/bin/sleep", "infinity"]
volumeMounts:
- name: xdcr-differ-secret
#mountPath: /etc/ssl/certs/ca.crt # for ubuntu
mountPath: /etc/pki/ca-trust/source/anchors/ca.crt # for redhat
subPath: ca.crt
volumes:
- name: xdcr-differ-secret
secret:
secretName: platform-couchbase-cluster-plt-cbc-cluster-tls