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

Bootstrap proposal: convert Figures 3-8 to PlantUML, add make target to generate #1058

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
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,4 @@ docs/book/node_modules/
config/ci/rbac/role_binding.yaml
config/ci/rbac/role.yaml
config/ci/manager/manager.yaml

config/crds-v1alpha1

58 changes: 58 additions & 0 deletions docs/proposals/images/machine-states-preboot/Figure3.plantuml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
@startuml
title Figure 3: User creates a machine with kubeadm bootstrapper
actor User

' -- GROUPS START ---

box #lightgreen
participant "API Server"
end box

box #lightblue
participant "Cluster API Machine Controller"
end box

' -- GROUPS END ---

User->"API Server":kubectl apply -f machine.yaml
"API Server"-->>"Cluster API Machine Controller": New Machine

"Cluster API Machine Controller"-> "Cluster API Machine Controller":Machine Controller Reconcile
activate "Cluster API Machine Controller"


note over "Cluster API Machine Controller": - ✅ Machine.Status.Phase is empty\n- ✅ Machine.Spec.Bootstrap.Data is <nil>\n- ✅ Machine.Spec.Bootstrap.ConfigRef is populated\n- ✅ Machine.Spec.Bootstrap.ConfigRef -> Status.Phase is not "Ready"

opt Required only if the object hasn't been seen before
"Cluster API Machine Controller"-> "Cluster API Machine Controller":Add watcher for \nMachine.Spec.Bootstrap.ConfigRef.Kind objects
end

opt Required only if the object hasn't been seen before
"Cluster API Machine Controller"-> "Cluster API Machine Controller":Add watcher for \nMachine.Spec.InfrastructureRef.Kind objects
end

opt Required only if the object hasn't been seen before
"Cluster API Machine Controller"-> "Cluster API Machine Controller":Add watcher for \nMachine.Spec.Bootstrap.ConfigRef.Kind objects
end

opt Required only if the object doesn't have a Machine owner reference
"Cluster API Machine Controller"-> "Cluster API Machine Controller":Set Machine.Spec.Bootstrap.ConfigRef -> OwnerReferences[0] to Machine
"Cluster API Machine Controller"->"API Server": Update KubeadmBootstrapConfig
"Cluster API Machine Controller"<<--"API Server": Response
end

opt Required only if the object doesn't have a Machine owner reference
"Cluster API Machine Controller"-> "Cluster API Machine Controller":Set Machine.Spec.InfrastructureRef -> OwnerReferences[0] to Machine
"Cluster API Machine Controller"->"API Server": Update AWSInfrastructureConfig
"Cluster API Machine Controller"<<--"API Server": Response
end

"Cluster API Machine Controller"-> "Cluster API Machine Controller":Set Machine.Status.Phase = "Pending"

"Cluster API Machine Controller"->"API Server": Update Machine Status
"Cluster API Machine Controller"<<--"API Server": Response

deactivate "Cluster API Machine Controller"

hide footbox
@enduml
Binary file modified docs/proposals/images/machine-states-preboot/Figure3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions docs/proposals/images/machine-states-preboot/Figure4.plantuml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
@startuml
title Figure 4: User creates a machine with kubeadm bootstrapper

' -- GROUPS START ---

box #lightgreen
participant "API Server"
end box

box #pink
participant "Kubeadm Bootstrap Controller"
end box

' -- GROUPS END ---

note right of "Kubeadm Bootstrap Controller":Watches KubeadmBootstrapConfig\nand Machine events with mapFunc

"API Server"-->>"Kubeadm Bootstrap Controller": Machine Updated

"Kubeadm Bootstrap Controller"-> "Kubeadm Bootstrap Controller":Enqueues KubeadmBootstrapConfig Reconcile

"Kubeadm Bootstrap Controller"-> "Kubeadm Bootstrap Controller":KubeadmBootstrapConfig Controller Reconcile
activate "Kubeadm Bootstrap Controller"

note over "Kubeadm Bootstrap Controller": - ✅ KubeadmBootstrapConfigStatus.OwnerReferences \ncontains a Machine

"Kubeadm Bootstrap Controller"->"API Server": Get Machine
"Kubeadm Bootstrap Controller"<<--"API Server": Response

"Kubeadm Bootstrap Controller"->"API Server": Get Cluster
"Kubeadm Bootstrap Controller"<<--"API Server": Response

note over "Kubeadm Bootstrap Controller": - ✅ Machine.Status.Phase is "Pending" \n- ✅ Machine.Spec.Bootstrap.Data is <nil>\n- ✅ KubeadmBootstrapConfig instance is valid

note over "Kubeadm Bootstrap Controller": Uses Cluster and Machine information\nto generate a cloud-init based script\nto be used by an infrastructure provider\nin a startup/userdata field.

"Kubeadm Bootstrap Controller"-> "Kubeadm Bootstrap Controller":Generate bootstrap data and set\nKubeadmBootstrapConfig.Status.BootstrapData

"Kubeadm Bootstrap Controller"-> "Kubeadm Bootstrap Controller":Set KubeadmBootstrapConfig.Status.Phase = "Ready"

"Kubeadm Bootstrap Controller"->"API Server": Update KubeadmBootstrapConfig
"Kubeadm Bootstrap Controller"<<--"API Server": Response

hide footbox
@enduml
Binary file modified docs/proposals/images/machine-states-preboot/Figure4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions docs/proposals/images/machine-states-preboot/Figure5.plantuml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
@startuml
title Figure 5: User creates a machine with kubeadm bootstrapper

' -- GROUPS START ---

box #lightgreen
participant "API Server"
end box

box #lightblue
participant "Cluster API Machine Controller"
end box

' -- GROUPS END ---

"API Server"-->>"Cluster API Machine Controller": KubeadmBootstrapConfig updated

"Cluster API Machine Controller"-> "Cluster API Machine Controller": Enqueue Reconcile\nfor Machine


"Cluster API Machine Controller"-> "Cluster API Machine Controller": Machine Controller Reconcile
activate "Cluster API Machine Controller"

"Cluster API Machine Controller"->"API Server": Get Machine
"Cluster API Machine Controller"<<--"API Server": Response

note over "Cluster API Machine Controller": - ✅ Machine.Status.Phase is "Pending" \n- ✅ Machine.Spec.Bootstrap.ConfigRef -> Status.Phase is "Ready"\n- ✅ Machine.Bootstrap.ConfigRef -> Status.BootstrapData is populated (not <nil>)

"Cluster API Machine Controller"-> "Cluster API Machine Controller": Copy Machine.Spec.Bootstrap.ConfigRef -> Status.BootstrapData\nto Machine.Spec.Bootstrap.Data

"Cluster API Machine Controller"-> "Cluster API Machine Controller":Set Machine.Status.Phase = "Provisioning"

"Cluster API Machine Controller"->"API Server": Update Machine
"Cluster API Machine Controller"<<--"API Server": Response

hide footbox
@enduml
Binary file modified docs/proposals/images/machine-states-preboot/Figure5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 49 additions & 0 deletions docs/proposals/images/machine-states-preboot/Figure6.plantuml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
@startuml
title Figure 6: User creates a machine with kubeadm bootstrapper


' -- GROUPS START ---

box #lightgreen
participant "API Server"
end box

box #lightsalmon
participant "AWS Infrastructure Controller"
end box

' -- GROUPS END ---

entity AWS

note over "AWS Infrastructure Controller": Watches AWSInfrastructureConfig\nand Machine events with mapFunc

"API Server"-->>"AWS Infrastructure Controller": Machine updated

"AWS Infrastructure Controller"-> "AWS Infrastructure Controller": Enqueues AWSInfrastructureConfig Reconcile

"AWS Infrastructure Controller"-> "AWS Infrastructure Controller": AWSInfrastructureConfig Controller Reconcile
activate "AWS Infrastructure Controller"

note over "AWS Infrastructure Controller": - ✅ AWSInfrastructureConfig.OwnerReferences \ncontains a Machine

"AWS Infrastructure Controller"->"API Server": Get Machine
"AWS Infrastructure Controller"<<--"API Server": Response

"AWS Infrastructure Controller"->"API Server": Get Cluster
"AWS Infrastructure Controller"<<--"API Server": Response

note over "AWS Infrastructure Controller": - ✅ Machine.Status.Phase is "Provisioning" \n- ✅ Machine.Spec.Bootstrap.Data is populated (not <nil>)\n- ✅ AWS supports user-data\n- ✅ AWSInfrastructureConfig is valid\n- ✅ AWSInfrastructureConfig.Status.Phase is empty or <nil>

"AWS Infrastructure Controller"-> "AWS Infrastructure Controller": Copy Machine.Spec.Bootstrap.Data to *ec2.RunInstancesInput

"AWS Infrastructure Controller"-> AWS: RunInstances(*ec2.RunInstancesInput)
"AWS Infrastructure Controller"<<--AWS: Response

"AWS Infrastructure Controller"-> "AWS Infrastructure Controller":Set AWSInfrastructureConfig.Status.Phase = "Ready"

"AWS Infrastructure Controller"->"API Server": Update AWSInfrastructureConfig
"AWS Infrastructure Controller"<<--"API Server": Response

hide footbox
@enduml
Binary file modified docs/proposals/images/machine-states-preboot/Figure6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions docs/proposals/images/machine-states-preboot/Figure7.plantuml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
@startuml
title Figure 7: User creates a machine with kubeadm bootstrapper
' -- GROUPS START ---

box #lightgreen
participant "API Server"
end box

box #lightblue
participant "Cluster API Machine Controller"
end box


' -- GROUPS END ---


"API Server"-->>"Cluster API Machine Controller": AWSInfrastructureConfig updated

"Cluster API Machine Controller"-> "Cluster API Machine Controller":Machine Controller Reconcile
activate "Cluster API Machine Controller"

note over "Cluster API Machine Controller": - ✅ Machine.Status.Phase is "Provisioning" \n- ✅ Machine.Spec.InfrastructureRef -> Status.Phase is "Ready"\n- ✅ Machine.Spec.InfrastructureRef -> Status.Addresses is not empty

"Cluster API Machine Controller"->"Cluster API Machine Controller": Set Machine.Status.Phase to "Provisioned"

"Cluster API Machine Controller"->"API Server": Update Machine
"Cluster API Machine Controller"<--"API Server": Response

deactivate "Cluster API Machine Controller"

hide footbox
@enduml
Binary file modified docs/proposals/images/machine-states-preboot/Figure7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions docs/proposals/images/machine-states-preboot/Figure8.plantuml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
@startuml
title Figure 8: User creates a machine with kubeadm bootstrapper

' -- GROUPS START ---

box #lightgreen
participant "API Server"
end box

box #lightblue
participant "Cluster API Machine Controller"
end box

box #lightgreen
participant "Workload Cluster API Server"
end box

' -- GROUPS END ---


"API Server"-->>"Cluster API Machine Controller": AWSInfrastructureConfig updated

"Cluster API Machine Controller"-> "Cluster API Machine Controller":Machine Controller Reconcile
activate "Cluster API Machine Controller"

note over "Cluster API Machine Controller": - ✅ Machine.Status.Phase is "Provisioned" \n- ✅ Machine.Spec.InfrastructureRef -> Status.Phase is "Ready"\n- ✅ Machine.Spec.InfrastructureRef -> Status.Addresses is not empty

loop until timeout or Node's status is Ready
"Cluster API Machine Controller"->"Workload Cluster API Server": Get Node
"Cluster API Machine Controller"<<--"Workload Cluster API Server": Response
note over "Cluster API Machine Controller":Loop conditions:\n- ✅ Node.Spec.ProviderID matches Machine.Spec.ProviderID\n- ✅ Node status is "Ready"
end

"Cluster API Machine Controller"->"Cluster API Machine Controller": Set Machine.Status.NodeRef

"Cluster API Machine Controller"->"Cluster API Machine Controller": Set Machine.Status.Phase to "Ready"

"Cluster API Machine Controller"->"API Server": Update Machine
"Cluster API Machine Controller"<--"API Server": Response

deactivate "Cluster API Machine Controller"

hide footbox
@enduml
Binary file modified docs/proposals/images/machine-states-preboot/Figure8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions docs/proposals/images/machine-states-preboot/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 2019 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.

SOURCES := $(shell ls *.plantuml)
FIGURES := $(SOURCES:%.plantuml=%.png)

figures: $(FIGURES)

# --user ensures the output files are owned by the user invoking docker on the host
# TODO: Publish docker image owned by CAPI project: https://github.com/kubernetes-sigs/cluster-api/issues/1070
%.png: %.plantuml
docker run \
--rm \
--volume ${PWD}:/figures \
--user $(shell id --user):$(shell id --group) \
dpf9/plantuml:1.2019.6 \
dlipovetsky marked this conversation as resolved.
Show resolved Hide resolved
-v /figures/$^

.PHONY: figures