Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 60 additions & 1 deletion docs/proposal/controller-and-user-tags.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,65 @@ This proposal presents adding two kinds of tags to the resources created by cont
Below are the cluster creation scenarios.
#### Creating a new cluster
- When resources will be created for new cluster in the cloud the tag will be attached. During deletion flow, will check for tag `powervs.cluster.x-k8s.io/cluster-uuid: UUID` and delete the resources.
##### Tag Attachment Scenarios
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you PTAL at the format of this section?

##### Success

When the controller successfully attaches the tag `powervs.cluster.x-k8s.io/cluster-uuid: UUID` to a newly created resource, the cluster creation process proceeds normally and completes successfully.

- **Deletion Behavior**

During cluster deletion, the controller identifies resources with the matching tag `powervs.cluster.x-k8s.io/cluster-uuid: UUID` and deletes them, allowing the cluster to be deleted successfully.

##### Failure

If a resource is created successfully but tag attachment fails then:

1. Retry Attempts: The controller retries attaching the tag multiple times over a configured period.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think retry is required, We can depend on the reconciler retry as we decided not to proceed if the tag attach failed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I think that should be enough but when we are going to add then condition ?
So with this retry I was thinking if retries are exhausted then we can add this condition
But how we should handle this during reconcile ?
cc: @Amulyam24

2. After Retries Fail: If all retries fail, the controller:
- Sets a warning condition on the cluster. Below is the condition example.
- Adds an error message like: "Failed to attach tag to newly created Workspace <workspace-name>. Please delete the cluster and recreate it in different region."
```
status:
addresses:
- address: karthikkn-capi-powervs-control-plane-4vfvx
type: InternalDNS
- address: karthikkn-capi-powervs-control-plane-4vfvx
type: Hostname
- address: 192.168.0.12
type: InternalIP
conditions:
- lastTransitionTime: "2025-03-26T06:06:11Z"
status: "True"
type: Ready
- lastTransitionTime: "2025-03-26T06:06:11Z"
status: "False"
type: TagAttachmentFailed
health: WARNING
instanceID: b13dc26f-d491-442d-afde-83487aed2628
instanceState: ACTIVE
ready: true
v1beta2:
conditions:
Comment on lines +73 to +74
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can ignore these details and keep only condition under status to show the exmaple, Something like
status
.
.
conidtions:

- lastTransitionTime: "2025-03-26T06:06:11Z"
message: ""
observedGeneration: 2
reason: Ready
status: "True"
type: Ready
- lastTransitionTime: "2025-03-26T06:06:11Z"
message: "Failed to attach tag to newly created Instance. Please delete the cluster and recreate it in different region"
observedGeneration: 2
reason: TagAttachmentFailed
status: "False"
type: TagAttachmentFailed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think instead of adding a generic TagAttachementFailed type, we need to just update the message for corresponding condition type, like if attach tag fails to Workspace the message should be set on workspace,

		conditions.Set(powerVSCluster.cluster, metav1.Condition{
			Type:    infrav1.WorkspaceReadyCondition,
			Status:  metav1.ConditionFalse,
			Reason:  infrav1.WorkspaceTagAttachFailed,
			Message: err.Error(),
		})

During deletion of resources, This would enable us to correctly identify to which resource the tag failed.

```
3. Allows the cluster creation to proceed and complete successfully despite the tag attachment failure.

- **Deletion Behavior**

When the user triggers deletion of a cluster where tag attachment previously failed, the controller will check the condition status that is set during tag attachment failure. Based on this condition set, the controller will determine whether to proceed with resource deletion.


#### Creating a new cluster with reusing pre-created resources
- When cluster is created using existing resources, no tag will be attached. We won't delete these resources, as these were not created by controller.
#### Creating a new cluster with reusing pre-created resources from old cluster.
Expand All @@ -50,7 +109,7 @@ This proposal presents adding two kinds of tags to the resources created by cont
8. [COS Instance](https://www.ibm.com/products/cloud-object-storage)

#### Note
- 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 cannot delete connections since it doesn't support tagging. So to delete TransitGateway connections have to add tag `powervs.cluster.x-k8s.io/owner/<cluster-name>/TG: vpcconnection, powervsconnection` to TransitGateway. So will check if this tag is added to TransitGateway, will move with the deletion of connections.
- 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 cannot delete connections since it doesn't support tagging. So to delete TransitGateway connections have to add tag `powervs.cluster.x-k8s.io/owner/<cluster-name>/TG: vpcconnectionID, powervsconnectionID` to TransitGateway. So will check if this tag is added to TransitGateway, will move with the deletion of connections.

- To handle deletion DHCP server, have to tag DHCP Network. DHCP server doesn't support tagging.

Expand Down