-
Notifications
You must be signed in to change notification settings - Fork 430
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1541 from CecileRobertMichon/async-proposal
Add proposal for Async Azure Resource Creation and Deletion
- Loading branch information
Showing
8 changed files
with
471 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Copyright 2021 The Kubernetes Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) | ||
|
||
SOURCES := $(shell find ${ROOT_DIR} -name \*.plantuml) | ||
DIAGRAMS := $(SOURCES:%.plantuml=%.png) | ||
|
||
# Hosts running SELinux need :z added to volume mounts | ||
SELINUX_ENABLED := $(shell cat /sys/fs/selinux/enforce 2> /dev/null || echo 0) | ||
|
||
ifeq ($(SELINUX_ENABLED),1) | ||
DOCKER_VOL_OPTS?=:z | ||
endif | ||
|
||
.PHONY: diagrams | ||
diagrams: $(DIAGRAMS) | ||
|
||
%.png: %.plantuml | ||
docker run \ | ||
--rm \ | ||
--volume ${ROOT_DIR}:/workdir$(DOCKER_VOL_OPTS) \ | ||
--user $(shell id -u):$(shell id -g) \ | ||
k8s.gcr.io/cluster-api/plantuml:1.2019.6 \ | ||
-v /workdir/$(shell echo '$^' | sed -e 's,.*docs/,,g' ) |
320 changes: 320 additions & 0 deletions
320
docs/proposals/20210716-async-azure-resource-creation-deletion.md
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
@startuml | ||
title Figure 2. Azure service async delete | ||
state longrunningopinprogress <<choice>> | ||
|
||
[*] --> longrunningopinprogress : start Delete | ||
longrunningopinprogress --> GetResultIfDone : long running operation\nalready in progress | ||
GetResultIfDone : fetch the future data from the scope | ||
GetResultIfDone : check if future is done | ||
|
||
GetResultIfDone --> [*] : requeue if not done | ||
GetResultIfDone --> UpdateStatus : done | ||
UpdateStatus : update the object conditions | ||
UpdateStatus --> [*] | ||
|
||
longrunningopinprogress --> Delete : no long running operation\n in progress | ||
Delete : DELETE the resource from Azure | ||
Delete : wait for the operation to complete | ||
Delete : timeout after x seconds | ||
|
||
Delete --> ResetLongRunningState : DELETE operation completes \n before timeout | ||
ResetLongRunningState : set the long running operation state to nil | ||
ResetLongRunningState --> UpdateStatus | ||
|
||
Delete --> StoreLongRunningState : DELETE operation does not\n complete before timeout | ||
StoreLongRunningState: store the future in long running operation state | ||
StoreLongRunningState --> UpdateStatus | ||
|
||
@enduml |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
@startuml | ||
title Figure 1. Azure service async reconcile | ||
state longrunningopinprogress <<choice>> | ||
|
||
[*] --> longrunningopinprogress : start Reconcile | ||
longrunningopinprogress --> GetResultIfDone : long running operation\nalready in progress | ||
GetResultIfDone : fetch the future data from the scope | ||
GetResultIfDone : check if future is done | ||
|
||
GetResultIfDone --> [*] : requeue if not done | ||
GetResultIfDone --> UpdateStatus : done | ||
UpdateStatus : update the resource spec and status | ||
UpdateStatus : update the object conditions | ||
UpdateStatus --> [*] | ||
|
||
longrunningopinprogress --> GetExisting : no long running operation\n in progress | ||
GetExisting : GET the resource from Azure if it exists | ||
GetExisting --> UpdateStatus : resource exists\n no update needed | ||
GetExisting --> CreateOrUpdate : resource does not exist,\n create it | ||
GetExisting --> CreateOrUpdate : resource exists\n but needs to be updated | ||
|
||
CreateOrUpdate : PUT the resource to Azure | ||
CreateOrUpdate : wait for the operation to complete | ||
CreateOrUpdate : timeout after x seconds | ||
|
||
CreateOrUpdate --> ResetLongRunningState : PUT operation completes \n before timeout | ||
ResetLongRunningState : set the long running operation state to nil | ||
ResetLongRunningState --> UpdateStatus | ||
|
||
CreateOrUpdate --> StoreLongRunningState : PUT operation does not\n complete before timeout | ||
StoreLongRunningState: store the future in long running operation state | ||
|
||
StoreLongRunningState --> UpdateStatus | ||
|
||
@enduml |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
@startuml | ||
hide empty description | ||
title Figure 3. AzureCluster reconcile loop | ||
|
||
[*] --> ReconcileResourceGroup : start AzureCluster Reconcile with global timeout | ||
|
||
ReconcileResourceGroup --> ReconcileVNet | ||
ReconcileResourceGroup -> UpdateStatus : context timeout exceeded | ||
ReconcileResourceGroup: start with local timeout | ||
ReconcileResourceGroup: each Azure call has its own timeout | ||
|
||
ReconcileVNet --> ReconcileSecurityGroups | ||
ReconcileVNet -> UpdateStatus : context timeout exceeded | ||
ReconcileVNet: start with local timeout | ||
ReconcileVNet: each Azure call has its own timeout | ||
|
||
ReconcileSecurityGroups --> ReconcileRoutesTables | ||
ReconcileSecurityGroups -> UpdateStatus : context timeout exceeded | ||
ReconcileSecurityGroups: start with local timeout | ||
ReconcileSecurityGroups: each Azure call has its own timeout | ||
|
||
ReconcileRoutesTables --> ReconcilePublicIPs | ||
ReconcileRoutesTables -> UpdateStatus : context timeout exceeded | ||
ReconcileRoutesTables: start with local timeout | ||
ReconcileRoutesTables: each Azure call has its own timeout | ||
|
||
ReconcilePublicIPs --> ReconcileNATGateways | ||
ReconcilePublicIPs -> UpdateStatus : context timeout exceeded | ||
ReconcilePublicIPs: start with local timeout | ||
ReconcilePublicIPs: each Azure call has its own timeout | ||
|
||
ReconcileNATGateways --> ReconcileSubnets | ||
ReconcileNATGateways -> UpdateStatus : context timeout exceeded | ||
ReconcileNATGateways: start with local timeout | ||
ReconcileNATGateways: each Azure call has its own timeout | ||
|
||
ReconcileSubnets --> ReconcileLoadBalancers | ||
ReconcileSubnets -> UpdateStatus : context timeout exceeded | ||
ReconcileSubnets: start with local timeout | ||
ReconcileSubnets: each Azure call has its own timeout | ||
|
||
ReconcileLoadBalancers --> UpdateStatus | ||
ReconcileLoadBalancers -> UpdateStatus : context timeout exceeded | ||
ReconcileLoadBalancers: start with local timeout | ||
ReconcileLoadBalancers: each Azure call has its own timeout | ||
|
||
UpdateStatus --> [*] | ||
UpdateStatus : store long running operation(s) future data | ||
UpdateStatus : update conditions | ||
UpdateStatus : patch resource status and spec | ||
|
||
@enduml |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.