Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add proposal for Async Azure Resource Creation and Deletion #1541

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions docs/Makefile
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 docs/proposals/20210716-async-azure-resource-creation-deletion.md

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions docs/proposals/images/async-delete.plantuml
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
Binary file added docs/proposals/images/async-delete.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions docs/proposals/images/async-reconcile.plantuml
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
Binary file added docs/proposals/images/async-reconcile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
52 changes: 52 additions & 0 deletions docs/proposals/images/azure-cluster-reconcile.plantuml
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.