mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #41065 from wojtek-t/default_target_storage_in_etcd
Automatic merge from submit-queue (batch tested with PRs 40873, 40948, 39580, 41065, 40815) Default target storage in etcd To make etcd v2->v3 upgrade work correctly, we need to correctly set the "TARGET_STORAGE" env var. Since in head we are defaulting to etcd v3, this PR is defaulting also that env var to etcd3, so that by default upgrade works fine. @fgrzadkowski @gmarek
This commit is contained in:
commit
e280e27f9b
@ -655,8 +655,16 @@ function prepare-etcd-manifest {
|
||||
sed -i -e "s@{{ *hostname *}}@$host_name@g" "${temp_file}"
|
||||
sed -i -e "s@{{ *srv_kube_path *}}@/etc/srv/kubernetes@g" "${temp_file}"
|
||||
sed -i -e "s@{{ *etcd_cluster *}}@$etcd_cluster@g" "${temp_file}"
|
||||
sed -i -e "s@{{ *storage_backend *}}@${STORAGE_BACKEND:-}@g" "${temp_file}"
|
||||
if [[ "${STORAGE_BACKEND:-}" == "etcd3" ]]; then
|
||||
# Get default storage backend from manifest file.
|
||||
local -r default_storage_backend=$(cat "${temp_file}" | \
|
||||
grep -o "{{ *pillar\.get('storage_backend', '\(.*\)') *}}" | \
|
||||
sed -e "s@{{ *pillar\.get('storage_backend', '\(.*\)') *}}@\1@g")
|
||||
if [[ -n "${STORAGE_BACKEND:-}" ]]; then
|
||||
sed -i -e "s@{{ *pillar\.get('storage_backend', '\(.*\)') *}}@${STORAGE_BACKEND}@g" "${temp_file}"
|
||||
else
|
||||
sed -i -e "s@{{ *pillar\.get('storage_backend', '\(.*\)') *}}@\1@g" "${temp_file}"
|
||||
fi
|
||||
if [[ "${STORAGE_BACKEND:-${default_storage_backend}}" == "etcd3" ]]; then
|
||||
sed -i -e "s@{{ *quota_bytes *}}@--quota-backend-bytes=4294967296@g" "${temp_file}"
|
||||
else
|
||||
sed -i -e "s@{{ *quota_bytes *}}@@g" "${temp_file}"
|
||||
|
@ -721,8 +721,16 @@ function prepare-etcd-manifest {
|
||||
sed -i -e "s@{{ *hostname *}}@$host_name@g" "${temp_file}"
|
||||
sed -i -e "s@{{ *srv_kube_path *}}@/etc/srv/kubernetes@g" "${temp_file}"
|
||||
sed -i -e "s@{{ *etcd_cluster *}}@$etcd_cluster@g" "${temp_file}"
|
||||
sed -i -e "s@{{ *storage_backend *}}@${STORAGE_BACKEND:-}@g" "${temp_file}"
|
||||
if [[ "${STORAGE_BACKEND:-}" == "etcd3" ]]; then
|
||||
# Get default storage backend from manifest file.
|
||||
local -r default_storage_backend=$(cat "${temp_file}" | \
|
||||
grep -o "{{ *pillar\.get('storage_backend', '\(.*\)') *}}" | \
|
||||
sed -e "s@{{ *pillar\.get('storage_backend', '\(.*\)') *}}@\1@g")
|
||||
if [[ -n "${STORAGE_BACKEND:-}" ]]; then
|
||||
sed -i -e "s@{{ *pillar\.get('storage_backend', '\(.*\)') *}}@${STORAGE_BACKEND}@g" "${temp_file}"
|
||||
else
|
||||
sed -i -e "s@{{ *pillar\.get('storage_backend', '\(.*\)') *}}@\1@g" "${temp_file}"
|
||||
fi
|
||||
if [[ "${STORAGE_BACKEND:-${default_storage_backend}}" == "etcd3" ]]; then
|
||||
sed -i -e "s@{{ *quota_bytes *}}@--quota-backend-bytes=4294967296@g" "${temp_file}"
|
||||
else
|
||||
sed -i -e "s@{{ *quota_bytes *}}@@g" "${temp_file}"
|
||||
|
@ -476,8 +476,16 @@ prepare_etcd_manifest() {
|
||||
sed -i -e "s@{{ *srv_kube_path *}}@/etc/srv/kubernetes@g" "${etcd_temp_file}"
|
||||
sed -i -e "s@{{ *hostname *}}@$host_name@g" "${etcd_temp_file}"
|
||||
sed -i -e "s@{{ *etcd_cluster *}}@$etcd_cluster@g" "${etcd_temp_file}"
|
||||
sed -i -e "s@{{ *storage_backend *}}@${STORAGE_BACKEND:-}@g" "${temp_file}"
|
||||
if [[ "${STORAGE_BACKEND:-}" == "etcd3" ]]; then
|
||||
# Get default storage backend from manifest file.
|
||||
local -r default_storage_backend=$(cat "${temp_file}" | \
|
||||
grep -o "{{ *pillar\.get('storage_backend', '\(.*\)') *}}" | \
|
||||
sed -e "s@{{ *pillar\.get('storage_backend', '\(.*\)') *}}@\1@g")
|
||||
if [[ -n "${STORAGE_BACKEND:-}" ]]; then
|
||||
sed -i -e "s@{{ *pillar\.get('storage_backend', '\(.*\)') *}}@${STORAGE_BACKEND}@g" "${temp_file}"
|
||||
else
|
||||
sed -i -e "s@{{ *pillar\.get('storage_backend', '\(.*\)') *}}@\1@g" "${temp_file}"
|
||||
fi
|
||||
if [[ "${STORAGE_BACKEND:-${default_storage_backend}}" == "etcd3" ]]; then
|
||||
sed -i -e "s@{{ *quota_bytes *}}@--quota-backend-bytes=4294967296@g" "${temp_file}"
|
||||
else
|
||||
sed -i -e "s@{{ *quota_bytes *}}@@g" "${temp_file}"
|
||||
|
@ -40,16 +40,16 @@ set -o errexit
|
||||
set -o nounset
|
||||
|
||||
if [ -z "${TARGET_STORAGE:-}" ]; then
|
||||
echo "TARGET_STORAGE variable unset - skipping migration"
|
||||
exit 0
|
||||
echo "TARGET_STORAGE variable unset - unexpected failure"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${TARGET_VERSION:-}" ]; then
|
||||
echo "TARGET_VERSION variable unset - skipping migration"
|
||||
exit 0
|
||||
echo "TARGET_VERSION variable unset - unexpected failure"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${DATA_DIRECTORY:-}" ]; then
|
||||
echo "DATA_DIRECTORY variable unset - skipping migration"
|
||||
exit 0
|
||||
echo "DATA_DIRECTORY variable unset - unexpected failure"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${TARGET_STORAGE}" != "etcd2" -a "${TARGET_STORAGE}" != "etcd3" ]; then
|
||||
|
@ -20,7 +20,6 @@
|
||||
{% endfor -%}
|
||||
{% set etcd_cluster = vars.etcd_cluster -%}
|
||||
{% set cluster_state = vars.cluster_state -%}
|
||||
{% set storage_backend = pillar.get('storage_backend', 'etcd3') -%}
|
||||
{% set quota_bytes = '' -%}
|
||||
{% if pillar.get('storage_backend', 'etcd3') == 'etcd3' -%}
|
||||
{% set quota_bytes = '--quota-backend-bytes=4294967296' -%}
|
||||
@ -52,7 +51,7 @@
|
||||
],
|
||||
"env": [
|
||||
{ "name": "TARGET_STORAGE",
|
||||
"value": "{{ storage_backend }}"
|
||||
"value": "{{ pillar.get('storage_backend', 'etcd3') }}"
|
||||
},
|
||||
{ "name": "TARGET_VERSION",
|
||||
"value": "{{ pillar.get('etcd_version', '3.0.14') }}"
|
||||
|
@ -16,17 +16,26 @@ cluster/gce/configure-vm.sh: env-to-grains "runtime_config"
|
||||
cluster/gce/configure-vm.sh: kubelet_api_servers: '${KUBELET_APISERVER}'
|
||||
cluster/gce/container-linux/configure-helper.sh: authorization_mode+=",ABAC"
|
||||
cluster/gce/container-linux/configure-helper.sh: authorization_mode+=",Webhook"
|
||||
cluster/gce/container-linux/configure-helper.sh: grep -o "{{ *pillar\.get('storage_backend', '\(.*\)') *}}" | \
|
||||
cluster/gce/container-linux/configure-helper.sh: sed -e "s@{{ *pillar\.get('storage_backend', '\(.*\)') *}}@\1@g")
|
||||
cluster/gce/container-linux/configure-helper.sh: sed -i -e "s@{{ *pillar\.get('storage_backend', '\(.*\)') *}}@${STORAGE_BACKEND}@g" "${temp_file}"
|
||||
cluster/gce/container-linux/configure-helper.sh: sed -i -e "s@{{ *pillar\.get('storage_backend', '\(.*\)') *}}@\1@g" "${temp_file}"
|
||||
cluster/gce/container-linux/configure-helper.sh: local api_servers="--master=https://${KUBERNETES_MASTER_NAME}"
|
||||
cluster/gce/container-linux/configure-helper.sh: local authorization_mode="RBAC"
|
||||
cluster/gce/container-linux/configure-helper.sh: sed -i -e "s@{{ *storage_backend *}}@${STORAGE_BACKEND:-}@g" "${temp_file}"
|
||||
cluster/gce/container-linux/configure-helper.sh: sed -i -e "s@{{pillar\['allow_privileged'\]}}@true@g" "${src_file}"
|
||||
cluster/gce/gci/configure-helper.sh: authorization_mode+=",ABAC"
|
||||
cluster/gce/gci/configure-helper.sh: authorization_mode+=",Webhook"
|
||||
cluster/gce/gci/configure-helper.sh: grep -o "{{ *pillar\.get('storage_backend', '\(.*\)') *}}" | \
|
||||
cluster/gce/gci/configure-helper.sh: sed -e "s@{{ *pillar\.get('storage_backend', '\(.*\)') *}}@\1@g")
|
||||
cluster/gce/gci/configure-helper.sh: sed -i -e "s@{{ *pillar\.get('storage_backend', '\(.*\)') *}}@${STORAGE_BACKEND}@g" "${temp_file}"
|
||||
cluster/gce/gci/configure-helper.sh: sed -i -e "s@{{ *pillar\.get('storage_backend', '\(.*\)') *}}@\1@g" "${temp_file}"
|
||||
cluster/gce/gci/configure-helper.sh: local api_servers="--master=https://${KUBERNETES_MASTER_NAME}"
|
||||
cluster/gce/gci/configure-helper.sh: local authorization_mode="RBAC"
|
||||
cluster/gce/gci/configure-helper.sh: sed -i -e "s@{{ *storage_backend *}}@${STORAGE_BACKEND:-}@g" "${temp_file}"
|
||||
cluster/gce/gci/configure-helper.sh: sed -i -e "s@{{pillar\['allow_privileged'\]}}@true@g" "${src_file}"
|
||||
cluster/gce/trusty/configure-helper.sh: sed -i -e "s@{{ *storage_backend *}}@${STORAGE_BACKEND:-}@g" "${temp_file}"
|
||||
cluster/gce/trusty/configure-helper.sh: grep -o "{{ *pillar\.get('storage_backend', '\(.*\)') *}}" | \
|
||||
cluster/gce/trusty/configure-helper.sh: sed -e "s@{{ *pillar\.get('storage_backend', '\(.*\)') *}}@\1@g")
|
||||
cluster/gce/trusty/configure-helper.sh: sed -i -e "s@{{ *pillar\.get('storage_backend', '\(.*\)') *}}@${STORAGE_BACKEND}@g" "${temp_file}"
|
||||
cluster/gce/trusty/configure-helper.sh: sed -i -e "s@{{ *pillar\.get('storage_backend', '\(.*\)') *}}@\1@g" "${temp_file}"
|
||||
cluster/gce/trusty/configure-helper.sh: sed -i -e "s@{{pillar\['allow_privileged'\]}}@true@g" "${src_file}"
|
||||
cluster/gce/util.sh: local node_ip=$(gcloud compute instances describe --project "${PROJECT}" --zone "${ZONE}" \
|
||||
cluster/juju/layers/kubernetes-master/reactive/kubernetes_master.py: context['pillar'] = {'num_nodes': get_node_count()}
|
||||
@ -50,9 +59,8 @@ cluster/photon-controller/util.sh: node_name=${1}
|
||||
cluster/photon-controller/util.sh: ssh_key=$(ssh-add -L | head -1)
|
||||
cluster/rackspace/util.sh: local node_ip=$(nova show --minimal ${NODE_NAMES[$i]} \
|
||||
cluster/saltbase/salt/cluster-autoscaler/cluster-autoscaler.manifest:{% set params = pillar['autoscaler_mig_config'] + " " + cloud_config -%}
|
||||
cluster/saltbase/salt/etcd/etcd.manifest: "value": "{{ storage_backend }}"
|
||||
cluster/saltbase/salt/etcd/etcd.manifest: "value": "{{ pillar.get('storage_backend', 'etcd3') }}"
|
||||
cluster/saltbase/salt/etcd/etcd.manifest:{% if pillar.get('storage_backend', 'etcd3') == 'etcd3' -%}
|
||||
cluster/saltbase/salt/etcd/etcd.manifest:{% set storage_backend = pillar.get('storage_backend', 'etcd3') -%}
|
||||
cluster/saltbase/salt/kube-admission-controls/init.sls:{% if 'LimitRanger' in pillar.get('admission_control', '') %}
|
||||
cluster/saltbase/salt/kube-apiserver/kube-apiserver.manifest:{% set params = address + " " + storage_backend + " " + etcd_servers + " " + etcd_servers_overrides + " " + cloud_provider + " " + cloud_config + " " + runtime_config + " " + feature_gates + " " + admission_control + " " + max_requests_inflight + " " + target_ram_mb + " " + service_cluster_ip_range + " " + client_ca_file + basic_auth_file + " " + min_request_timeout + " " + enable_garbage_collector + " " + etcd_quorum_read -%}
|
||||
cluster/saltbase/salt/kube-controller-manager/kube-controller-manager.manifest:{% if pillar.get('enable_hostpath_provisioner', '').lower() == 'true' -%}
|
||||
|
Loading…
Reference in New Issue
Block a user