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
Copy file name to clipboardExpand all lines: docs/proposal/controller-and-user-tags.md
+20-10Lines changed: 20 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,15 +3,19 @@
3
3
4
4
## Motivation
5
5
PowerVS cluster creation supports both creating infrastructure and using existing resources required for cluster creation.
6
-
PowerVS cluster reconciler sets controllercreated field whenever resource is created by controller, which was initially introduced to allow proper cleanup of newly created resource vs the use of existing resources.
6
+
PowerVS cluster reconciler sets [controllerCreated](https://github.com/kubernetes-sigs/cluster-api-provider-ibmcloud/blob/48aebb99c3cd8ce65b95dcfceee8f52daf3d5a31/api/v1beta2/ibmpowervscluster_types.go#L181) field whenever resource is created by controller, which was initially introduced to allow proper cleanup of newly created resource vs the use of existing resources. ControllerCreated field will be set for respective resource under ibmpowervscluster.status
7
7
8
8
Though its working as expected and fulfills the purpose, we see some drawbacks.
9
-
1. The field is initially set to true during the first reconciliation cycle when the resource is being created. In subsequent reconciliation loops, the field is not updated because the resource already exists in the cloud. This behavior introduces non-idempotency in the controller logic. As a result, if the initial reconciliation event is missed, the controller exhibits inconsistent behavior. Its against k8s principle of reconcilation of having level trigger rather than edge triggered.
10
-
2. The status is expected to be created from spec, considering the scenario of backup and recover. If we move the spec to fresh management cluster which is setting the status, the controller created will be set as false as the resource already exists in cloud but it was created during its previous concilation.
9
+
1. The field is initially set to true during the first reconciliation cycle when the resource is being created. In subsequent reconciliation loops, the field is not updated because the resource already exists in the cloud(created during first reconciliation). This behavior introduces non-idempotency in the controller logic. As a result, if the initial reconciliation event is missed, the controller exhibits inconsistent behavior. Its against Kubernetes principle of reconciliation of having level trigger rather than edge triggered.
10
+
2. The Status subresource in a resource object is expected to be created from spec, considering the scenario of backup and recover. If we move the spec to fresh management cluster which is setting the status, the controller created will be set as false as the resource already exists in cloud but it was created during its previous reconciliation.
11
11
12
12
## Goal
13
-
1. This proposal aims to tag the PowerVS cluster's cloud resources and delete the resources created by controller based on tag.
14
-
2. Provide user ability to set custom tags to cloud resources.
13
+
1. Tag newly created PowerVS Cluster's cloud resources and delete the resources based on tag.
14
+
2. Provide ability to set custom tags to cloud resources.
15
+
16
+
## Non-Goals
17
+
1. Deprecate and remove controllerCreated flag.
18
+
2. Tag user provided resources.
15
19
16
20
## Proposal
17
21
This proposal presents adding two kinds of tags to the resources created by controller
@@ -25,7 +29,7 @@ A tag of format`powervs.cluster.x-k8s.io-resource-owner:<cluster_name>` will be
-Currently transit gateway connections and DHCP server don't support tagging. We will handle their deletion using the VPC and network tag respectively.
38
-
41
+
-When TransitGateway is tagged we can delete connections. But there is case when TransitGateway is not newly created but connections are newly created. But we connot delete connections since it doesn't support tagging. So to delete VPC connection have to check VPC subnet is tagged and to delete PowerVS connection have to check DHCP network is tagged.
42
+
- To handle deletion DHCP server, have to tag DHCP Network. DHCP server doesn't support tagging.
39
43
40
44
### User tags
41
45
User can add tags to resources when creating PowerVS cluster.
@@ -48,14 +52,20 @@ UserTags field will contain list of tags that will be attached to resources.
48
52
// IBMPowerVSClusterSpec defines the desired state of IBMPowerVSCluster.
49
53
type IBMPowerVSClusterSpec struct {
50
54
51
-
// UserTags contains list of tags needs to be attached to resources
52
-
UserTags []string`json:"tags,omitempty"`
55
+
// Tags contains list of tags needs to be attached to resources
0 commit comments