Skip to content
This repository was archived by the owner on Oct 28, 2024. It is now read-only.

Commit 91fb2b5

Browse files
adding initial NCP + NC proposal (#29)
Signed-off-by: Chris Hein <[email protected]>
1 parent f22df4e commit 91fb2b5

12 files changed

+551
-4
lines changed

docs/Makefile

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Copyright 2019 The Kubernetes Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
16+
17+
SOURCES := $(shell find ${ROOT_DIR} -name \*.plantuml)
18+
DIAGRAMS := $(SOURCES:%.plantuml=%.png)
19+
20+
# Hosts running SELinux need :z added to volume mounts
21+
SELINUX_ENABLED := $(shell cat /sys/fs/selinux/enforce 2> /dev/null || echo 0)
22+
23+
ifeq ($(SELINUX_ENABLED),1)
24+
DOCKER_VOL_OPTS?=:z
25+
endif
26+
27+
.PHONY: diagrams
28+
diagrams: $(DIAGRAMS)
29+
30+
%.png: %.plantuml
31+
docker run \
32+
--rm \
33+
--volume ${ROOT_DIR}:/workdir$(DOCKER_VOL_OPTS) \
34+
--user $(shell id -u):$(shell id -g) \
35+
k8s.gcr.io/cluster-api/plantuml:1.2019.6 \
36+
-v /workdir/$(shell echo '$^' | sed -e 's,.*docs/,,g' )
File renamed without changes.

proposals/20201026-creating-control-plane-components.md renamed to docs/proposals/20201026-creating-control-plane-components.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ The component controller will create the component under the in-tree mode, which
146146

147147
Each component's controller will generate necessary certificates for the component and store them to the [secret resources](https://cluster-api.sigs.k8s.io/tasks/certs/using-custom-certificates.html) defined by CAPI. Also, The KAS controller will store the content of the kubeconfig file in a secret named `[clustername]-kubeconfig`.
148148

149-
![Control Plane Creating Process](in-tree.png)
149+
![Control Plane Creating Process](images/componentcontrollers/in-tree.png)
150150

151151
The creating process will include six steps:
152152

@@ -164,7 +164,7 @@ The creating process will include six steps:
164164

165165
If users intend to use an external controller to create the NCP component, they may need to implement a new component controller that can interact with the component CR and the external controller to create the component. For example, if the user wanted to use the [etcd-cluster-operator](https://github.com/improbable-eng/etcd-cluster-operator) that requires the [EtcdCluster](https://github.com/improbable-eng/etcd-cluster-operator/blob/master/api/v1alpha1/etcdcluster_types.go) CR. They need to implement a custom controller that watches the `NestedEtcd` resource, creates the necessary CRs for that implementation, and updates the required status fields on `NestedEtcd` to allow dependent services to be provisioned. This can be done using the [kubebuilder-declarative-pattern](https://github.com/kubernetes-sigs/kubebuilder-declarative-pattern) like is done for in-tree component controllers.
166166

167-
![Creating a Control Plane using out-of-tree provisioners](out-of-tree.png)
167+
![Creating a Control Plane using out-of-tree provisioners](images/componentcontrollers/out-of-tree.png)
168168

169169
In the following example, we assume that the user intends to use Etcd-cluster-operator(ECO) as the Etcd controller. The creating process will include seven steps:
170170

@@ -203,11 +203,11 @@ type NestedEtcdStatus struct {
203203
// Ready is set if all resources have been created
204204
Ready bool `json:"ready,omitempty"`
205205

206-
// EtcdDomain defines how to address the etcd instance
206+
// Addresses defines how to address the etcd instance
207207
Addresses []NestedEtcdAddress `json:"addresses,omitempty"`
208208

209209
// CommonStatus allows addons status monitoring
210-
addonv1alpha1. CommonStatus `json:",inline"`
210+
addonv1alpha1.CommonStatus `json:",inline"`
211211
}
212212

213213
// EtcdAddress defines the observed addresses for etcd

docs/proposals/20210126-nc-and-ncp.md

+313
Large diffs are not rendered by default.
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
@startuml
2+
skinparam roundcorner 20
3+
skinparam ParticipantPadding 20
4+
skinparam BoxPadding 50
5+
skinparam Shadowing false
6+
skinparam NoteBorderColor #444
7+
skinparam NoteBackgroundColor #fff
8+
skinparam NoteFontColor #444
9+
skinparam EntityBackgroundColor #fff
10+
skinparam EntityBorderColor #444
11+
skinparam ArrowFontColor #444
12+
skinparam ArrowColor #444
13+
skinparam ArrowLollipopColor #444
14+
skinparam ArrowThickness 1
15+
skinparam ControlBorderColor #444
16+
skinparam ControlBackgroundColor #fff
17+
skinparam ParticipantBorderColor #444
18+
skinparam ParticipantBackgroundColor #fff
19+
skinparam ParticipantFontSize 17
20+
skinparam ParticipantFontColor #444
21+
skinparam ActorBorderColor #444
22+
skinparam ActorFontColor #444
23+
skinparam ActorFontSize 17
24+
skinparam ActorBackgroundColor #fff
25+
skinparam GroupBorderColor #444
26+
skinparam GroupBorderThickness 1
27+
skinparam GroupHeaderFontColor #444
28+
skinparam GroupFontColor #444
29+
skinparam SequenceLifeLineBorderColor #444
30+
skinparam ActivityBorderColor #444
31+
skinparam ActivityBackgroundColor #fff
32+
skinparam ActivityDiamondBorderColor #444
33+
skinparam ActivityDiamondBackgroundColor #fff
34+
35+
title NestedCluster Creation
36+
37+
start
38+
39+
if (NC exists?) then (no)
40+
:return nil;
41+
end
42+
else (yes)
43+
endif
44+
45+
if (deletionTimestamp?) then (yes)
46+
:handle deletion;
47+
end
48+
else (no)
49+
endif
50+
51+
if (owningCluster exists?) then (no)
52+
:return nil;
53+
end
54+
else (yes)
55+
endif
56+
57+
if (cluster paused?) then (yes)
58+
:return nil;
59+
end
60+
else (no)
61+
endif
62+
63+
if (controlPlane exists?) then (no)
64+
:return failed to get control plane;
65+
end
66+
endif
67+
68+
:set cluster.Status.Ready == ncp.Status.Ready;
69+
:set cluster.Spec.ControlPlaneEndpoint == ncp.Spec.ControlPlaneEndpoint;
70+
71+
:patch cluster;
72+
if (errors?) then (yes)
73+
:return error;
74+
end
75+
endif
76+
77+
:return nil;
78+
79+
end
80+
81+
@enduml
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
@startuml
2+
skinparam roundcorner 20
3+
skinparam ParticipantPadding 20
4+
skinparam BoxPadding 50
5+
skinparam Shadowing false
6+
skinparam NoteBorderColor #444
7+
skinparam NoteBackgroundColor #fff
8+
skinparam NoteFontColor #444
9+
skinparam EntityBackgroundColor #fff
10+
skinparam EntityBorderColor #444
11+
skinparam ArrowFontColor #444
12+
skinparam ArrowColor #444
13+
skinparam ArrowLollipopColor #444
14+
skinparam ArrowThickness 1
15+
skinparam ControlBorderColor #444
16+
skinparam ControlBackgroundColor #fff
17+
skinparam ParticipantBorderColor #444
18+
skinparam ParticipantBackgroundColor #fff
19+
skinparam ParticipantFontSize 17
20+
skinparam ParticipantFontColor #444
21+
skinparam ActorBorderColor #444
22+
skinparam ActorFontColor #444
23+
skinparam ActorFontSize 17
24+
skinparam ActorBackgroundColor #fff
25+
skinparam GroupBorderColor #444
26+
skinparam GroupBorderThickness 1
27+
skinparam GroupHeaderFontColor #444
28+
skinparam GroupFontColor #444
29+
skinparam SequenceLifeLineBorderColor #444
30+
skinparam ActivityBorderColor #444
31+
skinparam ActivityBackgroundColor #fff
32+
skinparam ActivityDiamondBorderColor #444
33+
skinparam ActivityDiamondBackgroundColor #fff
34+
35+
title NestedControlPlane Creation
36+
37+
start
38+
39+
if (NCP exists?) then (no)
40+
:return nil;
41+
end
42+
else (yes)
43+
endif
44+
45+
if (deletionTimestamp?) then (yes)
46+
:handle deletion;
47+
end
48+
endif
49+
50+
if (component CRs exist?) then (no)
51+
:emit event;
52+
:return retryAfter;
53+
end
54+
else (yes)
55+
if (has ownerReferences?) then (no)
56+
:setup OwnerReferences back;
57+
endif
58+
endif
59+
60+
if (cluster CA/Certs exists?) then (no)
61+
:call secret.NewCertificatesForInitialControlPlane;
62+
:store certs as secrets;
63+
if (errors?) then (yes)
64+
:return err;
65+
end
66+
elseif (error with Conflicts?) then (yes)
67+
:return retryAfter;
68+
end
69+
else (no)
70+
endif
71+
endif
72+
73+
if (ControlPlaneEndpoint set?) then (no)
74+
:return nil;
75+
end
76+
endif
77+
78+
79+
if (admin kubeconfig exists?) then (no)
80+
:get ControlPlaneEndpoint;
81+
:create kubeconfig;
82+
if (errors?) then (yes)
83+
:return err;
84+
end
85+
endif
86+
elseif (kubeconfig owned?) then (no)
87+
:adopt kubeconfig;
88+
else (yes)
89+
if (certs need rotation?) then (yes)
90+
:regenerate and store;
91+
if (errors?) then (yes)
92+
:return err;
93+
end
94+
endif
95+
endif
96+
endif
97+
98+
if (conditions updated?) then (no)
99+
if (etcd managed?) then (yes)
100+
:try to fetch common status fields;
101+
if (errors?) then (yes)
102+
:set etcd as unknown state;
103+
endif
104+
endif
105+
:get nested component statuses;
106+
:update NestedControlPlane status;
107+
if (errors?) then (yes)
108+
:return err;
109+
end
110+
endif
111+
endif
112+
113+
:return nil;
114+
115+
end
116+
117+
@enduml
Loading

docs/proposals/out-of-tree.png

46.8 KB
Loading

0 commit comments

Comments
 (0)