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

Commit 5a9dce7

Browse files
edit the proposal
1 parent 9f45b0d commit 5a9dce7

File tree

1 file changed

+27
-11
lines changed

1 file changed

+27
-11
lines changed

proposals/20201026-creating-control-plane-components.md

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ The goal of this proposal is to define CRDs of the three major components (kube-
6868

6969
## Motivation
7070

71-
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.
71+
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 out-of-tree component controllers 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.
7272

7373
### Goals
7474

@@ -118,17 +118,17 @@ The `CommonSpecs` and the `PatchSpec` are defined in [kubebuilder-declarative-pa
118118
```go
119119
// CommonSpec defines the set of configuration attributes that must be exposed on all addons.
120120
type CommonSpec struct {
121-
// Version specifies the exact addon version to be deployed, eg 1.2.3
122-
// It should not be specified if Channel is specified
123-
Version string `json:"version,omitempty"`
124-
// Channel specifies a channel that can be used to resolve a specific addon, eg: stable
125-
// It will be ignored if Version is specified
126-
Channel string `json:"channel,omitempty"`
121+
// Version specifies the exact addon version to be deployed, eg 1.2.3
122+
// It should not be specified if Channel is specified
123+
Version string `json:"version,omitempty"`
124+
// Channel specifies a channel that can be used to resolve a specific addon, eg: stable
125+
// It will be ignored if Version is specified
126+
Channel string `json:"channel,omitempty"`
127127
}
128128

129129
// +k8s:deepcopy-gen=true
130130
type PatchSpec struct {
131-
Patches []*runtime.RawExtension `json:"patches,omitempty"`
131+
Patches []*runtime.RawExtension `json:"patches,omitempty"`
132132
}
133133
```
134134

@@ -138,10 +138,26 @@ type PatchSpec struct {
138138

139139
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.
140140

141-
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.
141+
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. To achieve this, we will add three `ObjectReference` to the `NestedControlPlaneSpec` with each `ObjectReference` points to a component.
142142

143-
### Creation
143+
```go
144+
type NestedControlPlaneSpec struct {
145+
// other fields ...
146+
147+
// Etcd is the eference to the NestedEtcd
148+
Etcd *corev1.ObjectReference `json:"etcd,omitempty"`
149+
150+
// APIServer is the reference to the NestedAPIServer
151+
APIServer *corev1.ObjectReference `json:"apiserver,omitempty"`
152+
153+
// ContollerManager is the reference to the NestedControllerManager
154+
ControllerManager *corev1.ObjectReference `json:"controllerManager,omitempty"`
155+
}
156+
```
144157

158+
After applying the NCP CR, the NCP controller will find the three associated components and set their `metav1.OwnerReference` as the NCP CR. Then, when creating the component workload, the component controller can find other CRs through the owner NCP.
159+
160+
### Creation
145161
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:
146162

147163
```go
@@ -203,7 +219,7 @@ The creating process will include six steps:
203219

204220
3. The KAS controller creates a KAS service (for exposing the NCP), generates certificates (including a root CA, TLS serving certificates), creates the KAS workload, stores the certificates into `secret/[cluster-name]-ca`, creates a kubeconfig and stores it into `secret/[cluster-name]-kubeconfig`.
205221

206-
4. The KCM controller generates the KCM kubeconfig (cluster CA can be read from the `secret/[cluster-name]-ca` and the KAS address can be extracted from the `KAS service`), creates the KCM workload which will talk to the KAS using the KCM kubeconfig.
222+
4. The KCM controller generates the KCM kubeconfig and creates the KCM workload.
207223

208224
5. After all the three components are ready, the NCP controller marks the NCP CR as ready.
209225

0 commit comments

Comments
 (0)