mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-19 08:40:42 +00:00
A couple of more changes. Specifically, a) make the same changes to master-helper.sh for gci as container-linux.sh does; b) revert changes to sync.go and sync_test.go.
This commit is contained in:
parent
b40793e7dd
commit
79e9a9e065
@ -94,9 +94,16 @@ function create-master-instance-internal() {
|
|||||||
preemptible_master="--preemptible --maintenance-policy TERMINATE"
|
preemptible_master="--preemptible --maintenance-policy TERMINATE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
local enable_ip_aliases
|
||||||
|
if [[ "${NODE_IPAM_MODE:-}" == "CloudAllocator" ]]; then
|
||||||
|
enable_ip_aliases=true
|
||||||
|
else
|
||||||
|
enable_ip_aliases=false
|
||||||
|
fi
|
||||||
|
|
||||||
local network=$(make-gcloud-network-argument \
|
local network=$(make-gcloud-network-argument \
|
||||||
"${NETWORK_PROJECT}" "${REGION}" "${NETWORK}" "${SUBNETWORK:-}" \
|
"${NETWORK_PROJECT}" "${REGION}" "${NETWORK}" "${SUBNETWORK:-}" \
|
||||||
"${address:-}" "${ENABLE_IP_ALIASES:-}" "${IP_ALIAS_SIZE:-}")
|
"${address:-}" "${enable_ip_aliases:-}" "${IP_ALIAS_SIZE:-}")
|
||||||
|
|
||||||
local metadata="kube-env=${KUBE_TEMP}/master-kube-env.yaml"
|
local metadata="kube-env=${KUBE_TEMP}/master-kube-env.yaml"
|
||||||
metadata="${metadata},user-data=${KUBE_ROOT}/cluster/gce/gci/master.yaml"
|
metadata="${metadata},user-data=${KUBE_ROOT}/cluster/gce/gci/master.yaml"
|
||||||
|
@ -244,7 +244,9 @@ func (op *updateOp) validateRange(ctx context.Context, sync *NodeSync, node *v1.
|
|||||||
// alias.
|
// alias.
|
||||||
func (op *updateOp) updateNodeFromAlias(ctx context.Context, sync *NodeSync, node *v1.Node, aliasRange *net.IPNet) error {
|
func (op *updateOp) updateNodeFromAlias(ctx context.Context, sync *NodeSync, node *v1.Node, aliasRange *net.IPNet) error {
|
||||||
if sync.mode != SyncFromCloud {
|
if sync.mode != SyncFromCloud {
|
||||||
glog.Warningf("Detect mode %q while expect to sync from cloud", sync.mode)
|
sync.kubeAPI.EmitNodeWarningEvent(node.Name, InvalidModeEvent,
|
||||||
|
"Cannot sync from cloud in mode %q", sync.mode)
|
||||||
|
return fmt.Errorf("cannot sync from cloud in mode %q", sync.mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.V(2).Infof("Updating node spec with alias range, node.PodCIDR = %v", aliasRange)
|
glog.V(2).Infof("Updating node spec with alias range, node.PodCIDR = %v", aliasRange)
|
||||||
@ -274,7 +276,9 @@ func (op *updateOp) updateNodeFromAlias(ctx context.Context, sync *NodeSync, nod
|
|||||||
// updateAliasFromNode updates the cloud alias given the node allocation.
|
// updateAliasFromNode updates the cloud alias given the node allocation.
|
||||||
func (op *updateOp) updateAliasFromNode(ctx context.Context, sync *NodeSync, node *v1.Node) error {
|
func (op *updateOp) updateAliasFromNode(ctx context.Context, sync *NodeSync, node *v1.Node) error {
|
||||||
if sync.mode != SyncFromCluster {
|
if sync.mode != SyncFromCluster {
|
||||||
glog.Warningf("Detect mode %q while expect to sync from cluster", sync.mode)
|
sync.kubeAPI.EmitNodeWarningEvent(
|
||||||
|
node.Name, InvalidModeEvent, "Cannot sync to cloud in mode %q", sync.mode)
|
||||||
|
return fmt.Errorf("cannot sync to cloud in mode %q", sync.mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, aliasRange, err := net.ParseCIDR(node.Spec.PodCIDR)
|
_, aliasRange, err := net.ParseCIDR(node.Spec.PodCIDR)
|
||||||
|
@ -145,10 +145,11 @@ func TestNodeSyncUpdate(t *testing.T) {
|
|||||||
events: []fakeEvent{{"node1", "CloudCIDRAllocatorMismatch"}},
|
events: []fakeEvent{{"node1", "CloudCIDRAllocatorMismatch"}},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
desc: "update alias from node",
|
desc: "update alias from node",
|
||||||
mode: SyncFromCloud,
|
mode: SyncFromCloud,
|
||||||
node: nodeWithCIDRRange,
|
node: nodeWithCIDRRange,
|
||||||
events: nil,
|
events: []fakeEvent{{"node1", "CloudCIDRAllocatorInvalidMode"}},
|
||||||
|
wantError: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
desc: "update alias from node",
|
desc: "update alias from node",
|
||||||
@ -164,11 +165,12 @@ func TestNodeSyncUpdate(t *testing.T) {
|
|||||||
// XXX/bowei -- validation
|
// XXX/bowei -- validation
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
desc: "update node from alias",
|
desc: "update node from alias",
|
||||||
mode: SyncFromCluster,
|
mode: SyncFromCluster,
|
||||||
node: nodeWithoutCIDRRange,
|
node: nodeWithoutCIDRRange,
|
||||||
fake: fakeAPIs{aliasRange: test.MustParseCIDR("10.1.2.3/16")},
|
fake: fakeAPIs{aliasRange: test.MustParseCIDR("10.1.2.3/16")},
|
||||||
events: nil,
|
events: []fakeEvent{{"node1", "CloudCIDRAllocatorInvalidMode"}},
|
||||||
|
wantError: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
desc: "allocate range",
|
desc: "allocate range",
|
||||||
|
Loading…
Reference in New Issue
Block a user