mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #52520 from jpbetz/etcd_docker_repository
Automatic merge from submit-queue (batch tested with PRs 52520, 52033, 53626, 50478). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Add 'ETCD_DOCKER_REPOSITORY' env var override to 'cluster/' scripts. **What this PR does / why we need it**: This allows the etcd docker registry that is currently hard coded to `gcr.io/google_containers/etcd` in the `etcd.manifest` template to be overridden. This can be used to test new versions of etcd with kubernetes that have not yet been published to `gcr.io/google_containers/etcd` and also enables cluster operators that use the 'cluster/' scripts to manage the etcd images used by their cluster in an internal repository. Example usage: ``` $ export ETCD_DOCKER_REPOSITORY=gcr.io/jpbetz-public-images/etcd $ export ETCD_IMAGE=3.0.17 $ cluster/kube-up.sh ... $ gcloud compute ssh kubernetes-master ~ $ sudo cat /etc/kubernetes/manifests/etcd.manifest { "apiVersion": "v1", "kind": "Pod", "metadata": { "name":"etcd-server", ... }, "spec":{ "hostNetwork": true, "containers":[ { "name": "etcd-container", "image": "gcr.io/jpbetz-public-images/etcd:3.0.17", ... ``` **Release note**: ```release-note ```
This commit is contained in:
commit
ee567538f0
@ -828,6 +828,12 @@ EOF
|
||||
if [ -n "${ETCD_IMAGE:-}" ]; then
|
||||
cat >>$file <<EOF
|
||||
ETCD_IMAGE: $(yaml-quote ${ETCD_IMAGE})
|
||||
EOF
|
||||
fi
|
||||
# ETCD_DOCKER_REPOSITORY (if set) allows to use a custom etcd docker repository to pull the etcd image from.
|
||||
if [ -n "${ETCD_DOCKER_REPOSITORY:-}" ]; then
|
||||
cat >>$file <<EOF
|
||||
ETCD_DOCKER_REPOSITORY: $(yaml-quote ${ETCD_DOCKER_REPOSITORY})
|
||||
EOF
|
||||
fi
|
||||
# ETCD_VERSION (if set) allows you to use custom version of etcd.
|
||||
|
@ -146,6 +146,7 @@ HEAPSTER_MACHINE_TYPE="${HEAPSTER_MACHINE_TYPE:-}"
|
||||
# Set etcd image (e.g. gcr.io/google_containers/etcd) and version (e.g. 3.1.10) if you need
|
||||
# non-default version.
|
||||
ETCD_IMAGE="${TEST_ETCD_IMAGE:-}"
|
||||
ETCD_DOCKER_REPOSITORY="${TEST_ETCD_DOCKER_REPOSITORY:-}"
|
||||
ETCD_VERSION="${TEST_ETCD_VERSION:-}"
|
||||
|
||||
# Default Log level for all components in test clusters and variables to override it in specific components.
|
||||
|
@ -480,6 +480,11 @@ EOF
|
||||
if [ -n "${ETCD_IMAGE:-}" ]; then
|
||||
cat <<EOF >>/srv/salt-overlay/pillar/cluster-params.sls
|
||||
etcd_docker_tag: '$(echo "$ETCD_IMAGE" | sed -e "s/'/''/g")'
|
||||
EOF
|
||||
fi
|
||||
if [ -n "${ETCD_DOCKER_REPOSITORY:-}" ]; then
|
||||
cat <<EOF >>/srv/salt-overlay/pillar/cluster-params.sls
|
||||
etcd_docker_repository: '$(echo "$ETCD_DOCKER_REPOSITORY" | sed -e "s/'/''/g")'
|
||||
EOF
|
||||
fi
|
||||
if [ -n "${ETCD_VERSION:-}" ]; then
|
||||
|
@ -803,6 +803,11 @@ function prepare-etcd-manifest {
|
||||
else
|
||||
sed -i -e "s@{{ *pillar\.get('etcd_docker_tag', '\(.*\)') *}}@\1@g" "${temp_file}"
|
||||
fi
|
||||
if [[ -n "${ETCD_DOCKER_REPOSITORY:-}" ]]; then
|
||||
sed -i -e "s@{{ *pillar\.get('etcd_docker_repository', '\(.*\)') *}}@${ETCD_DOCKER_REPOSITORY}@g" "${temp_file}"
|
||||
else
|
||||
sed -i -e "s@{{ *pillar\.get('etcd_docker_repository', '\(.*\)') *}}@\1@g" "${temp_file}"
|
||||
fi
|
||||
|
||||
sed -i -e "s@{{ *etcd_protocol *}}@$etcd_protocol@g" "${temp_file}"
|
||||
sed -i -e "s@{{ *etcd_creds *}}@$etcd_creds@g" "${temp_file}"
|
||||
|
@ -1194,6 +1194,11 @@ function prepare-etcd-manifest {
|
||||
else
|
||||
sed -i -e "s@{{ *pillar\.get('etcd_docker_tag', '\(.*\)') *}}@\1@g" "${temp_file}"
|
||||
fi
|
||||
if [[ -n "${ETCD_DOCKER_REPOSITORY:-}" ]]; then
|
||||
sed -i -e "s@{{ *pillar\.get('etcd_docker_repository', '\(.*\)') *}}@${ETCD_DOCKER_REPOSITORY}@g" "${temp_file}"
|
||||
else
|
||||
sed -i -e "s@{{ *pillar\.get('etcd_docker_repository', '\(.*\)') *}}@\1@g" "${temp_file}"
|
||||
fi
|
||||
sed -i -e "s@{{ *etcd_protocol *}}@$etcd_protocol@g" "${temp_file}"
|
||||
sed -i -e "s@{{ *etcd_creds *}}@$etcd_creds@g" "${temp_file}"
|
||||
if [[ -n "${ETCD_VERSION:-}" ]]; then
|
||||
|
@ -39,7 +39,7 @@
|
||||
"containers":[
|
||||
{
|
||||
"name": "etcd-container",
|
||||
"image": "gcr.io/google_containers/etcd:{{ pillar.get('etcd_docker_tag', '3.1.10') }}",
|
||||
"image": "{{ pillar.get('etcd_docker_repository', 'gcr.io/google_containers/etcd') }}:{{ pillar.get('etcd_docker_tag', '3.1.10') }}",
|
||||
"resources": {
|
||||
"requests": {
|
||||
"cpu": {{ cpulimit }}
|
||||
|
Loading…
Reference in New Issue
Block a user