Skip to content

Commit 48c48f4

Browse files
committed
address review comments
1 parent dcf0feb commit 48c48f4

File tree

1 file changed

+8
-113
lines changed

1 file changed

+8
-113
lines changed

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

Lines changed: 8 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22

33

44
## Motivation
5+
PowerVS cluster creation supports both creating infrastructure and using existing resources required for cluster creation. If the infrastructure is created during cluster creation then this tagging will be applied and created infrastructure will also be deleted based on tagging.
56
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.
67

78
Though its working as expected and fulfills the purpose, we see some drawbacks.
89
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.
910
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.
1011

1112
## Goal
12-
1. This proposal aims to tag the PowerVS clusters and delete the resources created by controller based on tag.
13-
2. User should be able to add tags to the resources if he wants.
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.
1415

1516
## Proposal
1617
This proposal presents adding two kinds of tags to the resources created by controller
@@ -19,7 +20,7 @@ This proposal presents adding two kinds of tags to the resources created by cont
1920

2021

2122
### Controller tag
22-
Add Controller tag `powervs.cluster.x-k8s.io-resource-owner:<cluster_name>` to handle deletion of PowerVS Cluster resources created by controller
23+
A tag of format`powervs.cluster.x-k8s.io-resource-owner:<cluster_name>` will be added by the controller to newly created cloud resources marking the resource as created by controller. During deletion phase the system will look for the presence of the tag inorder to proceed with deletion or to keep as it is.
2324

2425

2526
#### Following resources will be getting tagged
@@ -30,6 +31,7 @@ Add Controller tag `powervs.cluster.x-k8s.io-resource-owner:<cluster_name>` to h
3031
5. [VPC Security Groups](https://cloud.ibm.com/docs/vpc?topic=vpc-security-in-your-vpc)
3132
6. [Transit Gateway](https://www.ibm.com/products/transit-gateway)
3233
7. [VPC Loadbalancer](https://www.ibm.com/products/load-balancer)
34+
8. [COS Instance](https://www.ibm.com/products/cloud-object-storage)
3335

3436
#### Note
3537
- Currently TransitGateway Connections doesn't support tagging, So we will handle deletion of connections based on VPC.
@@ -48,123 +50,16 @@ UserTags field will contain list of tags that will be applied on resources.
4850
type IBMPowerVSClusterSpec struct {
4951

5052
// UserTags contains list of tags needs to be applied on resources
51-
UserTags []string `json:"tags,omitempty"`
52-
53-
// ServiceInstanceID is the id of the power cloud instance where the vsi instance will get deployed.
54-
// Deprecated: use ServiceInstance instead
55-
ServiceInstanceID string `json:"serviceInstanceID"`
56-
57-
// Network is the reference to the Network to use for this cluster.
58-
// when the field is omitted, A DHCP service will be created in the Power VS workspace and its private network will be used.
59-
// the DHCP service created network will have the following name format
60-
// 1. in the case of DHCPServer.Name is not set the name will be DHCPSERVER<CLUSTER_NAME>_Private.
61-
// 2. if DHCPServer.Name is set the name will be DHCPSERVER<DHCPServer.Name>_Private.
62-
// when Network.ID is set, its expected that there exist a network in PowerVS workspace with id or else system will give error.
63-
// when Network.Name is set, system will first check for network with Name in PowerVS workspace, if not exist system will check DHCP network with given Network.name, if that also not exist, it will create a new DHCP service and name will be DHCPSERVER<Network.Name>_Private.
64-
// Network.RegEx is not yet supported and system will ignore the value.
65-
Network IBMPowerVSResourceReference `json:"network"`
66-
67-
// dhcpServer is contains the configuration to be used while creating a new DHCP server in PowerVS workspace.
68-
// when the field is omitted, CLUSTER_NAME will be used as DHCPServer.Name and DHCP server will be created.
69-
// it will automatically create network with name DHCPSERVER<DHCPServer.Name>_Private in PowerVS workspace.
70-
// +optional
71-
DHCPServer *DHCPServer `json:"dhcpServer,omitempty"`
72-
73-
// ControlPlaneEndpoint represents the endpoint used to communicate with the control plane.
74-
// +optional
75-
ControlPlaneEndpoint capiv1beta1.APIEndpoint `json:"controlPlaneEndpoint"`
76-
77-
// serviceInstance is the reference to the Power VS server workspace on which the server instance(VM) will be created.
78-
// Power VS server workspace is a container for all Power VS instances at a specific geographic region.
79-
// serviceInstance can be created via IBM Cloud catalog or CLI.
80-
// supported serviceInstance identifier in PowerVSResource are Name and ID and that can be obtained from IBM Cloud UI or IBM Cloud cli.
81-
// More detail about Power VS service instance.
82-
// https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-creating-power-virtual-server
83-
// when omitted system will dynamically create the service instance with name CLUSTER_NAME-serviceInstance.
84-
// when ServiceInstance.ID is set, its expected that there exist a service instance in PowerVS workspace with id or else system will give error.
85-
// when ServiceInstance.Name is set, system will first check for service instance with Name in PowerVS workspace, if not exist system will create new instance.
86-
// if there are more than one service instance exist with the ServiceInstance.Name in given Zone, installation fails with an error. Use ServiceInstance.ID in those situations to use the specific service instance.
87-
// ServiceInstance.Regex is not yet supported not yet supported and system will ignore the value.
88-
// +optional
89-
ServiceInstance *IBMPowerVSResourceReference `json:"serviceInstance,omitempty"`
90-
91-
// zone is the name of Power VS zone where the cluster will be created
92-
// possible values can be found here https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-creating-power-virtual-server.
93-
// when powervs.cluster.x-k8s.io/create-infra=true annotation is set on IBMPowerVSCluster resource,
94-
// 1. it is expected to set the zone, not setting will result in webhook error.
95-
// 2. the zone should have PER capabilities, or else system will give error.
96-
// +optional
97-
Zone *string `json:"zone,omitempty"`
98-
99-
// resourceGroup name under which the resources will be created.
100-
// when powervs.cluster.x-k8s.io/create-infra=true annotation is set on IBMPowerVSCluster resource,
101-
// 1. it is expected to set the ResourceGroup.Name, not setting will result in webhook error.
102-
// ResourceGroup.ID and ResourceGroup.Regex is not yet supported and system will ignore the value.
103-
// +optional
104-
ResourceGroup *IBMPowerVSResourceReference `json:"resourceGroup,omitempty"`
105-
106-
// vpc contains information about IBM Cloud VPC resources.
107-
// when omitted system will dynamically create the VPC with name CLUSTER_NAME-vpc.
108-
// when VPC.ID is set, its expected that there exist a VPC with ID or else system will give error.
109-
// when VPC.Name is set, system will first check for VPC with Name, if not exist system will create new VPC.
110-
// when powervs.cluster.x-k8s.io/create-infra=true annotation is set on IBMPowerVSCluster resource,
111-
// 1. it is expected to set the VPC.Region, not setting will result in webhook error.
112-
// +optional
113-
VPC *VPCResourceReference `json:"vpc,omitempty"`
114-
115-
// vpcSubnets contains information about IBM Cloud VPC Subnet resources.
116-
// when omitted system will create the subnets in all the zone corresponding to VPC.Region, with name CLUSTER_NAME-vpcsubnet-ZONE_NAME.
117-
// possible values can be found here https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-creating-power-virtual-server.
118-
// when VPCSubnets[].ID is set, its expected that there exist a subnet with ID or else system will give error.
119-
// when VPCSubnets[].Zone is not set, a random zone is picked from available zones of VPC.Region.
120-
// when VPCSubnets[].Name is not set, system will set name as CLUSTER_NAME-vpcsubnet-INDEX.
121-
// if subnet with name VPCSubnets[].Name not found, system will create new subnet in VPCSubnets[].Zone.
122-
// +optional
123-
VPCSubnets []Subnet `json:"vpcSubnets,omitempty"`
124-
125-
// VPCSecurityGroups to attach it to the VPC resource
126-
// +optional
127-
VPCSecurityGroups []VPCSecurityGroup `json:"vpcSecurityGroups,omitempty"`
128-
129-
// transitGateway contains information about IBM Cloud TransitGateway
130-
// IBM Cloud TransitGateway helps in establishing network connectivity between IBM Cloud Power VS and VPC infrastructure
131-
// more information about TransitGateway can be found here https://www.ibm.com/products/transit-gateway.
132-
// when TransitGateway.ID is set, its expected that there exist a TransitGateway with ID or else system will give error.
133-
// when TransitGateway.Name is set, system will first check for TransitGateway with Name, if not exist system will create new TransitGateway.
134-
// +optional
135-
TransitGateway *TransitGateway `json:"transitGateway,omitempty"`
136-
137-
// loadBalancers is optional configuration for configuring loadbalancers to control plane or data plane nodes.
138-
// when omitted system will create a default public loadbalancer with name CLUSTER_NAME-loadbalancer.
139-
// when specified a vpc loadbalancer will be created and controlPlaneEndpoint will be set with associated hostname of loadbalancer.
140-
// ControlPlaneEndpoint will be set with associated hostname of public loadbalancer.
141-
// when LoadBalancers[].ID is set, its expected that there exist a loadbalancer with ID or else system will give error.
142-
// when LoadBalancers[].Name is set, system will first check for loadbalancer with Name, if not exist system will create new loadbalancer.
143-
// For each loadbalancer a default backed pool and front listener will be configured with port 6443.
144-
// +optional
145-
LoadBalancers []VPCLoadBalancerSpec `json:"loadBalancers,omitempty"`
146-
147-
// cosInstance contains options to configure a supporting IBM Cloud COS bucket for this
148-
// cluster - currently used for nodes requiring Ignition
149-
// (https://coreos.github.io/ignition/) for bootstrapping (requires
150-
// BootstrapFormatIgnition feature flag to be enabled).
151-
// when powervs.cluster.x-k8s.io/create-infra=true annotation is set on IBMPowerVSCluster resource and Ignition is set, then
152-
// 1. CosInstance.Name should be set not setting will result in webhook error.
153-
// 2. CosInstance.BucketName should be set not setting will result in webhook error.
154-
// 3. CosInstance.BucketRegion should be set not setting will result in webhook error.
155-
// +optional
156-
CosInstance *CosInstance `json:"cosInstance,omitempty"`
157-
158-
// Ignition defined options related to the bootstrapping systems where Ignition is used.
159-
// +optional
160-
Ignition *Ignition `json:"ignition,omitempty"`
53+
UserTags []string `json:"tags,omitempty"`
54+
16155
}
16256

16357
```
16458

16559

16660
### Cluster creation workflow
16761
The controller will attach the tag to the resources after resources are created.
62+
During cluster creation first we will check if User tags set or not, if it is set then those tags will be attached to the resources. After that Controller tag will be attached to all the resources created by conroller.
16863
![add-tag-workflow.png](../images/add-tag-workflow.png)
16964

17065

0 commit comments

Comments
 (0)