mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 18:00:08 +00:00
"gcloud beta compute networks subnets" stopped working, fails with the
erros: - The request did not match the specified API. "gcloud compute networks subnets" works with the latest gcloud release.
This commit is contained in:
parent
e5964b3fcc
commit
f4482e3abb
@ -83,9 +83,6 @@ function create-master-instance-internal() {
|
|||||||
retries=30
|
retries=30
|
||||||
sleep_sec=60
|
sleep_sec=60
|
||||||
fi
|
fi
|
||||||
if [[ "${ENABLE_IP_ALIASES:-}" == 'true' ]]; then
|
|
||||||
gcloud="gcloud beta"
|
|
||||||
fi
|
|
||||||
|
|
||||||
local -r master_name="${1}"
|
local -r master_name="${1}"
|
||||||
local -r address="${2:-}"
|
local -r address="${2:-}"
|
||||||
|
@ -68,7 +68,7 @@ function detect-k8s-subnetwork() {
|
|||||||
# REGION
|
# REGION
|
||||||
function set-allow-subnet-cidr-routes-overlap() {
|
function set-allow-subnet-cidr-routes-overlap() {
|
||||||
local allow_subnet_cidr_routes_overlap
|
local allow_subnet_cidr_routes_overlap
|
||||||
allow_subnet_cidr_routes_overlap=$(gcloud beta compute networks subnets \
|
allow_subnet_cidr_routes_overlap=$(gcloud compute networks subnets \
|
||||||
describe ${IP_ALIAS_SUBNETWORK} --project=${PROJECT} --region=${REGION} \
|
describe ${IP_ALIAS_SUBNETWORK} --project=${PROJECT} --region=${REGION} \
|
||||||
--format='value(allowSubnetCidrRoutesOverlap)')
|
--format='value(allowSubnetCidrRoutesOverlap)')
|
||||||
local allow_overlap=$1
|
local allow_overlap=$1
|
||||||
@ -78,7 +78,7 @@ function set-allow-subnet-cidr-routes-overlap() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Setting subnet \"${IP_ALIAS_SUBNETWORK}\" allowSubnetCidrRoutesOverlap to $1"
|
echo "Setting subnet \"${IP_ALIAS_SUBNETWORK}\" allowSubnetCidrRoutesOverlap to $1"
|
||||||
local fingerprint=$(gcloud beta compute networks subnets describe \
|
local fingerprint=$(gcloud compute networks subnets describe \
|
||||||
${IP_ALIAS_SUBNETWORK} --project=${PROJECT} --region=${REGION} \
|
${IP_ALIAS_SUBNETWORK} --project=${PROJECT} --region=${REGION} \
|
||||||
--format='value(fingerprint)')
|
--format='value(fingerprint)')
|
||||||
local access_token=$(gcloud auth print-access-token)
|
local access_token=$(gcloud auth print-access-token)
|
||||||
@ -100,7 +100,7 @@ function set-allow-subnet-cidr-routes-overlap() {
|
|||||||
# CLUSTER_IP_RANGE
|
# CLUSTER_IP_RANGE
|
||||||
# SERVICE_CLUSTER_IP_RANGE
|
# SERVICE_CLUSTER_IP_RANGE
|
||||||
function add-k8s-subnet-secondary-ranges() {
|
function add-k8s-subnet-secondary-ranges() {
|
||||||
local secondary_ranges=$(gcloud beta compute networks subnets describe "${IP_ALIAS_SUBNETWORK}" \
|
local secondary_ranges=$(gcloud compute networks subnets describe "${IP_ALIAS_SUBNETWORK}" \
|
||||||
--project="${PROJECT}" --region="${REGION}" \
|
--project="${PROJECT}" --region="${REGION}" \
|
||||||
--format='value(secondaryIpRanges)')
|
--format='value(secondaryIpRanges)')
|
||||||
if [[ "${secondary_ranges}" =~ "pods-default" && "${secondary_ranges}" =~ "services-default" ]]; then
|
if [[ "${secondary_ranges}" =~ "pods-default" && "${secondary_ranges}" =~ "services-default" ]]; then
|
||||||
@ -109,7 +109,7 @@ function add-k8s-subnet-secondary-ranges() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Adding secondary ranges: pods-default (${CLUSTER_IP_RANGE}), services-default (${SERVICE_CLUSTER_IP_RANGE})"
|
echo "Adding secondary ranges: pods-default (${CLUSTER_IP_RANGE}), services-default (${SERVICE_CLUSTER_IP_RANGE})"
|
||||||
until gcloud beta compute networks subnets update ${IP_ALIAS_SUBNETWORK} \
|
until gcloud compute networks subnets update ${IP_ALIAS_SUBNETWORK} \
|
||||||
--project=${PROJECT} --region=${REGION} \
|
--project=${PROJECT} --region=${REGION} \
|
||||||
--add-secondary-ranges="pods-default=${CLUSTER_IP_RANGE},services-default=${SERVICE_CLUSTER_IP_RANGE}"; do
|
--add-secondary-ranges="pods-default=${CLUSTER_IP_RANGE},services-default=${SERVICE_CLUSTER_IP_RANGE}"; do
|
||||||
printf "."
|
printf "."
|
||||||
|
@ -1665,10 +1665,6 @@ function create-node-template() {
|
|||||||
gcloud="gcloud beta"
|
gcloud="gcloud beta"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${ENABLE_IP_ALIASES:-}" == 'true' ]]; then
|
|
||||||
gcloud="gcloud beta"
|
|
||||||
fi
|
|
||||||
|
|
||||||
local preemptible_minions=""
|
local preemptible_minions=""
|
||||||
if [[ "${PREEMPTIBLE_NODE}" == "true" ]]; then
|
if [[ "${PREEMPTIBLE_NODE}" == "true" ]]; then
|
||||||
preemptible_minions="--preemptible --maintenance-policy TERMINATE"
|
preemptible_minions="--preemptible --maintenance-policy TERMINATE"
|
||||||
@ -1903,13 +1899,13 @@ function create-subnetworks() {
|
|||||||
|
|
||||||
# Look for the alias subnet, it must exist and have a secondary
|
# Look for the alias subnet, it must exist and have a secondary
|
||||||
# range configured.
|
# range configured.
|
||||||
local subnet=$(gcloud beta compute networks subnets describe \
|
local subnet=$(gcloud compute networks subnets describe \
|
||||||
--project "${NETWORK_PROJECT}" \
|
--project "${NETWORK_PROJECT}" \
|
||||||
--region ${REGION} \
|
--region ${REGION} \
|
||||||
${IP_ALIAS_SUBNETWORK} 2>/dev/null)
|
${IP_ALIAS_SUBNETWORK} 2>/dev/null)
|
||||||
if [[ -z ${subnet} ]]; then
|
if [[ -z ${subnet} ]]; then
|
||||||
echo "Creating subnet ${NETWORK}:${IP_ALIAS_SUBNETWORK}"
|
echo "Creating subnet ${NETWORK}:${IP_ALIAS_SUBNETWORK}"
|
||||||
gcloud beta compute networks subnets create \
|
gcloud compute networks subnets create \
|
||||||
${IP_ALIAS_SUBNETWORK} \
|
${IP_ALIAS_SUBNETWORK} \
|
||||||
--description "Automatically generated subnet for ${INSTANCE_PREFIX} cluster. This will be removed on cluster teardown." \
|
--description "Automatically generated subnet for ${INSTANCE_PREFIX} cluster. This will be removed on cluster teardown." \
|
||||||
--project "${NETWORK_PROJECT}" \
|
--project "${NETWORK_PROJECT}" \
|
||||||
@ -1948,7 +1944,7 @@ function detect-subnetworks() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
SUBNETWORK=$(gcloud beta compute networks subnets list \
|
SUBNETWORK=$(gcloud compute networks subnets list \
|
||||||
--network=${NETWORK} \
|
--network=${NETWORK} \
|
||||||
--regions=${REGION} \
|
--regions=${REGION} \
|
||||||
--project=${NETWORK_PROJECT} \
|
--project=${NETWORK_PROJECT} \
|
||||||
@ -2017,11 +2013,11 @@ function delete-subnetworks() {
|
|||||||
# Only delete the subnet if we created it (i.e it's not pre-existing).
|
# Only delete the subnet if we created it (i.e it's not pre-existing).
|
||||||
if [[ -z "${KUBE_GCE_IP_ALIAS_SUBNETWORK:-}" ]]; then
|
if [[ -z "${KUBE_GCE_IP_ALIAS_SUBNETWORK:-}" ]]; then
|
||||||
echo "Removing auto-created subnet ${NETWORK}:${IP_ALIAS_SUBNETWORK}"
|
echo "Removing auto-created subnet ${NETWORK}:${IP_ALIAS_SUBNETWORK}"
|
||||||
if [[ -n $(gcloud beta compute networks subnets describe \
|
if [[ -n $(gcloud compute networks subnets describe \
|
||||||
--project "${NETWORK_PROJECT}" \
|
--project "${NETWORK_PROJECT}" \
|
||||||
--region ${REGION} \
|
--region ${REGION} \
|
||||||
${IP_ALIAS_SUBNETWORK} 2>/dev/null) ]]; then
|
${IP_ALIAS_SUBNETWORK} 2>/dev/null) ]]; then
|
||||||
gcloud beta --quiet compute networks subnets delete \
|
gcloud --quiet compute networks subnets delete \
|
||||||
--project "${NETWORK_PROJECT}" \
|
--project "${NETWORK_PROJECT}" \
|
||||||
--region ${REGION} \
|
--region ${REGION} \
|
||||||
${IP_ALIAS_SUBNETWORK}
|
${IP_ALIAS_SUBNETWORK}
|
||||||
@ -2393,10 +2389,6 @@ function create-nodes() {
|
|||||||
function create-heapster-node() {
|
function create-heapster-node() {
|
||||||
local gcloud="gcloud"
|
local gcloud="gcloud"
|
||||||
|
|
||||||
if [[ "${ENABLE_IP_ALIASES:-}" == 'true' ]]; then
|
|
||||||
gcloud="gcloud beta"
|
|
||||||
fi
|
|
||||||
|
|
||||||
local network=$(make-gcloud-network-argument \
|
local network=$(make-gcloud-network-argument \
|
||||||
"${NETWORK_PROJECT}" \
|
"${NETWORK_PROJECT}" \
|
||||||
"${REGION}" \
|
"${REGION}" \
|
||||||
|
Loading…
Reference in New Issue
Block a user