You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 28, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: proposals/20201026-creating-control-plane.md
+89-42Lines changed: 89 additions & 42 deletions
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,8 @@ authors:
5
5
reviewers:
6
6
- "@christopherhein"
7
7
- "@Fei-Guo"
8
+
- "@vincepri"
9
+
- "@brightzheng100"
8
10
creation-date: 2020-10-26
9
11
last-updated: 2020-11-09
10
12
status: provisional
@@ -46,6 +48,12 @@ The followings are terms that will be used in the proposal. Whether including th
46
48
47
49
***NestedControlPlane(NCP)** - The control plane that are hosted on the super cluster.
48
50
51
+
***NestedEtcd(NEtcd)** - The etcd that belongs to the control plane of the nested cluster.
52
+
53
+
***NestedAPIServer(NKAS)** - The kube-apiserver which belongs to the control plane of the nested cluster.
54
+
55
+
***NestedControllerManager(NKCM)** - The kube-control-manager which belongs to the control plane of the nested cluster.
56
+
49
57
***Component Controller** - Operators that create components of the NCP, including the Etcd controller, KAS controller and KCM controller.
50
58
51
59
To better illustrate the creation process, we define two Roles with different responsibilities:
@@ -61,7 +69,7 @@ The goal of this proposal is to define CRDs of the three major components (kube-
61
69
62
70
## Motivation
63
71
64
-
CAPN aims at providing control-plane level isolation while sharing physical resources among control planes. There exist various approaches to creating isolated control-planes. For example, one can run components of the nested control-plane as pods on the underlying clusters, create NCPs through cloud providers' Kubernetes services or use third-party component providers to create each component. In this proposal, we try to define CRDs of the NCP's three major components and a standard process of creating the three components regardless of which underlying approach is used. As examples, we introduce two setups that 1) creating each component natively, 2) creating KAM and KCM natively while using the [Etcd-cluster-operator](https://github.com/improbable-eng/etcd-cluster-operator) to create the Etcd.
72
+
CAPN aims at providing controlplane level isolation while sharing physical resources among control planes. There exist various approaches to creating isolated controlplanes. For example, one can run components of the nested controlplane as pods on the underlying clusters, create NCPs through cloud providers' Kubernetes services or use third-party component providers to create each component. In this proposal, we try to define CRDs of the NCP's three major components and a standard process of creating the three components regardless of which underlying approach is used. As examples, we introduce two setups that 1) creating each component natively, 2) creating KAM and KCM natively while using the [Etcd-cluster-operator](https://github.com/improbable-eng/etcd-cluster-operator) to create the Etcd.
65
73
66
74
### Goals
67
75
@@ -77,17 +85,17 @@ CAPN aims at providing control-plane level isolation while sharing physical reso
77
85
78
86
- Define how NCP controller works.
79
87
80
-
- Discuss the details of how the third-party component provider work.
88
+
- Discuss the implementation details of the out-of-tree component controllers.
81
89
82
90
## Proposal
83
91
84
92
### Portability and Customizability
85
93
86
-
Generally, creating the three major components requires similar high-level information, like the components' version, the number of replicas, and the amount of computing resources. Meanwhile, end-users should be able to customize NCP components, i.e., specifying the component image, version, and command-line options. Therefore, we define a new struct `ComponentSpec` that contains common information required by different providers as well as customized information specified by the end-users. The `ComponentSpec` will look like the following
94
+
Generally, creating the three major components requires similar high-level information, like the components' version, the number of replicas, and the amount of computing resources. Meanwhile, end-users should be able to customize NCP components, i.e., specifying the component image, version, and command-line options. Therefore, we define a new struct `NestedComponentSpec` that contains common information required by different providers as well as customized information specified by the end-users. The `NestedComponentSpec` will look like the following
87
95
88
96
```go
89
-
typeComponentSpecstruct {
90
-
//ComponentSpec defines the common information for creating the component
97
+
typeNestedComponentSpecstruct {
98
+
//NestedComponentSpec defines the common information for creating the component
91
99
// +optional
92
100
addonv1alpha1.CommonSpec`json:",inline"`
93
101
@@ -129,19 +137,58 @@ type PatchSpec struct {
129
137
130
138
#### Create prerequisites
131
139
132
-
We assume that the APIServer, ContollerManager, Etcd and the NCP CR are located in the same namespace. To create an NCP, we need to first create APIserver CR, ControllerManager CR, Etcd CR, NCP CR, and a namespace that holds all the CRs, then the sub-controllers can cooperate with each other to create components for the NCP.
140
+
We assume that the APIServer, ContollerManager, Etcd and the NCP CR are located in the same namespace. To create an NCP, we need to first create APIserver CR, ControllerManager CR, Etcd CR, NCP CR, and a namespace that holds all the CRs, then the component controller can cooperate with each other to create components for the NCP.
133
141
134
-
As there exist dependencies between components, i.e., KAS cannot run without Etcd, KCM cannot work without KAS, when creating the NCP component, sub-controllers will need to get information and status of other CRs. Also, as all CRs of an NCP will be located in the same namespace, we will set `metav1.OwnerReference` in each component CR as the NCP that owns the CR, which can help the CR to find its belonging NCP. As the NCP status will include all required [CAPI status](https://cluster-api.sigs.k8s.io/developer/architecture/controllers/control-plane.html#required-status-fields), we can then use the `Selector` field to get the desired CR.
142
+
As there exist dependencies between components, i.e., KAS cannot run without Etcd, KCM cannot work without KAS, when creating NCP components, component controllers will need to get information and status of other CRs. Also, as all CRs of an NCP will be located in the same namespace, we will set `metav1.OwnerReference` in each component CR as the NCP that owns the CR, which can help the CR to find its belonging NCP. As the NCP status will include all required [CAPI status](https://cluster-api.sigs.k8s.io/developer/architecture/controllers/control-plane.html#required-status-fields), we can then use the `Selector` field to get the desired CR.
135
143
136
144
### Creation
137
145
138
-
End-users can create component CRs manually and apply them to the cluster with an NCP to create the resources. In the future, we might introduce the `Template` CR, which will handle the creation of the component CRs in it's controller. We assume that on a super cluster, there will be only one sub-controller for each component CR, and it's the cluster admin's responsibility to setup sub-controllers.
146
+
End-users can create component CRs manually and apply them to the cluster with an NCP to create the resources. In the future, we might introduce the `Template` CR, which will handle the creation of the component CRs in it's controller. If the end-user intend to use out-of-tree controllers, they can specify them in the NCP spec, we define three new types:
If no component provider is specified, the sub-controller will create the component under the native mode, which will create the component using the default manifests. The readiness and liveness probe will be used, and we will mark each component as ready only when the corresponding workload is ready. As the KAS cannot work without available Etcd and the KCM cannot run without KAS, the three components need to be created by their respective controllers in the order of Etcd, KAS, and KCM. Creation order is maintained using cross resource status checks to "wait" until the dependencies are provisioned before booting.
189
+
If no component provider is specified, the component controller will create the component under the native mode, which will create the component using the default manifests. The readiness and liveness probe will be used, and we will mark each component as ready only when the corresponding workload is ready. As the KAS cannot work without available Etcd and the KCM cannot run without KAS, the three components need to be created by their respective controllers in the order of Etcd, KAS, and KCM. Creation order is maintained using cross resource status checks to "wait" until the dependencies are provisioned before booting.
143
190
144
-
Except using `OwnerReference` and `CAPI.Status.Selector`, another option of sharing status across components are adding initContainer to each component. The sub-controllers will then create the component workload without polling the status of other CRs while having the initContainer to check and wait for other components to be ready.
191
+
Except using `OwnerReference` and `CAPI.Status.Selector`, another option of sharing status across components are adding initContainer to each component. The component controllers will then create the component workload without polling the status of other CRs while having the initContainer to check and wait for other components to be ready.
145
192
146
193
We will host sets of default templates in this repositor. Users can specify which set of templates they intend to use by specifying the corresponding `version` or `channel` in the embedded `CommonSpec` in the component's CR.
147
194
@@ -185,18 +232,18 @@ In the following example, we assume that the user intend to use Etcd-cluster-ope
185
232
186
233
The followings are CRDs of the three components.
187
234
188
-
### Etcd CRD
235
+
### NestedEtcd CRD
189
236
```go
190
-
//EtcdSpec defines the desired state of Etcd
191
-
typeEtcdSpecstruct {
192
-
//ComponentSpec contains the common and user-specified information that are
237
+
//NestedEtcdSpec defines the desired state of Etcd
238
+
typeNestedEtcdSpecstruct {
239
+
//NestedComponentSpec contains the common and user-specified information that are
193
240
// required for creating the component
194
241
// +optional
195
-
ComponentSpecComponentSpec`json:",inline"`
242
+
NestedComponentSpec`json:",inline"`
196
243
}
197
244
198
-
//EtcdStatus defines the observed state of Etcd
199
-
typeEtcdStatusstruct {
245
+
//NestedEtcdStatus defines the observed state of Etcd
246
+
typeNestedEtcdStatusstruct {
200
247
// Ready is set if all resources have been created
0 commit comments