Skip to content

Commit f1517e2

Browse files
committed
address review comments
1 parent 14da794 commit f1517e2

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

docs/proposal/controller-and-user-tags.md

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,19 @@
33

44
## Motivation
55
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
77

88
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.
1111

1212
## 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.
1519

1620
## Proposal
1721
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
2529

2630
#### Following resources will be getting tagged
2731
1. [PowerVS workspace](https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-creating-power-virtual-server)
28-
2. [PowerVS Network](https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-configuring-subnet) [DHCP service]
32+
2. [PowerVS Network](https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-configuring-subnet) [DHCP server]
2933
3. [VPC](https://cloud.ibm.com/docs/vpc?topic=vpc-about-vpc)
3034
4. [VPC Subnet](https://cloud.ibm.com/docs/vpc?topic=vpc-about-networking-for-vpc)
3135
5. [VPC Security Groups](https://cloud.ibm.com/docs/vpc?topic=vpc-security-in-your-vpc)
@@ -34,8 +38,8 @@ A tag of format`powervs.cluster.x-k8s.io-resource-owner:<cluster_name>` will be
3438
8. [COS Instance](https://www.ibm.com/products/cloud-object-storage)
3539

3640
#### Note
37-
- 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.
3943

4044
### User tags
4145
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.
4852
// IBMPowerVSClusterSpec defines the desired state of IBMPowerVSCluster.
4953
type IBMPowerVSClusterSpec struct {
5054

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
56+
Tags []Tag `json:"tags,omitempty"`
5357
.
5458
.
5559
.
5660

5761
}
5862

63+
// Tag defines single tag in pair
64+
type Tag struct {
65+
Key string `json:"key,omitempty"`
66+
Value string `json:"value,omitempty"`
67+
}
68+
5969
```
6070

6171

0 commit comments

Comments
 (0)