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

Support GCP app default credentials for backups/sidecar #366

Merged
merged 4 commits into from
Jul 8, 2019
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
4 changes: 2 additions & 2 deletions Dockerfile.sidecar
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ RUN apt-get update \
COPY hack/docker/rclone.gpg /root/rclone.gpg
RUN gpg --import /root/rclone.gpg

RUN wget -nv https://github.com/ncw/rclone/releases/download/v1.46/rclone-v1.46-linux-amd64.zip \
&& wget -nv https://github.com/ncw/rclone/releases/download/v1.46/SHA256SUMS \
RUN wget -nv https://github.com/ncw/rclone/releases/download/v1.48.0/rclone-v1.48.0-linux-amd64.zip \
&& wget -nv https://github.com/ncw/rclone/releases/download/v1.48.0/SHA256SUMS \
&& gpg --verify --output=- SHA256SUMS > sums \
&& sha256sum -c --ignore-missing sums \
&& unzip rclone-*-linux-amd64.zip \
Expand Down
12 changes: 8 additions & 4 deletions hack/docker/sidecar-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
set -e

echo "Create rclone.conf file."
Expand Down Expand Up @@ -30,10 +30,14 @@ account = ${AZUREBLOB_ACCOUNT}
key = ${AZUREBLOB_KEY}
EOF

echo "Create google-credentials.json file."
cat <<EOF > /tmp/google-credentials.json
${GCS_SERVICE_ACCOUNT_JSON_KEY}
if [[ -n "${GCS_SERVICE_ACCOUNT_JSON_KEY:-}" ]]; then
echo "Create google-credentials.json file."
cat <<EOF > /tmp/google-credentials.json
${GCS_SERVICE_ACCOUNT_JSON_KEY}
EOF
else
touch /tmp/google-credentials.json
fi

SIDECAR_BIN=mysql-operator-sidecar
VERBOSE="--debug"
Expand Down
8 changes: 8 additions & 0 deletions pkg/controller/mysqlbackup/internal/syncer/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ func (s *jobSyncer) ensurePodSpec(in core.PodSpec) core.PodSpec {
s.backup.GetBackupURL(s.cluster),
}

in.ServiceAccountName = s.cluster.Spec.PodSpec.ServiceAccountName

in.Affinity = s.cluster.Spec.PodSpec.Affinity
in.ImagePullSecrets = s.cluster.Spec.PodSpec.ImagePullSecrets
in.NodeSelector = s.cluster.Spec.PodSpec.NodeSelector
in.PriorityClassName = s.cluster.Spec.PodSpec.PriorityClassName
in.Tolerations = s.cluster.Spec.PodSpec.Tolerations

boolTrue := true
in.Containers[0].Env = []core.EnvVar{
{
Expand Down